mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
some ABI changes
- make the swapper API fully generic, so we don't have to change the application ABI as the swapper requirements evolve - assign the invalid opcode to a fixed number, so it doesn't move between dissimilar versions.
This commit is contained in:
parent
3a7799c9b8
commit
73414ff9d5
1 changed files with 17 additions and 12 deletions
|
|
@ -521,21 +521,26 @@ pub enum SysCall {
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
RegisterSwapper(u32, u32, u32, u32, usize, usize),
|
RegisterSwapper(u32, u32, u32, u32, usize, usize),
|
||||||
|
|
||||||
/// Evict a page.
|
/// Swapper operation.
|
||||||
///
|
///
|
||||||
/// This syscall can only be called by PID 2, the swapper.
|
/// This syscall can only be called by PID 2, the swapper. The form of the
|
||||||
|
/// call is deliberately left flexible, so that the swapper ABI can evolve
|
||||||
|
/// without impacting version compatibility with application ABIs.
|
||||||
///
|
///
|
||||||
/// ## Arguments
|
/// ## Arguments
|
||||||
/// * **pid**: PID of target process
|
/// * Up to 7 `usize` values, whose ABI is determined by the swapper's implementation.
|
||||||
/// * **vaddr**: The virtual address to evict
|
|
||||||
///
|
///
|
||||||
/// ## Returns
|
/// ## Returns
|
||||||
/// No return value
|
/// Returns a Scalar5, whose ABI is determined by the swapper's implementation.
|
||||||
///
|
///
|
||||||
/// ## Errors
|
/// ## Errors
|
||||||
/// * **BadAddress**: The mapping does not exist
|
/// * **BadAddress**: The mapping does not exist
|
||||||
|
/// * **AccessDenied**: Called by a PID that does not belong to the swapper
|
||||||
|
/// * **MappingInUse**: A requested operation could not be performed because the mapping is wired
|
||||||
|
/// * **UnhandledSyscall**: The ABI encoding doesn't map to the current implementation
|
||||||
|
/// * Other errors may be added as the swapper ABI evolves
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
EvictPage(PID, usize),
|
SwapOp(usize, usize, usize, usize, usize, usize, usize),
|
||||||
|
|
||||||
/// This syscall does not exist. It captures all possible
|
/// This syscall does not exist. It captures all possible
|
||||||
/// arguments so detailed analysis can be performed.
|
/// arguments so detailed analysis can be performed.
|
||||||
|
|
@ -544,6 +549,7 @@ pub enum SysCall {
|
||||||
|
|
||||||
// #[derive(FromPrimitive)]
|
// #[derive(FromPrimitive)]
|
||||||
pub enum SysCallNumber {
|
pub enum SysCallNumber {
|
||||||
|
Invalid = 0,
|
||||||
MapMemory = 2,
|
MapMemory = 2,
|
||||||
Yield = 3,
|
Yield = 3,
|
||||||
ReturnToParent = 4,
|
ReturnToParent = 4,
|
||||||
|
|
@ -590,8 +596,7 @@ pub enum SysCallNumber {
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
RegisterSwapper = 43,
|
RegisterSwapper = 43,
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
EvictPage = 44,
|
SwapOp = 44,
|
||||||
Invalid,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SysCallNumber {
|
impl SysCallNumber {
|
||||||
|
|
@ -644,7 +649,7 @@ impl SysCallNumber {
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
43 => RegisterSwapper,
|
43 => RegisterSwapper,
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
44 => EvictPage,
|
44 => SwapOp,
|
||||||
_ => Invalid,
|
_ => Invalid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -891,8 +896,8 @@ impl SysCall {
|
||||||
0,
|
0,
|
||||||
],
|
],
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
SysCall::EvictPage(pid, vaddr) => {
|
SysCall::SwapOp(a1, a2, a3, a4, a5, a6, a7) => {
|
||||||
[SysCallNumber::EvictPage as usize, pid.get() as usize, *vaddr, 0, 0, 0, 0, 0]
|
[SysCallNumber::SwapOp as usize, *a1, *a2, *a3, *a4, *a5, *a6, *a7]
|
||||||
}
|
}
|
||||||
SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7) => {
|
SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7) => {
|
||||||
[SysCallNumber::Invalid as usize, *a1, *a2, *a3, *a4, *a5, *a6, *a7]
|
[SysCallNumber::Invalid as usize, *a1, *a2, *a3, *a4, *a5, *a6, *a7]
|
||||||
|
|
@ -1045,7 +1050,7 @@ impl SysCall {
|
||||||
SysCall::RegisterSwapper(a1 as u32, a2 as u32, a3 as u32, a4 as u32, a5 as usize, a6 as usize)
|
SysCall::RegisterSwapper(a1 as u32, a2 as u32, a3 as u32, a4 as u32, a5 as usize, a6 as usize)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "swap")]
|
#[cfg(feature = "swap")]
|
||||||
SysCallNumber::EvictPage => SysCall::EvictPage(pid_from_usize(a1)?, a2 as _),
|
SysCallNumber::SwapOp => SysCall::SwapOp(a1, a2, a3, a4, a5, a6, a7),
|
||||||
SysCallNumber::Invalid => SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7),
|
SysCallNumber::Invalid => SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue