Merge pull request #10 from Archstacker/fix_vmm
Fix the bug in lab_result/kern/mm/vmm.c
This commit is contained in:
commit
22715b7f99
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +102,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +419,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
|
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,6 +420,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
|
cprintf("no swap_init_ok but ptep is %x, failed\n",*ptep);
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,6 +527,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
failed:
|
failed:
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,6 +527,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
failed:
|
failed:
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,6 +536,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
failed:
|
failed:
|
||||||
|
@ -110,6 +110,13 @@ _fifo_check_swap(void) {
|
|||||||
cprintf("write Virt Page d in fifo_check_swap\n");
|
cprintf("write Virt Page d in fifo_check_swap\n");
|
||||||
*(unsigned char *)0x4000 = 0x0d;
|
*(unsigned char *)0x4000 = 0x0d;
|
||||||
assert(pgfault_num==9);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,6 +536,7 @@ do_pgfault(struct mm_struct *mm, uint32_t error_code, uintptr_t addr) {
|
|||||||
}
|
}
|
||||||
page_insert(mm->pgdir, page, addr, perm);
|
page_insert(mm->pgdir, page, addr, perm);
|
||||||
swap_map_swappable(mm, addr, page, 1);
|
swap_map_swappable(mm, addr, page, 1);
|
||||||
|
page->pra_vaddr = addr;
|
||||||
}
|
}
|
||||||
ret = 0;
|
ret = 0;
|
||||||
failed:
|
failed:
|
||||||
|
Loading…
Reference in New Issue
Block a user