Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 1044 → Rev 1043

/kernel/trunk/genarch/src/mm/page_ht.c
52,9 → 52,7
static pte_t *ht_mapping_find(as_t *as, __address page);
 
/**
* This lock protects the page hash table. It must be acquired
* after address space lock and after any address space area
* locks.
* This lock protects the page hash table.
*/
SPINLOCK_INITIALIZE(page_ht_lock);
 
157,7 → 155,7
* Map virtual address 'page' to physical address 'frame'
* using 'flags'.
*
* The page table must be locked and interrupts must be disabled.
* The address space must be locked and interruptsmust be disabled.
*
* @param as Address space to which page belongs.
* @param page Virtual address of the page to be mapped.
169,6 → 167,8
pte_t *t;
__native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };
spinlock_lock(&page_ht_lock);
 
if (!hash_table_find(&page_ht, key)) {
t = (pte_t *) malloc(sizeof(pte_t), FRAME_ATOMIC);
ASSERT(t != NULL);
186,6 → 186,8
 
hash_table_insert(&page_ht, key, &t->link);
}
spinlock_unlock(&page_ht_lock);
}
 
/** Remove mapping of page from page hash table.
194,7 → 196,7
* TLB shootdown should follow in order to make effects of
* this call visible.
*
* The page table must be locked and interrupts must be disabled.
* The address space must be locked and interrupts must be disabled.
*
* @param as Address space to wich page belongs.
* @param page Virtual address of the page to be demapped.
203,11 → 205,15
{
__native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };
spinlock_lock(&page_ht_lock);
 
/*
* Note that removed PTE's will be freed
* by remove_callback().
*/
hash_table_remove(&page_ht, key, 2);
 
spinlock_unlock(&page_ht_lock);
}
 
 
215,7 → 221,7
*
* Find mapping for virtual page.
*
* The page table must be locked and interrupts must be disabled.
* The address space must be locked and interrupts must be disabled.
*
* @param as Address space to wich page belongs.
* @param page Virtual page.
228,9 → 234,12
pte_t *t = NULL;
__native key[2] = { (__address) as, page = ALIGN_DOWN(page, PAGE_SIZE) };
spinlock_lock(&page_ht_lock);
 
hlp = hash_table_find(&page_ht, key);
if (hlp)
t = hash_table_get_instance(hlp, pte_t, link);
 
spinlock_unlock(&page_ht_lock);
return t;
}