mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
swapper abi fixes
- evict error checking - reject requests to swap kernel or swapper - add target amount of pages to evict on oom handler
This commit is contained in:
parent
b138f63f93
commit
0847f99433
1 changed files with 11 additions and 3 deletions
|
|
@ -1021,10 +1021,18 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
|
||||||
#[cfg(feature = "debug-swap")]
|
#[cfg(feature = "debug-swap")]
|
||||||
println!("Swap ABI via syscall: {:?}", SwapAbi::from(op));
|
println!("Swap ABI via syscall: {:?}", SwapAbi::from(op));
|
||||||
match SwapAbi::from(op) {
|
match SwapAbi::from(op) {
|
||||||
SwapAbi::Evict => Swap::with_mut(|swap| swap.evict_page(a1, a2)),
|
SwapAbi::Evict => {
|
||||||
SwapAbi::GetFreeMem => Swap::with(|swap| swap.get_free_mem()),
|
let pid = a1;
|
||||||
|
if pid != 0 && pid != 1 && pid != 2 {
|
||||||
|
Swap::with_mut(|swap| swap.evict_page(pid, a2))
|
||||||
|
} else {
|
||||||
|
// don't allow kernel or swapper to be swapped out
|
||||||
|
Err(xous_kernel::Error::InvalidPID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SwapAbi::GetFreePages => Swap::with(|swap| swap.get_free_mem()),
|
||||||
SwapAbi::FetchAllocs => Swap::with_mut(|swap| swap.fetch_allocs()),
|
SwapAbi::FetchAllocs => Swap::with_mut(|swap| swap.fetch_allocs()),
|
||||||
SwapAbi::SetOomThresh => Swap::with_mut(|swap| swap.set_oom_thresh(a1)),
|
SwapAbi::SetOomThresh => Swap::with_mut(|swap| swap.set_oom_thresh(a1, a2)),
|
||||||
SwapAbi::Invalid => {
|
SwapAbi::Invalid => {
|
||||||
println!(
|
println!(
|
||||||
"Invalid SwapOp: {:x} {:x} {:x} {:x} {:x} {:x} {:x}",
|
"Invalid SwapOp: {:x} {:x} {:x} {:x} {:x} {:x} {:x}",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue