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"); diff --git a/labcodes/lab3/kern/mm/pmm.c b/labcodes/lab3/kern/mm/pmm.c index 77633f2..d397abc 100644 --- a/labcodes/lab3/kern/mm/pmm.c +++ b/labcodes/lab3/kern/mm/pmm.c @@ -403,7 +403,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; } @@ -528,7 +528,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]; @@ -546,7 +546,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); @@ -557,8 +557,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"); @@ -592,7 +592,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"); diff --git a/labcodes/lab3/kern/mm/vmm.c b/labcodes/lab3/kern/mm/vmm.c index 2973e5b..9fa3301 100644 --- a/labcodes/lab3/kern/mm/vmm.c +++ b/labcodes/lab3/kern/mm/vmm.c @@ -266,7 +266,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes/lab4/kern/mm/pmm.c b/labcodes/lab4/kern/mm/pmm.c index 59c70d9..96e49e2 100644 --- a/labcodes/lab4/kern/mm/pmm.c +++ b/labcodes/lab4/kern/mm/pmm.c @@ -406,7 +406,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; } @@ -531,7 +531,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]; @@ -549,7 +549,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); @@ -560,8 +560,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"); @@ -595,7 +595,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"); diff --git a/labcodes/lab4/kern/mm/vmm.c b/labcodes/lab4/kern/mm/vmm.c index 7370361..b402145 100644 --- a/labcodes/lab4/kern/mm/vmm.c +++ b/labcodes/lab4/kern/mm/vmm.c @@ -263,7 +263,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes/lab5/kern/mm/pmm.c b/labcodes/lab5/kern/mm/pmm.c index cb92075..7a2e95d 100644 --- a/labcodes/lab5/kern/mm/pmm.c +++ b/labcodes/lab5/kern/mm/pmm.c @@ -406,7 +406,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; } @@ -625,7 +625,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]; @@ -643,7 +643,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); @@ -654,8 +654,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"); @@ -689,7 +689,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"); diff --git a/labcodes/lab5/kern/mm/swap.c b/labcodes/lab5/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes/lab5/kern/mm/swap.c +++ b/labcodes/lab5/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes/lab5/kern/mm/vmm.c b/labcodes/lab5/kern/mm/vmm.c index 3727bbb..f2eb426 100644 --- a/labcodes/lab5/kern/mm/vmm.c +++ b/labcodes/lab5/kern/mm/vmm.c @@ -353,7 +353,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes/lab6/kern/mm/pmm.c b/labcodes/lab6/kern/mm/pmm.c index cb92075..7a2e95d 100644 --- a/labcodes/lab6/kern/mm/pmm.c +++ b/labcodes/lab6/kern/mm/pmm.c @@ -406,7 +406,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; } @@ -625,7 +625,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]; @@ -643,7 +643,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); @@ -654,8 +654,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"); @@ -689,7 +689,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"); diff --git a/labcodes/lab6/kern/mm/swap.c b/labcodes/lab6/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes/lab6/kern/mm/swap.c +++ b/labcodes/lab6/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes/lab6/kern/mm/vmm.c b/labcodes/lab6/kern/mm/vmm.c index 3727bbb..f2eb426 100644 --- a/labcodes/lab6/kern/mm/vmm.c +++ b/labcodes/lab6/kern/mm/vmm.c @@ -353,7 +353,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes/lab7/kern/mm/pmm.c b/labcodes/lab7/kern/mm/pmm.c index cb92075..7a2e95d 100644 --- a/labcodes/lab7/kern/mm/pmm.c +++ b/labcodes/lab7/kern/mm/pmm.c @@ -406,7 +406,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; } @@ -625,7 +625,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]; @@ -643,7 +643,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); @@ -654,8 +654,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"); @@ -689,7 +689,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"); diff --git a/labcodes/lab7/kern/mm/swap.c b/labcodes/lab7/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes/lab7/kern/mm/swap.c +++ b/labcodes/lab7/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes/lab7/kern/mm/vmm.c b/labcodes/lab7/kern/mm/vmm.c index 6799d1c..ce1a0bb 100644 --- a/labcodes/lab7/kern/mm/vmm.c +++ b/labcodes/lab7/kern/mm/vmm.c @@ -353,7 +353,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes/lab8/kern/mm/pmm.c b/labcodes/lab8/kern/mm/pmm.c index cb92075..7a2e95d 100644 --- a/labcodes/lab8/kern/mm/pmm.c +++ b/labcodes/lab8/kern/mm/pmm.c @@ -406,7 +406,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; } @@ -625,7 +625,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]; @@ -643,7 +643,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); @@ -654,8 +654,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"); @@ -689,7 +689,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"); diff --git a/labcodes/lab8/kern/mm/swap.c b/labcodes/lab8/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes/lab8/kern/mm/swap.c +++ b/labcodes/lab8/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes/lab8/kern/mm/vmm.c b/labcodes/lab8/kern/mm/vmm.c index 8cf880c..ed3021c 100644 --- a/labcodes/lab8/kern/mm/vmm.c +++ b/labcodes/lab8/kern/mm/vmm.c @@ -353,7 +353,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab2_result/kern/mm/pmm.c b/labcodes_answer/lab2_result/kern/mm/pmm.c index 020d14a..c61e506 100644 --- a/labcodes_answer/lab2_result/kern/mm/pmm.c +++ b/labcodes_answer/lab2_result/kern/mm/pmm.c @@ -402,7 +402,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; } @@ -512,7 +512,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]; @@ -530,7 +530,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); @@ -541,8 +541,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"); @@ -576,7 +576,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"); diff --git a/labcodes_answer/lab3_result/kern/mm/pmm.c b/labcodes_answer/lab3_result/kern/mm/pmm.c index fcb862e..379f1a4 100644 --- a/labcodes_answer/lab3_result/kern/mm/pmm.c +++ b/labcodes_answer/lab3_result/kern/mm/pmm.c @@ -415,7 +415,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; } @@ -548,7 +548,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]; @@ -566,7 +566,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); @@ -577,8 +577,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"); @@ -612,7 +612,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"); diff --git a/labcodes_answer/lab3_result/kern/mm/vmm.c b/labcodes_answer/lab3_result/kern/mm/vmm.c index 33228ee..33065c5 100644 --- a/labcodes_answer/lab3_result/kern/mm/vmm.c +++ b/labcodes_answer/lab3_result/kern/mm/vmm.c @@ -266,7 +266,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab4_result/kern/mm/pmm.c b/labcodes_answer/lab4_result/kern/mm/pmm.c index b597c5d..ac4efd6 100644 --- a/labcodes_answer/lab4_result/kern/mm/pmm.c +++ b/labcodes_answer/lab4_result/kern/mm/pmm.c @@ -418,7 +418,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; } @@ -551,7 +551,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]; @@ -569,7 +569,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); @@ -580,8 +580,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"); @@ -615,7 +615,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"); diff --git a/labcodes_answer/lab4_result/kern/mm/vmm.c b/labcodes_answer/lab4_result/kern/mm/vmm.c index af221e3..5881a83 100644 --- a/labcodes_answer/lab4_result/kern/mm/vmm.c +++ b/labcodes_answer/lab4_result/kern/mm/vmm.c @@ -267,7 +267,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab5_result/kern/mm/pmm.c b/labcodes_answer/lab5_result/kern/mm/pmm.c index cf9fa77..b3d8aa1 100644 --- a/labcodes_answer/lab5_result/kern/mm/pmm.c +++ b/labcodes_answer/lab5_result/kern/mm/pmm.c @@ -418,7 +418,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; } @@ -651,7 +651,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]; @@ -669,7 +669,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); @@ -680,8 +680,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"); @@ -715,7 +715,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"); diff --git a/labcodes_answer/lab5_result/kern/mm/swap.c b/labcodes_answer/lab5_result/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes_answer/lab5_result/kern/mm/swap.c +++ b/labcodes_answer/lab5_result/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes_answer/lab5_result/kern/mm/vmm.c b/labcodes_answer/lab5_result/kern/mm/vmm.c index 4f4aaed..b54a8ae 100644 --- a/labcodes_answer/lab5_result/kern/mm/vmm.c +++ b/labcodes_answer/lab5_result/kern/mm/vmm.c @@ -357,7 +357,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab6_result/kern/mm/pmm.c b/labcodes_answer/lab6_result/kern/mm/pmm.c index cf9fa77..b3d8aa1 100644 --- a/labcodes_answer/lab6_result/kern/mm/pmm.c +++ b/labcodes_answer/lab6_result/kern/mm/pmm.c @@ -418,7 +418,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; } @@ -651,7 +651,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]; @@ -669,7 +669,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); @@ -680,8 +680,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"); @@ -715,7 +715,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"); diff --git a/labcodes_answer/lab6_result/kern/mm/swap.c b/labcodes_answer/lab6_result/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes_answer/lab6_result/kern/mm/swap.c +++ b/labcodes_answer/lab6_result/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes_answer/lab6_result/kern/mm/vmm.c b/labcodes_answer/lab6_result/kern/mm/vmm.c index 37d0ee6..877b033 100644 --- a/labcodes_answer/lab6_result/kern/mm/vmm.c +++ b/labcodes_answer/lab6_result/kern/mm/vmm.c @@ -357,7 +357,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab7_result/kern/mm/pmm.c b/labcodes_answer/lab7_result/kern/mm/pmm.c index cf9fa77..b3d8aa1 100644 --- a/labcodes_answer/lab7_result/kern/mm/pmm.c +++ b/labcodes_answer/lab7_result/kern/mm/pmm.c @@ -418,7 +418,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; } @@ -651,7 +651,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]; @@ -669,7 +669,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); @@ -680,8 +680,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"); @@ -715,7 +715,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"); diff --git a/labcodes_answer/lab7_result/kern/mm/swap.c b/labcodes_answer/lab7_result/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes_answer/lab7_result/kern/mm/swap.c +++ b/labcodes_answer/lab7_result/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes_answer/lab7_result/kern/mm/vmm.c b/labcodes_answer/lab7_result/kern/mm/vmm.c index 4802f65..04f514d 100644 --- a/labcodes_answer/lab7_result/kern/mm/vmm.c +++ b/labcodes_answer/lab7_result/kern/mm/vmm.c @@ -357,7 +357,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; diff --git a/labcodes_answer/lab8_result/kern/mm/pmm.c b/labcodes_answer/lab8_result/kern/mm/pmm.c index cf9fa77..b3d8aa1 100644 --- a/labcodes_answer/lab8_result/kern/mm/pmm.c +++ b/labcodes_answer/lab8_result/kern/mm/pmm.c @@ -418,7 +418,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; } @@ -651,7 +651,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]; @@ -669,7 +669,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); @@ -680,8 +680,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"); @@ -715,7 +715,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"); diff --git a/labcodes_answer/lab8_result/kern/mm/swap.c b/labcodes_answer/lab8_result/kern/mm/swap.c index d2b5952..704ec18 100644 --- a/labcodes_answer/lab8_result/kern/mm/swap.c +++ b/labcodes_answer/lab8_result/kern/mm/swap.c @@ -262,7 +262,7 @@ check_swap(void) } //free_page(pte2page(*temp_ptep)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL; mm_destroy(mm); diff --git a/labcodes_answer/lab8_result/kern/mm/vmm.c b/labcodes_answer/lab8_result/kern/mm/vmm.c index 9f37163..9b12b3f 100644 --- a/labcodes_answer/lab8_result/kern/mm/vmm.c +++ b/labcodes_answer/lab8_result/kern/mm/vmm.c @@ -357,7 +357,7 @@ check_pgfault(void) { assert(sum == 0); page_remove(pgdir, ROUNDDOWN(addr, PGSIZE)); - free_page(pa2page(pgdir[0])); + free_page(pde2page(pgdir[0])); pgdir[0] = 0; mm->pgdir = NULL;