Merge branch 'master' of github.com:chyyuu/ucore_lab

This commit is contained in:
yuchen 2015-05-06 12:42:16 +08:00
commit e378ef4376
34 changed files with 104 additions and 104 deletions

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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;