Changeset 01029fc in mainline


Ignore:
Timestamp:
2012-11-07T21:30:44Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b8a990
Parents:
c387838
Message:

Define two new as area backend callbacks.

  • Add is_resizable(as_area_t *)
  • Add is_shareable(as_area_t *)
  • Remove special knowledge of the phys backend from as_area_resize()
Location:
kernel/generic
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/as.h

    rc387838 r01029fc  
    224224        void (* destroy)(as_area_t *);
    225225
     226        bool (* is_resizable)(as_area_t *);
     227        bool (* is_shareable)(as_area_t *);
     228
    226229        int (* page_fault)(as_area_t *, uintptr_t, pf_access_t);
    227230        void (* frame_free)(as_area_t *, uintptr_t, uintptr_t);
  • kernel/generic/src/mm/as.c

    rc387838 r01029fc  
    696696                return ENOENT;
    697697        }
    698        
    699         if (area->backend == &phys_backend) {
    700                 /*
    701                  * Remapping of address space areas associated
    702                  * with memory mapped devices is not supported.
     698
     699        if (!area->backend->is_resizable(area)) {
     700                /*
     701                 * The backend does not support resizing for this area.
    703702                 */
    704703                mutex_unlock(&area->lock);
     
    10571056        }
    10581057       
    1059         if ((!src_area->backend) || (!src_area->backend->share)) {
    1060                 /*
    1061                  * There is no backend or the backend does not
    1062                  * know how to share the area.
     1058        if (!src_area->backend->is_shareable(src_area)) {
     1059                /*
     1060                 * The backend does not permit sharing of this area.
    10631061                 */
    10641062                mutex_unlock(&src_area->lock);
  • kernel/generic/src/mm/backend_anon.c

    rc387838 r01029fc  
    5959static void anon_destroy(as_area_t *);
    6060
     61static bool anon_is_resizable(as_area_t *);
     62static bool anon_is_shareable(as_area_t *);
     63
    6164static int anon_page_fault(as_area_t *, uintptr_t, pf_access_t);
    6265static void anon_frame_free(as_area_t *, uintptr_t, uintptr_t);
     
    6770        .share = anon_share,
    6871        .destroy = anon_destroy,
     72
     73        .is_resizable = anon_is_resizable,
     74        .is_shareable = anon_is_shareable,
    6975
    7076        .page_fault = anon_page_fault,
     
    152158}
    153159
     160bool anon_is_resizable(as_area_t *area)
     161{
     162        return true;
     163}
     164
     165bool anon_is_shareable(as_area_t *area)
     166{
     167        return !(area->flags & AS_AREA_LATE_RESERVE);
     168}
    154169
    155170/** Service a page fault in the anonymous memory address space area.
  • kernel/generic/src/mm/backend_elf.c

    rc387838 r01029fc  
    5858static void elf_destroy(as_area_t *);
    5959
     60static bool elf_is_resizable(as_area_t *);
     61static bool elf_is_shareable(as_area_t *);
     62
    6063static int elf_page_fault(as_area_t *, uintptr_t, pf_access_t);
    6164static void elf_frame_free(as_area_t *, uintptr_t, uintptr_t);
     
    6669        .share = elf_share,
    6770        .destroy = elf_destroy,
     71
     72        .is_resizable = elf_is_resizable,
     73        .is_shareable = elf_is_shareable,
    6874
    6975        .page_fault = elf_page_fault,
     
    213219}
    214220
     221bool elf_is_resizable(as_area_t *area)
     222{
     223        return true;
     224}
     225
     226bool elf_is_shareable(as_area_t *area)
     227{
     228        return true;
     229}
     230
     231
    215232/** Service a page fault in the ELF backend address space area.
    216233 *
  • kernel/generic/src/mm/backend_phys.c

    rc387838 r01029fc  
    5252static void phys_destroy(as_area_t *);
    5353
     54static bool phys_is_resizable(as_area_t *);
     55static bool phys_is_shareable(as_area_t *);
     56
     57
    5458static int phys_page_fault(as_area_t *, uintptr_t, pf_access_t);
    5559
     
    5963        .share = phys_share,
    6064        .destroy = phys_destroy,
     65
     66        .is_resizable = phys_is_resizable,
     67        .is_shareable = phys_is_shareable,
    6168
    6269        .page_fault = phys_page_fault,
     
    8794        /* Nothing to do. */
    8895}
     96
     97bool phys_is_resizable(as_area_t *area)
     98{
     99        return false;
     100}
     101
     102bool phys_is_shareable(as_area_t *area)
     103{
     104        return true;
     105}
     106
    89107
    90108/** Service a page fault in the address space area backed by physical memory.
Note: See TracChangeset for help on using the changeset viewer.