diff --git a/ableos/src/wasm_jumploader/host_functions.rs b/ableos/src/wasm_jumploader/host_functions.rs
index a4f4d44..2e6157b 100644
--- a/ableos/src/wasm_jumploader/host_functions.rs
+++ b/ableos/src/wasm_jumploader/host_functions.rs
@@ -4,135 +4,165 @@ use wasmi::{
Signature, Trap, ValueType,
};
-const ADD_FUNC_INDEX: usize = 0;
-const GET_TIME_INDEX: usize = 2;
-const GET_RANDOM_INDEX: usize = 3;
-const GET_INPUT_INDEX: usize = 4;
-const PRINT_CHAR: usize = 6;
-const SEND_SIGNAL_INDEX: usize = 1;
-
-pub struct HostExternals;
-impl HostExternals {
- fn check_signature(&self, index: usize, signature: &Signature) -> bool {
- let (params, ret_ty): (&[_], _) = match index {
- ADD_FUNC_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
- SEND_SIGNAL_INDEX => (&[ValueType::I32, ValueType::I32], Some(ValueType::I32)),
- GET_TIME_INDEX => (&[], Some(ValueType::I32)),
- GET_RANDOM_INDEX => (&[], Some(ValueType::I32)),
- GET_INPUT_INDEX => (&[], Some(ValueType::I32)),
- PRINT_CHAR => (&[ValueType::I32], None),
- _ => return false,
- };
-
- if params.len() != signature.params().len() || ret_ty != signature.return_type() {
- false
- } else {
- params
- .iter()
- .zip(signature.params())
- .find(|(ty, param)| ty != param)
- .is_none()
- }
- }
+macro_rules! wasmi_type {
+ (bool) => {
+ ValueType::I32
+ };
+ (u8) => {
+ ValueType::I32
+ };
+ (u16) => {
+ ValueType::I32
+ };
+ (u32) => {
+ ValueType::I32
+ };
+ (u64) => {
+ ValueType::I64
+ };
+ (i8) => {
+ ValueType::I32
+ };
+ (i16) => {
+ ValueType::I32
+ };
+ (i32) => {
+ ValueType::I32
+ };
+ (i64) => {
+ ValueType::I64
+ };
+ (f32) => {
+ ValueType::F32
+ };
+ (f64) => {
+ ValueType::F64
+ };
}
-impl Externals for HostExternals {
- fn invoke_index(
- &mut self,
- index: usize,
- args: RuntimeArgs,
- ) -> Result