unsigned long map_new_virtual(struct page * page )
{
for (;;)
{
int count;
DECLARE_WAITQUEUE(wait, current);
for (count = LAST_PKMAP; count > 0; --count)
{
last_pkmap_nr = (last_pkmap_nr + 1) & (LAST_PKMAP - 1);
// 1> last_pkmap_nr在哪里初始化? // 2>这个“和”是做什么的?
if (!last_pkmap_nr)
{
flush_all_zero_pkmaps( );
count = LAST_PKMAP;
}
// 3>以上三行是做什么的?
if (!pkmap_count[last_pkmap_nr])
{
unsigned long vaddr = PKMAP_BASE +
(last_pkmap_nr << PAGE_SHIFT);
set_pte(&(pkmap_page_table[last_pkmap_nr]),
mk_pte(page, _ _pgprot(0x63)));
// 4> set_pte和mk_pte做什么?我猜mk_pte创建一个条目,set_pte将该条目与pkmap_page_table [last_pkmap_nr]相关联;但我需要更详细的解释。参数页的含义是什么,__ pgprot()是什么?表格pkmap_page_table [last_pkmap_nr]看起来如何?
pkmap_count[last_pkmap_nr] = 1;
set_page_address(page, (void *) vaddr);
return vaddr;
}
}
current->state = TASK_UNINTERRUPTIBLE;
add_wait_queue(&pkmap_map_wait, &wait);
spin_unlock(&kmap_lock);
schedule( );
remove_wait_queue(&pkmap_map_wait, &wait);
spin_lock(&kmap_lock);
if (page_address(page))
{
return (unsigned long) page_address(page);
}
}
}
如上所述,我有3个疑问->
last_pkmap_nr = (last_pkmap_nr + 1) & (LAST_PKMAP - 1);
// 1> last_pkmap_nr在哪里初始化? // 2>这是做什么的?
if (!last_pkmap_nr)
{
flush_all_zero_pkmaps( );
count = LAST_PKMAP;
}
// 3>以上三行是做什么的?