From a1cffed9cdf22b67fcb2172043cec82cf3400fbc Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 7 Mar 2024 22:22:51 +0800 Subject: [PATCH] un-use the `P` bit in the page table prep for re-allocating it to swap --- kernel/src/arch/riscv/mem.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/src/arch/riscv/mem.rs b/kernel/src/arch/riscv/mem.rs index 84caa9979..2c893b74c 100644 --- a/kernel/src/arch/riscv/mem.rs +++ b/kernel/src/arch/riscv/mem.rs @@ -52,7 +52,7 @@ bitflags! { const A = 0b00_0100_0000; const D = 0b00_1000_0000; const S = 0b01_0000_0000; // Shared page - const P = 0b10_0000_0000; // Previously writable + const P = 0b10_0000_0000; // swaP } } @@ -821,11 +821,8 @@ pub fn return_page_inner( panic!("page wasn't shared in destination space"); } - // Clear the `SHARED` and `PREVIOUSLY-WRITABLE` bits, and set the `VALID` bit. - unsafe { - dest_entry - .write_volatile(dest_entry_value & !(MMUFlags::S | MMUFlags::P).bits() | MMUFlags::VALID.bits()) - }; + // Clear the `SHARED` bit, and set the `VALID` bit. + unsafe { dest_entry.write_volatile(dest_entry_value & !(MMUFlags::S).bits() | MMUFlags::VALID.bits()) }; unsafe { flush_mmu() }; // Swap back to our previous address space