allow specifying path of wasm executable
This commit is contained in:
parent
7492cef2fc
commit
d5a4e19231
|
@ -210,7 +210,8 @@ fn engine_construction() -> Engine {
|
||||||
engine.register_fn("peek", peek_memory);
|
engine.register_fn("peek", peek_memory);
|
||||||
engine.register_fn("poke", poke_memory);
|
engine.register_fn("poke", poke_memory);
|
||||||
engine.register_fn("sloop", sloop);
|
engine.register_fn("sloop", sloop);
|
||||||
engine.register_fn("wasm", interp);
|
engine.register_fn("wasm", |s: &str| interp(s.as_bytes()));
|
||||||
|
engine.register_fn("wasm", || interp(b"/home/able/bins/aos_test.wasm"));
|
||||||
engine.register_fn("log_dump", log_dump);
|
engine.register_fn("log_dump", log_dump);
|
||||||
|
|
||||||
engine
|
engine
|
||||||
|
|
|
@ -167,8 +167,8 @@ impl Externals for HostExternals {
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_INPUT_INDEX => {
|
GET_INPUT_INDEX => {
|
||||||
let input = None;
|
let mut input = None;
|
||||||
x86_64::instructions::interrupts::without_interrupts(|| KEYBUFF.lock().pop());
|
input = x86_64::instructions::interrupts::without_interrupts(|| KEYBUFF.lock().pop());
|
||||||
if let Some(chr) = input {
|
if let Some(chr) = input {
|
||||||
trace!("SYSCALL: input: {}", chr);
|
trace!("SYSCALL: input: {}", chr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@ use crate::{filesystem::FILE_SYSTEM, wasm_jumploader::host_functions::HostExtern
|
||||||
use genfs::{Fs, OpenOptions};
|
use genfs::{Fs, OpenOptions};
|
||||||
use wasmi::{ImportsBuilder, ModuleInstance};
|
use wasmi::{ImportsBuilder, ModuleInstance};
|
||||||
|
|
||||||
pub fn interp() {
|
pub fn interp(file: &[u8]) {
|
||||||
trace!("Interpreting...");
|
trace!("Interpreting...");
|
||||||
let fs = &*FILE_SYSTEM.lock();
|
let fs = &*FILE_SYSTEM.lock();
|
||||||
trace!("Got filesystem");
|
trace!("Got filesystem");
|
||||||
let file = fs
|
let file = fs
|
||||||
.open(
|
.open(
|
||||||
b"/home/able/bins/aos_test.wasm",
|
file,
|
||||||
OpenOptions::new().read(true),
|
OpenOptions::new().read(true),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Reference in a new issue