add arguments to register syscall for handler and state

This commit is contained in:
bunnie 2024-03-08 04:12:42 +08:00
parent 6806403da8
commit 9008452a36

View file

@ -1009,20 +1009,16 @@ pub fn handle_inner(pid: PID, tid: TID, in_irq: bool, call: SysCall) -> SysCallR
}
}
#[cfg(feature = "swap")]
SysCall::RegisterSwapper(s0, s1, s2, s3) => {
Swap::with_mut(|swap| swap.register_handler(s0, s1, s2, s3))
SysCall::RegisterSwapper(s0, s1, s2, s3, handler, state) => {
Swap::with_mut(|swap| swap.register_handler(s0, s1, s2, s3, handler, state))
}
#[cfg(feature = "swap")]
SysCall::EvictPage(target_pid, vaddr) => {
if pid.get() != 2 {
if pid.get() != xous_kernel::SWAPPER_PID {
klog!("Illegal caller"); // only PID 2 can call this
return Err(xous_kernel::Error::AccessDenied);
}
let phys_addr = crate::arch::mem::virt_to_phys_pid(target_pid, vaddr as usize);
match phys_addr {
Ok(pa) => Swap::with_mut(|swap| swap.evict_page(target_pid, vaddr, pa)),
Err(_) => Err(xous_kernel::Error::BadAddress),
}
Swap::with_mut(|swap| swap.evict_page(target_pid, vaddr))
}
/* https://github.com/betrusted-io/xous-core/issues/90