mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
make swapper syscall API re-entrant (map/retrieve page)
we no longer diverge at the swapper call, so execution flows intuitively here. this feels so much nicer.
This commit is contained in:
parent
62eb233db1
commit
8ce2ac566a
1 changed files with 13 additions and 10 deletions
|
|
@ -10,8 +10,6 @@ use xous_kernel::{MemoryFlags, PID};
|
|||
|
||||
use crate::arch::process::InitialProcess;
|
||||
use crate::mem::MemoryManager;
|
||||
#[cfg(feature = "swap")]
|
||||
use crate::swap::Swap;
|
||||
|
||||
// pub const DEFAULT_STACK_TOP: usize = 0x8000_0000;
|
||||
pub const DEFAULT_HEAP_BASE: usize = 0x2000_0000;
|
||||
|
|
@ -944,16 +942,21 @@ pub fn ensure_page_exists_inner(address: usize) -> Result<usize, xous_kernel::Er
|
|||
#[cfg(feature = "swap")]
|
||||
if flags & MMUFlags::P.bits() != 0 {
|
||||
// page is swapped; fill page, map and return
|
||||
Swap::with_mut(|s| {
|
||||
s.retrieve_page(
|
||||
crate::arch::process::current_pid(),
|
||||
crate::arch::process::current_tid(),
|
||||
crate::swap::Swap::with_mut(|s| {
|
||||
s.swap_reentrant_syscall(xous_kernel::SysCall::SwapOp(
|
||||
crate::swap::SwapAbi::RetrievePage as usize,
|
||||
virt,
|
||||
new_page,
|
||||
)
|
||||
})
|
||||
|
||||
// the execution flow diverges from here: it returns via the interrupt context handler. -> !
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
))
|
||||
});
|
||||
*entry =
|
||||
(ppn1 << 20) | (ppn0 << 10) | ((flags & !MMUFlags::P.bits()) | crate::arch::mem::FLG_VALID);
|
||||
flush_mmu();
|
||||
return Ok(new_page);
|
||||
} else {
|
||||
// page is reserved: simply zero it out
|
||||
// Map the page to our process
|
||||
|
|
|
|||
Loading…
Reference in a new issue