From: Dave A. <ai...@us...> - 2001-05-19 12:12:05
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/vax/mm In directory usw-pr-cvs1:/tmp/cvs-serv29098/arch/vax/mm Modified Files: init.c Log Message: DA: moved remap_and_clear_pte_page around it now allocates a page of S0 space to put P0/P1 ptes into .. it clears the page .. it is called from pte_alloc .. not sure if this was the right place to do this .. but it look as good as any ... Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/vax/mm/init.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- init.c 2001/02/18 16:42:45 1.8 +++ init.c 2001/05/19 12:12:02 1.9 @@ -138,25 +138,37 @@ /* remap a given page to be part of a contiguous page table for p0/1 space */ void remap_and_clear_pte_page(pgd_t *pagetable, pte_t *page, unsigned long pte_page) { - unsigned long page_physical_address, page_virtual_address; + unsigned long page_physical_address, page_virtual_address, page_s0_address; pte_t *S0pte; pte_t tpte; - - /* zero out these pte's */ - clear_page((void *) page); - - /* page addresses */ - page_physical_address = __pa(page); - page_virtual_address = (pte_page * PAGE_SIZE) + pagetable->br; - - /* S0 pte entry for this virtual address */ - S0pte = ((page_virtual_address - PAGE_OFFSET) >> PAGE_SHIFT)+swapper_pg_dir; + pte_t *newpage; + pgd_t *sys_pgd = swapper_pg_dir+2; + /* address in S0 space is page pointer */ + /* find the entry in the SPTE corresponding to this page */ - /* FIXME: what if the page is already mapped? (TASK_SIZE) */ - pte_clear(S0pte); - tpte = mk_pte_phys((void*)page_physical_address,(pgprot_t)PAGE_KERNEL); - set_pte(S0pte, tpte); + S0pte = (pte_t *)((__pa(page) >> PAGELET_SHIFT)+sys_pgd->br); + printk("remap: virt addr %p, pteval %8lX , S0pte %p, %8lX\n", page, pte_val(*page), S0pte, pte_val(*S0pte)); + + printk("empty_zero_page %p %8lX\n", &empty_zero_page, __pa(&empty_zero_page)>>PAGELET_SHIFT); + if (!pte_present(*S0pte)) + { + unsigned long phy_addr; + pgd_t *ret = (pgd_t *)__get_free_page(GFP_KERNEL); + /* we have address in S0 of free page */ + /* need to remap this free page to the address in S0 where we are */ + /* Get the phy address of the page */ + //spte = pte_offset(sys_pgd, ((unsigned long)ret - PAGE_OFFSET)); + clear_page((void *)ret); + pte_clear(S0pte); + tpte = mk_pte((void *)ret, (pgprot_t)PAGE_KERNEL); + + set_pte(S0pte, tpte); + /* grab a free page */ + printk("S0 page invalid, %p %8lX\n", ret, pte_val(tpte)); + return; + } + /* zero out these pte's */ + // clear_page((void *) page); return; } - |