fixes :P
This commit is contained in:
parent
ae7719371f
commit
6459eb61e2
|
@ -12,7 +12,7 @@ pub const KILL: usize = 0;
|
||||||
struct HostFunctions;
|
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.into() {
|
||||||
SysCall::KILL => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
SysCall::KILL => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
|
||||||
_ => return false,
|
_ => return false,
|
||||||
};
|
};
|
||||||
|
@ -26,7 +26,7 @@ impl Externals for HostFunctions {
|
||||||
index: usize,
|
index: usize,
|
||||||
args: RuntimeArgs,
|
args: RuntimeArgs,
|
||||||
) -> Result<Option<RuntimeValue>, Trap> {
|
) -> Result<Option<RuntimeValue>, Trap> {
|
||||||
match index {
|
match index.into() {
|
||||||
SysCall::KILL => {
|
SysCall::KILL => {
|
||||||
let a: u32 = args.nth_checked(0)?;
|
let a: u32 = args.nth_checked(0)?;
|
||||||
let b: u32 = args.nth_checked(1)?;
|
let b: u32 = args.nth_checked(1)?;
|
||||||
|
@ -41,7 +41,7 @@ impl Externals for HostFunctions {
|
||||||
impl ModuleImportResolver for HostFunctions {
|
impl ModuleImportResolver for HostFunctions {
|
||||||
fn resolve_func(&self, field_name: &str, signature: &Signature) -> Result<FuncRef, Error> {
|
fn resolve_func(&self, field_name: &str, signature: &Signature) -> Result<FuncRef, Error> {
|
||||||
let index = match field_name {
|
let index = match field_name {
|
||||||
"add" => SysCall::KILL,
|
"add" => SysCall::KILL as usize,
|
||||||
_ => {
|
_ => {
|
||||||
return Err(Error::Instantiation(format!(
|
return Err(Error::Instantiation(format!(
|
||||||
"Export {} not found",
|
"Export {} not found",
|
||||||
|
|
|
@ -33,7 +33,7 @@ pub enum SysCall {
|
||||||
|
|
||||||
// Security Syscalls
|
// Security Syscalls
|
||||||
ENCRYPT = 50,
|
ENCRYPT = 50,
|
||||||
EMPTY = usize::MAX,
|
EMPTY = u32::MAX as usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<usize> for SysCall {
|
impl From<usize> for SysCall {
|
||||||
|
|
Reference in a new issue