55,7 → 55,8 |
static bool compare(unative_t key[], count_t keys, link_t *item); |
static void remove_callback(link_t *item); |
|
static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags); |
static void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, |
int flags); |
static void ht_mapping_remove(as_t *as, uintptr_t page); |
static pte_t *ht_mapping_find(as_t *as, uintptr_t page); |
|
136,7 → 137,8 |
t = hash_table_get_instance(item, pte_t, link); |
|
if (keys == PAGE_HT_KEYS) { |
return (key[KEY_AS] == (uintptr_t) t->as) && (key[KEY_PAGE] == t->page); |
return (key[KEY_AS] == (uintptr_t) t->as) && |
(key[KEY_PAGE] == t->page); |
} else { |
return (key[KEY_AS] == (uintptr_t) t->as); |
} |
175,7 → 177,10 |
void ht_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags) |
{ |
pte_t *t; |
unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; |
unative_t key[2] = { |
(uintptr_t) as, |
page = ALIGN_DOWN(page, PAGE_SIZE) |
}; |
|
if (!hash_table_find(&page_ht, key)) { |
t = (pte_t *) malloc(sizeof(pte_t), FRAME_ATOMIC); |
209,7 → 214,10 |
*/ |
void ht_mapping_remove(as_t *as, uintptr_t page) |
{ |
unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; |
unative_t key[2] = { |
(uintptr_t) as, |
page = ALIGN_DOWN(page, PAGE_SIZE) |
}; |
|
/* |
* Note that removed PTE's will be freed |
234,7 → 242,10 |
{ |
link_t *hlp; |
pte_t *t = NULL; |
unative_t key[2] = { (uintptr_t) as, page = ALIGN_DOWN(page, PAGE_SIZE) }; |
unative_t key[2] = { |
(uintptr_t) as, |
page = ALIGN_DOWN(page, PAGE_SIZE) |
}; |
|
hlp = hash_table_find(&page_ht, key); |
if (hlp) |