Browse Source

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

main
yuchen 9 years ago
parent
commit
e378ef4376
34 changed files with 104 additions and 104 deletions
  1. +6
    -6
      labcodes/lab2/kern/mm/pmm.c
  2. +6
    -6
      labcodes/lab3/kern/mm/pmm.c
  3. +1
    -1
      labcodes/lab3/kern/mm/vmm.c
  4. +6
    -6
      labcodes/lab4/kern/mm/pmm.c
  5. +1
    -1
      labcodes/lab4/kern/mm/vmm.c
  6. +6
    -6
      labcodes/lab5/kern/mm/pmm.c
  7. +1
    -1
      labcodes/lab5/kern/mm/swap.c
  8. +1
    -1
      labcodes/lab5/kern/mm/vmm.c
  9. +6
    -6
      labcodes/lab6/kern/mm/pmm.c
  10. +1
    -1
      labcodes/lab6/kern/mm/swap.c
  11. +1
    -1
      labcodes/lab6/kern/mm/vmm.c
  12. +6
    -6
      labcodes/lab7/kern/mm/pmm.c
  13. +1
    -1
      labcodes/lab7/kern/mm/swap.c
  14. +1
    -1
      labcodes/lab7/kern/mm/vmm.c
  15. +6
    -6
      labcodes/lab8/kern/mm/pmm.c
  16. +1
    -1
      labcodes/lab8/kern/mm/swap.c
  17. +1
    -1
      labcodes/lab8/kern/mm/vmm.c
  18. +6
    -6
      labcodes_answer/lab2_result/kern/mm/pmm.c
  19. +6
    -6
      labcodes_answer/lab3_result/kern/mm/pmm.c
  20. +1
    -1
      labcodes_answer/lab3_result/kern/mm/vmm.c
  21. +6
    -6
      labcodes_answer/lab4_result/kern/mm/pmm.c
  22. +1
    -1
      labcodes_answer/lab4_result/kern/mm/vmm.c
  23. +6
    -6
      labcodes_answer/lab5_result/kern/mm/pmm.c
  24. +1
    -1
      labcodes_answer/lab5_result/kern/mm/swap.c
  25. +1
    -1
      labcodes_answer/lab5_result/kern/mm/vmm.c
  26. +6
    -6
      labcodes_answer/lab6_result/kern/mm/pmm.c
  27. +1
    -1
      labcodes_answer/lab6_result/kern/mm/swap.c
  28. +1
    -1
      labcodes_answer/lab6_result/kern/mm/vmm.c
  29. +6
    -6
      labcodes_answer/lab7_result/kern/mm/pmm.c
  30. +1
    -1
      labcodes_answer/lab7_result/kern/mm/swap.c
  31. +1
    -1
      labcodes_answer/lab7_result/kern/mm/vmm.c
  32. +6
    -6
      labcodes_answer/lab8_result/kern/mm/pmm.c
  33. +1
    -1
      labcodes_answer/lab8_result/kern/mm/swap.c
  34. +1
    -1
      labcodes_answer/lab8_result/kern/mm/vmm.c

+ 6
- 6
labcodes/lab2/kern/mm/pmm.c 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");

+ 6
- 6
labcodes/lab3/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab3/kern/mm/vmm.c 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;

+ 6
- 6
labcodes/lab4/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab4/kern/mm/vmm.c 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;

+ 6
- 6
labcodes/lab5/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab5/kern/mm/swap.c 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);

+ 1
- 1
labcodes/lab5/kern/mm/vmm.c 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;

+ 6
- 6
labcodes/lab6/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab6/kern/mm/swap.c 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);

+ 1
- 1
labcodes/lab6/kern/mm/vmm.c 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;

+ 6
- 6
labcodes/lab7/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab7/kern/mm/swap.c 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);

+ 1
- 1
labcodes/lab7/kern/mm/vmm.c 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;

+ 6
- 6
labcodes/lab8/kern/mm/pmm.c 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");

+ 1
- 1
labcodes/lab8/kern/mm/swap.c 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);

+ 1
- 1
labcodes/lab8/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab2_result/kern/mm/pmm.c 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");

+ 6
- 6
labcodes_answer/lab3_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab3_result/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab4_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab4_result/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab5_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab5_result/kern/mm/swap.c 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);

+ 1
- 1
labcodes_answer/lab5_result/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab6_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab6_result/kern/mm/swap.c 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);

+ 1
- 1
labcodes_answer/lab6_result/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab7_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab7_result/kern/mm/swap.c 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);

+ 1
- 1
labcodes_answer/lab7_result/kern/mm/vmm.c 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;

+ 6
- 6
labcodes_answer/lab8_result/kern/mm/pmm.c 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");

+ 1
- 1
labcodes_answer/lab8_result/kern/mm/swap.c 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);

+ 1
- 1
labcodes_answer/lab8_result/kern/mm/vmm.c 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;

Loading…
Cancel
Save