mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'swap-image-loader' of github.com:betrusted-io/xous-core into swap-image-loader
This commit is contained in:
commit
e61fe6c318
3 changed files with 19 additions and 5 deletions
|
|
@ -823,8 +823,18 @@ pub fn return_page_inner(
|
||||||
panic!("page wasn't shared in destination space");
|
panic!("page wasn't shared in destination space");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "swap")]
|
||||||
// Clear the `SHARED` bit, and set the `VALID` bit.
|
// Clear the `SHARED` bit, and set the `VALID` bit.
|
||||||
unsafe { dest_entry.write_volatile(dest_entry_value & !(MMUFlags::S).bits() | MMUFlags::VALID.bits()) };
|
unsafe {
|
||||||
|
dest_entry.write_volatile(dest_entry_value & !(MMUFlags::S).bits() | MMUFlags::VALID.bits())
|
||||||
|
};
|
||||||
|
#[cfg(not(feature = "swap"))]
|
||||||
|
// 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())
|
||||||
|
};
|
||||||
|
|
||||||
unsafe { flush_mmu() };
|
unsafe { flush_mmu() };
|
||||||
|
|
||||||
// Swap back to our previous address space
|
// Swap back to our previous address space
|
||||||
|
|
@ -928,9 +938,14 @@ pub fn ensure_page_exists_inner(address: usize) -> Result<usize, xous_kernel::Er
|
||||||
zeropage(virt as *mut u32);
|
zeropage(virt as *mut u32);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Zero-out the page
|
|
||||||
#[cfg(not(feature = "swap"))]
|
#[cfg(not(feature = "swap"))]
|
||||||
zeropage(virt as *mut u32);
|
{
|
||||||
|
*entry =
|
||||||
|
(ppn1 << 20) | (ppn0 << 10) | (flags | FLG_VALID /* valid */ | FLG_D /* D */ | FLG_A/* A */);
|
||||||
|
flush_mmu();
|
||||||
|
// Zero-out the page
|
||||||
|
zeropage(virt as *mut u32);
|
||||||
|
}
|
||||||
|
|
||||||
// Move the page into userspace
|
// Move the page into userspace
|
||||||
*entry = (ppn1 << 20)
|
*entry = (ppn1 << 20)
|
||||||
|
|
|
||||||
|
|
@ -732,7 +732,6 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
SysCall::UnmapMemory(range) => {
|
SysCall::UnmapMemory(range) => {
|
||||||
println!("UnmapMemory: {:x?}", range);
|
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
// this call may diverge if it generates an advisory to the swapper
|
// this call may diverge if it generates an advisory to the swapper
|
||||||
let result = crate::swap::Swap::with_mut(|s| s.unmap(range));
|
let result = crate::swap::Swap::with_mut(|s| s.unmap(range));
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,4 @@ simulation-only = []
|
||||||
board-bringup = []
|
board-bringup = []
|
||||||
#default = ["debug-print"]
|
#default = ["debug-print"]
|
||||||
resume = [] # suspend/resume pathway code
|
resume = [] # suspend/resume pathway code
|
||||||
default = ["debug-print", "board-bringup"]
|
default = []
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue