From eec735afbf4d72450eb69e91cb42588f4b963f4f Mon Sep 17 00:00:00 2001 From: ArchStacker Date: Mon, 4 May 2015 19:30:29 +0800 Subject: [PATCH] Fix the unsuitable use of pa2page in lab2 --- labcodes/lab2/kern/mm/pmm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/labcodes/lab2/kern/mm/pmm.c b/labcodes/lab2/kern/mm/pmm.c index af54731..4cddcbc 100644 --- a/labcodes/lab2/kern/mm/pmm.c +++ b/labcodes/lab2/kern/mm/pmm.c @@ -390,7 +390,7 @@ get_page(pde_t *pgdir, uintptr_t la, pte_t **ptep_store) { *ptep_store = ptep; } if (ptep != NULL && *ptep & PTE_P) { - return pa2page(*ptep); + return pte2page(*ptep); } return NULL; } @@ -492,7 +492,7 @@ check_pgdir(void) { pte_t *ptep; assert((ptep = get_pte(boot_pgdir, 0x0, 0)) != NULL); - assert(pa2page(*ptep) == p1); + assert(pte2page(*ptep) == p1); assert(page_ref(p1) == 1); ptep = &((pte_t *)KADDR(PDE_ADDR(boot_pgdir[0])))[1]; @@ -510,7 +510,7 @@ check_pgdir(void) { assert(page_ref(p1) == 2); assert(page_ref(p2) == 0); assert((ptep = get_pte(boot_pgdir, PGSIZE, 0)) != NULL); - assert(pa2page(*ptep) == p1); + assert(pte2page(*ptep) == p1); assert((*ptep & PTE_U) == 0); page_remove(boot_pgdir, 0x0); @@ -521,8 +521,8 @@ check_pgdir(void) { assert(page_ref(p1) == 0); assert(page_ref(p2) == 0); - assert(page_ref(pa2page(boot_pgdir[0])) == 1); - free_page(pa2page(boot_pgdir[0])); + assert(page_ref(pde2page(boot_pgdir[0])) == 1); + free_page(pde2page(boot_pgdir[0])); boot_pgdir[0] = 0; cprintf("check_pgdir() succeeded!\n"); @@ -556,7 +556,7 @@ check_boot_pgdir(void) { assert(strlen((const char *)0x100) == 0); free_page(p); - free_page(pa2page(PDE_ADDR(boot_pgdir[0]))); + free_page(pde2page(boot_pgdir[0])); boot_pgdir[0] = 0; cprintf("check_boot_pgdir() succeeded!\n");