Ignore:
File:
1 edited

Legend:

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

    r2fc3b2d rca21f1e2  
    4545#include <synch/mutex.h>
    4646#include <adt/list.h>
     47#include <adt/btree.h>
    4748#include <adt/odict.h>
    4849#include <lib/elf.h>
     
    136137} as_operations_t;
    137138
    138 /** Single anonymous page mapping. */
    139 typedef struct {
    140         /** Containing pagemap structure */
    141         struct as_pagemap *pagemap;
    142         /** Link to @c shinfo->pagemap ordered dictionary */
    143         odlink_t lpagemap;
    144         /** Virtual address */
    145         uintptr_t vaddr;
    146         /** Physical frame address */
    147         uintptr_t frame;
    148 } as_page_mapping_t;
    149 
    150 /** Map of anonymous pages in a shared area. */
    151 typedef struct as_pagemap {
    152         /**
    153          * Dictionary ordered by virtual address. Members are of type
    154          * as_page_mapping_t
    155          */
    156         odict_t map;
    157 } as_pagemap_t;
    158 
    159 /** Used space interval */
    160 typedef struct {
    161         /** Containing used_space structure */
    162         struct used_space *used_space;
    163         /** Link to @c used_space->ivals */
    164         odlink_t lused_space;
    165         /** First page address */
    166         uintptr_t page;
    167         /** Count of pages */
    168         size_t count;
    169 } used_space_ival_t;
    170 
    171 /** Map of used space in an address space area */
    172 typedef struct used_space {
    173         /**
    174          * Dictionary of intervals by start address.
    175          * Members are of type @c used_space_ival_t.
    176          */
    177         odict_t ivals;
    178         /** Total number of used pages. */
    179         size_t pages;
    180 } used_space_t;
    181 
    182139/**
    183140 * This structure contains information associated with the shared address space
     
    193150        bool shared;
    194151
    195         /** Complete map of anonymous pages of the shared area. */
    196         as_pagemap_t pagemap;
     152        /**
     153         * B+tree containing complete map of anonymous pages of the shared area.
     154         */
     155        btree_t pagemap;
    197156
    198157        /** Address space area backend. */
     
    262221        size_t pages;
    263222
     223        /** Number of resident pages in the area. */
     224        size_t resident;
     225
    264226        /** Base address of this area. */
    265227        uintptr_t base;
    266228
    267229        /** Map of used space. */
    268         used_space_t used_space;
     230        btree_t used_space;
    269231
    270232        /**
     
    321283extern as_area_t *as_area_next(as_area_t *);
    322284
    323 extern void as_pagemap_initialize(as_pagemap_t *);
    324 extern void as_pagemap_finalize(as_pagemap_t *);
    325 extern as_page_mapping_t *as_pagemap_first(as_pagemap_t *);
    326 extern as_page_mapping_t *as_pagemap_next(as_page_mapping_t *);
    327 extern errno_t as_pagemap_find(as_pagemap_t *, uintptr_t, uintptr_t *);
    328 extern void as_pagemap_insert(as_pagemap_t *, uintptr_t, uintptr_t);
    329 extern void as_pagemap_remove(as_page_mapping_t *);
    330 
    331285extern unsigned int as_area_get_flags(as_area_t *);
    332286extern bool as_area_check_access(as_area_t *, pf_access_t);
    333287extern size_t as_area_get_size(uintptr_t);
    334 extern used_space_ival_t *used_space_first(used_space_t *);
    335 extern used_space_ival_t *used_space_next(used_space_ival_t *);
    336 extern used_space_ival_t *used_space_find_gteq(used_space_t *, uintptr_t);
    337 extern bool used_space_insert(used_space_t *, uintptr_t, size_t);
     288extern bool used_space_insert(as_area_t *, uintptr_t, size_t);
     289extern bool used_space_remove(as_area_t *, uintptr_t, size_t);
    338290
    339291/* Interface to be implemented by architectures. */
Note: See TracChangeset for help on using the changeset viewer.