Browse Source

Merge pull request #10 from Archstacker/fix_vmm

Fix the bug in lab_result/kern/mm/vmm.c
main
chyyuu 9 years ago
parent
commit
22715b7f99
18 changed files with 90 additions and 0 deletions
  1. +7
    -0
      labcodes/lab3/kern/mm/swap_fifo.c
  2. +7
    -0
      labcodes/lab4/kern/mm/swap_fifo.c
  3. +7
    -0
      labcodes/lab5/kern/mm/swap_fifo.c
  4. +7
    -0
      labcodes/lab6/kern/mm/swap_fifo.c
  5. +7
    -0
      labcodes/lab7/kern/mm/swap_fifo.c
  6. +7
    -0
      labcodes/lab8/kern/mm/swap_fifo.c
  7. +7
    -0
      labcodes_answer/lab3_result/kern/mm/swap_fifo.c
  8. +1
    -0
      labcodes_answer/lab3_result/kern/mm/vmm.c
  9. +7
    -0
      labcodes_answer/lab4_result/kern/mm/swap_fifo.c
  10. +1
    -0
      labcodes_answer/lab4_result/kern/mm/vmm.c
  11. +7
    -0
      labcodes_answer/lab5_result/kern/mm/swap_fifo.c
  12. +1
    -0
      labcodes_answer/lab5_result/kern/mm/vmm.c
  13. +7
    -0
      labcodes_answer/lab6_result/kern/mm/swap_fifo.c
  14. +1
    -0
      labcodes_answer/lab6_result/kern/mm/vmm.c
  15. +7
    -0
      labcodes_answer/lab7_result/kern/mm/swap_fifo.c
  16. +1
    -0
      labcodes_answer/lab7_result/kern/mm/vmm.c
  17. +7
    -0
      labcodes_answer/lab8_result/kern/mm/swap_fifo.c
  18. +1
    -0
      labcodes_answer/lab8_result/kern/mm/vmm.c

+ 7
- 0
labcodes/lab3/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes/lab4/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes/lab5/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes/lab6/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes/lab7/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes/lab8/kern/mm/swap_fifo.c View File

@ -102,6 +102,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 7
- 0
labcodes_answer/lab3_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab3_result/kern/mm/vmm.c View File

@ -419,6 +419,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
else {
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);

+ 7
- 0
labcodes_answer/lab4_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab4_result/kern/mm/vmm.c View File

@ -420,6 +420,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
else {
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);

+ 7
- 0
labcodes_answer/lab5_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab5_result/kern/mm/vmm.c View File

@ -527,6 +527,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
ret = 0;
failed:

+ 7
- 0
labcodes_answer/lab6_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab6_result/kern/mm/vmm.c View File

@ -527,6 +527,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
ret = 0;
failed:

+ 7
- 0
labcodes_answer/lab7_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab7_result/kern/mm/vmm.c View File

@ -536,6 +536,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
ret = 0;
failed:

+ 7
- 0
labcodes_answer/lab8_result/kern/mm/swap_fifo.c View File

@ -110,6 +110,13 @@ _fifo_check_swap(void) {
cprintf("write Virt Page d in fifo_check_swap\n");
*(unsigned char *)0x4000 = 0x0d;
assert(pgfault_num==9);
cprintf("write Virt Page e in fifo_check_swap\n");
*(unsigned char *)0x5000 = 0x0e;
assert(pgfault_num==10);
cprintf("write Virt Page a in fifo_check_swap\n");
assert(*(unsigned char *)0x1000 == 0x0a);
*(unsigned char *)0x1000 = 0x0a;
assert(pgfault_num==11);
return 0;
}

+ 1
- 0
labcodes_answer/lab8_result/kern/mm/vmm.c View File

@ -536,6 +536,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
}
page_insert(mm->pgdir, page, addr, perm);
swap_map_swappable(mm, addr, page, 1);
page->pra_vaddr = addr;
}
ret = 0;
failed:

Loading…
Cancel
Save