mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
expand flags scope and fix swap test
This commit is contained in:
parent
3bd6b8b645
commit
5f425ebc56
1 changed files with 3 additions and 3 deletions
|
|
@ -898,7 +898,7 @@ pub fn ensure_page_exists_inner(address: usize) -> Result<usize, xous_kernel::Er
|
||||||
// })?;
|
// })?;
|
||||||
let current_entry = unsafe { entry.read_volatile() };
|
let current_entry = unsafe { entry.read_volatile() };
|
||||||
|
|
||||||
let flags = current_entry & 0x1ff;
|
let flags = current_entry & 0x3ff;
|
||||||
|
|
||||||
#[cfg(not(feature = "swap"))]
|
#[cfg(not(feature = "swap"))]
|
||||||
if flags & MMUFlags::VALID.bits() != 0 {
|
if flags & MMUFlags::VALID.bits() != 0 {
|
||||||
|
|
@ -924,13 +924,13 @@ pub fn ensure_page_exists_inner(address: usize) -> Result<usize, xous_kernel::Er
|
||||||
let ppn0 = (new_page >> 12) & ((1 << 10) - 1);
|
let ppn0 = (new_page >> 12) & ((1 << 10) - 1);
|
||||||
unsafe {
|
unsafe {
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
if flags & MMUFlags::P.bits() == 1 {
|
if flags & MMUFlags::P.bits() != 0 {
|
||||||
// page is swapped; fill page, map and return
|
// page is swapped; fill page, map and return
|
||||||
Swap::with_mut(|s| s.retrieve_page(crate::arch::process::current_pid(), virt, new_page))
|
Swap::with_mut(|s| s.retrieve_page(crate::arch::process::current_pid(), virt, new_page))
|
||||||
|
|
||||||
// the execution flow diverges from here: it returns via the interrupt context handler. -> !
|
// the execution flow diverges from here: it returns via the interrupt context handler. -> !
|
||||||
} else {
|
} else {
|
||||||
// page is reserved: simple zero it out
|
// page is reserved: simply zero it out
|
||||||
// Map the page to our process
|
// Map the page to our process
|
||||||
*entry =
|
*entry =
|
||||||
(ppn1 << 20) | (ppn0 << 10) | (flags | FLG_VALID /* valid */ | FLG_D /* D */ | FLG_A/* A */);
|
(ppn1 << 20) | (ppn0 << 10) | (flags | FLG_VALID /* valid */ | FLG_D /* D */ | FLG_A/* A */);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue