:P
This commit is contained in:
parent
9f1b708ccf
commit
e83cdc6ed9
|
@ -13,7 +13,7 @@ struct HostFunctions;
|
||||||
impl HostFunctions {
|
impl HostFunctions {
|
||||||
fn check_signature(&self, index: usize, signature: &Signature) -> bool {
|
fn check_signature(&self, index: usize, signature: &Signature) -> bool {
|
||||||
let (params, ret_ty): (&[ValueType], Option<ValueType>) = match index {
|
let (params, ret_ty): (&[ValueType], Option<ValueType>) = match index {
|
||||||
*SysCall::KILL => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
SysCall::KILL => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
signature.params() == params && signature.return_type() == ret_ty
|
signature.params() == params && signature.return_type() == ret_ty
|
||||||
|
|
|
@ -34,3 +34,33 @@ pub enum SysCall {
|
||||||
// Security Syscalls
|
// Security Syscalls
|
||||||
ENCRYPT = 50,
|
ENCRYPT = 50,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<usize> for SysCall {
|
||||||
|
fn from(n: usize) -> Self {
|
||||||
|
match n {
|
||||||
|
0 => Self::KILL,
|
||||||
|
1 => Self::CONSOLE_RESET,
|
||||||
|
2 => Self::CONSOLE_IN,
|
||||||
|
3 => Self::CONSOLE_OUT,
|
||||||
|
4 => Self::CONSOLE_GET_TITLE,
|
||||||
|
5 => Self::CONSOLE_SET_TITLE,
|
||||||
|
10 => Self::GET_PRIORITY,
|
||||||
|
11 => Self::SET_PRIORITY,
|
||||||
|
12 => Self::GET_HOSTNAME,
|
||||||
|
13 => Self::SET_HOSTNAME,
|
||||||
|
20 => Self::GET_CONFIG,
|
||||||
|
21 => Self::SET_CONFIG,
|
||||||
|
22 => Self::MAKE_DIRECTORY,
|
||||||
|
23 => Self::DELETE_DIRECTORY,
|
||||||
|
24 => Self::RENAME_DIRECTORY,
|
||||||
|
25 => Self::SET_DIRECTORY_ACCESS,
|
||||||
|
26 => Self::MAKE_FILE,
|
||||||
|
27 => Self::DELETE_FILE,
|
||||||
|
28 => Self::RENAME_FILE,
|
||||||
|
29 => Self::SET_FILE_ACCESS,
|
||||||
|
30 => Self::FILE_READ,
|
||||||
|
31 => Self::FILE_WRITE,
|
||||||
|
50 => Self::ENCRYPT,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Reference in a new issue