diff options
author | eistar <33970527+eistar@users.noreply.github.com> | 2022-02-01 10:34:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-31 18:34:16 -0800 |
commit | 34a1175291f9531e85afdb89aaa77707f45fc8e4 (patch) | |
tree | e6d41a5ea864fde0e7fae1a1fe9a5a77bacf204e | |
parent | 81e58d0068858978c2415ae115144078434ea31d (diff) | |
download | env-34a1175291f9531e85afdb89aaa77707f45fc8e4.zip env-34a1175291f9531e85afdb89aaa77707f45fc8e4.tar.gz env-34a1175291f9531e85afdb89aaa77707f45fc8e4.tar.bz2 |
Reverse memcpy direction when evicts a page. (#34)
In "evict" function in v/vm.c, when evict a dirty page in user space, memcpy should be from that page, rather than to evicted page.
-rw-r--r-- | v/vm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -120,7 +120,7 @@ static void evict(unsigned long addr) uintptr_t sstatus = set_csr(sstatus, SSTATUS_SUM); if (memcmp((void*)addr, uva2kva(addr), PGSIZE)) { assert(user_llpt[addr/PGSIZE] & PTE_D); - memcpy((void*)addr, uva2kva(addr), PGSIZE); + memcpy(uva2kva(addr), (void*)addr, PGSIZE); } write_csr(sstatus, sstatus); |