mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
xous: add AdjustProcessLimit syscall
This syscal will be used to adjust various process limits. Currently it only contains the ability to adjust the heap size and maximum. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
ad22618c8d
commit
f20e809d8c
3 changed files with 54 additions and 0 deletions
|
|
@ -75,6 +75,9 @@ pub use memoryflags::*;
|
|||
pub mod messages;
|
||||
pub use messages::*;
|
||||
|
||||
pub mod limits;
|
||||
pub use limits::*;
|
||||
|
||||
use crate::arch::ProcessStartup;
|
||||
|
||||
/// Server ID
|
||||
|
|
@ -194,6 +197,7 @@ pub enum Error {
|
|||
UseBeforeInit = 24,
|
||||
DoubleFree = 25,
|
||||
DebugInProgress = 26,
|
||||
InvalidLimit = 27,
|
||||
}
|
||||
|
||||
impl Error {
|
||||
|
|
@ -226,6 +230,7 @@ impl Error {
|
|||
24 => UseBeforeInit,
|
||||
25 => DoubleFree,
|
||||
26 => DebugInProgress,
|
||||
27 => InvalidLimit,
|
||||
_ => UnknownError,
|
||||
}
|
||||
}
|
||||
|
|
@ -258,6 +263,7 @@ impl Error {
|
|||
UseBeforeInit => 24,
|
||||
DoubleFree => 25,
|
||||
DebugInProgress => 26,
|
||||
InvalidLimit => 27,
|
||||
UnknownError => usize::MAX,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5
xous-rs/src/definitions/limits.rs
Normal file
5
xous-rs/src/definitions/limits.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#[repr(usize)]
|
||||
pub enum Limits {
|
||||
HeapMaximum = 1,
|
||||
HeapSize = 2,
|
||||
}
|
||||
|
|
@ -427,6 +427,36 @@ pub enum SysCall {
|
|||
usize, /* stack pointer */
|
||||
),
|
||||
|
||||
/// Adjust one of the limits within this process. Note that you must pass
|
||||
/// the current limit value in order to set the new limit. The current limit
|
||||
/// value is always returned, so this function may need to be called twice --
|
||||
/// once in order to get the current limit, and again to set the new limit.
|
||||
///
|
||||
/// ## Arguments
|
||||
///
|
||||
/// * **Index**: The item to adjust. Currently the following limits
|
||||
/// are supported:
|
||||
/// 1: Maximum heap size
|
||||
/// 2: Current heap size
|
||||
/// * **Current Limit**: Pass the current limit value here. The current
|
||||
/// limit must match in order for the new limit to take
|
||||
/// effect. This is used to avoid a race condition if two
|
||||
/// threads try to set the same limit.
|
||||
/// * **Proposed Limit**: The new value that you would like to use.
|
||||
///
|
||||
/// ## Returns
|
||||
///
|
||||
/// Returns a Scalar2 containing `(Index, Limit)`.
|
||||
///
|
||||
/// ## Errors
|
||||
///
|
||||
/// * **InvalidLimit**: The specified index was not valid
|
||||
AdjustProcessLimit(
|
||||
usize, /* process limit index */
|
||||
usize, /* expected current limit */
|
||||
usize, /* proposed new limit */
|
||||
),
|
||||
|
||||
/// This syscall does not exist. It captures all possible
|
||||
/// arguments so detailed analysis can be performed.
|
||||
Invalid(usize, usize, usize, usize, usize, usize, usize),
|
||||
|
|
@ -470,6 +500,7 @@ pub enum SysCallNumber {
|
|||
Disconnect = 35,
|
||||
JoinThread = 36,
|
||||
SetExceptionHandler = 37,
|
||||
AdjustProcessLimit = 38,
|
||||
Invalid,
|
||||
}
|
||||
|
||||
|
|
@ -513,6 +544,7 @@ impl SysCallNumber {
|
|||
35 => Disconnect,
|
||||
36 => JoinThread,
|
||||
37 => SetExceptionHandler,
|
||||
38 => AdjustProcessLimit,
|
||||
_ => Invalid,
|
||||
}
|
||||
}
|
||||
|
|
@ -867,6 +899,16 @@ impl SysCall {
|
|||
0,
|
||||
0,
|
||||
],
|
||||
SysCall::AdjustProcessLimit(index, current, new) => [
|
||||
SysCallNumber::AdjustProcessLimit as usize,
|
||||
*index,
|
||||
*current,
|
||||
*new,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
],
|
||||
SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7) => [
|
||||
SysCallNumber::Invalid as usize,
|
||||
*a1,
|
||||
|
|
@ -1030,6 +1072,7 @@ impl SysCall {
|
|||
SysCallNumber::Disconnect => SysCall::Disconnect(a1 as _),
|
||||
SysCallNumber::JoinThread => SysCall::JoinThread(a1 as _),
|
||||
SysCallNumber::SetExceptionHandler => SysCall::SetExceptionHandler(a1 as _, a2 as _),
|
||||
SysCallNumber::AdjustProcessLimit => SysCall::AdjustProcessLimit(a1, a2, a3),
|
||||
SysCallNumber::Invalid => SysCall::Invalid(a1, a2, a3, a4, a5, a6, a7),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue