Added missing functions for pyodide

Since Pyodide is focused on running on desktop, this pull-request lacks
Javascript runtime functions. It also sorted alphabetically some functions
This commit is contained in:
Jesús Leganés-Combarro 'piranna
2019-05-28 09:39:49 +02:00
parent ef4908d3bc
commit b78a8af228
12 changed files with 565 additions and 66 deletions

View File

@ -5,6 +5,15 @@ use crate::env::get_emscripten_data;
use libc::getdtablesize; use libc::getdtablesize;
use wasmer_runtime_core::vm::Ctx; use wasmer_runtime_core::vm::Ctx;
pub fn asm_const_i(_ctx: &mut Ctx, _val: i32) -> i32{
debug!("emscripten::asm_const_i: {}", _val);
0
}
pub fn exit_with_live_runtime(_ctx: &mut Ctx) {
debug!("emscripten::exit_with_live_runtime");
}
pub fn setTempRet0(ctx: &mut Ctx, val: i32) { pub fn setTempRet0(ctx: &mut Ctx, val: i32) {
debug!("emscripten::setTempRet0: {}", val); debug!("emscripten::setTempRet0: {}", val);
get_emscripten_data(ctx).temp_ret_0 = val; get_emscripten_data(ctx).temp_ret_0 = val;
@ -59,10 +68,6 @@ pub fn _dladdr(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_dladdr"); debug!("emscripten::_dladdr");
0 0
} }
pub fn _pthread_attr_init(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_attr_init({})", _a);
0
}
pub fn _pthread_attr_destroy(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_attr_destroy(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_attr_destroy"); debug!("emscripten::_pthread_attr_destroy");
0 0
@ -82,58 +87,24 @@ pub fn _pthread_attr_getstack(
// HEAP32[stacksize >> 2] = TOTAL_STACK; // HEAP32[stacksize >> 2] = TOTAL_STACK;
0 0
} }
pub fn _pthread_attr_init(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_attr_init({})", _a);
0
}
pub fn _pthread_attr_setstacksize(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_attr_setstacksize");
0
}
pub fn _pthread_cleanup_pop(_ctx: &mut Ctx, _a: i32) -> () {
debug!("emscripten::_pthread_cleanup_pop");
}
pub fn _pthread_cleanup_push(_ctx: &mut Ctx, _a: i32, _b: i32) -> () {
debug!("emscripten::_pthread_cleanup_push");
}
pub fn _pthread_cond_destroy(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_cond_destroy(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_cond_destroy"); debug!("emscripten::_pthread_cond_destroy");
0 0
} }
pub fn _pthread_cond_timedwait(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32) -> i32 {
debug!("emscripten::_pthread_cond_timedwait");
0
}
pub fn _pthread_getspecific(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_getspecific");
0
}
pub fn _pthread_getattr_np(_ctx: &mut Ctx, _thread: i32, _attr: i32) -> i32 {
debug!("emscripten::_pthread_getattr_np({}, {})", _thread, _attr);
0
}
pub fn _pthread_setspecific(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_setspecific");
0
}
pub fn _pthread_once(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_once");
0
}
pub fn _pthread_key_create(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_key_create");
0
}
pub fn _pthread_rwlock_destroy(_ctx: &mut Ctx, _rwlock: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_destroy({})", _rwlock);
0
}
pub fn _pthread_rwlock_init(_ctx: &mut Ctx, _rwlock: i32, _attr: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_init({}, {})", _rwlock, _attr);
0
}
pub fn _pthread_rwlock_wrlock(_ctx: &mut Ctx, _rwlock: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_wrlock({})", _rwlock);
0
}
pub fn _pthread_create(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32, _d: i32) -> i32 {
debug!("emscripten::_pthread_create");
0
}
pub fn _pthread_detach(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_detach");
0
}
pub fn _pthread_join(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_join");
0
}
pub fn _pthread_cond_init(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn _pthread_cond_init(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_cond_init"); debug!("emscripten::_pthread_cond_init");
0 0
@ -142,6 +113,10 @@ pub fn _pthread_cond_signal(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_cond_signal"); debug!("emscripten::_pthread_cond_signal");
0 0
} }
pub fn _pthread_cond_timedwait(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32) -> i32 {
debug!("emscripten::_pthread_cond_timedwait");
0
}
pub fn _pthread_cond_wait(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn _pthread_cond_wait(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_cond_wait"); debug!("emscripten::_pthread_cond_wait");
0 0
@ -158,6 +133,37 @@ pub fn _pthread_condattr_setclock(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_condattr_setclock"); debug!("emscripten::_pthread_condattr_setclock");
0 0
} }
pub fn _pthread_create(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32, _d: i32) -> i32 {
debug!("emscripten::_pthread_create");
0
}
pub fn _pthread_detach(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_detach");
0
}
pub fn _pthread_equal(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_equal");
0
}
pub fn _pthread_exit(_ctx: &mut Ctx, _a: i32) -> () {
debug!("emscripten::_pthread_exit");
}
pub fn _pthread_getattr_np(_ctx: &mut Ctx, _thread: i32, _attr: i32) -> i32 {
debug!("emscripten::_pthread_getattr_np({}, {})", _thread, _attr);
0
}
pub fn _pthread_getspecific(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_getspecific");
0
}
pub fn _pthread_join(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_join");
0
}
pub fn _pthread_key_create(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_key_create");
0
}
pub fn _pthread_mutex_destroy(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_mutex_destroy(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_mutex_destroy"); debug!("emscripten::_pthread_mutex_destroy");
0 0
@ -178,6 +184,18 @@ pub fn _pthread_mutexattr_settype(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_mutexattr_settype"); debug!("emscripten::_pthread_mutexattr_settype");
0 0
} }
pub fn _pthread_once(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_once");
0
}
pub fn _pthread_rwlock_destroy(_ctx: &mut Ctx, _rwlock: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_destroy({})", _rwlock);
0
}
pub fn _pthread_rwlock_init(_ctx: &mut Ctx, _rwlock: i32, _attr: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_init({}, {})", _rwlock, _attr);
0
}
pub fn _pthread_rwlock_rdlock(_ctx: &mut Ctx, _a: i32) -> i32 { pub fn _pthread_rwlock_rdlock(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_rdlock"); debug!("emscripten::_pthread_rwlock_rdlock");
0 0
@ -186,10 +204,22 @@ pub fn _pthread_rwlock_unlock(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_unlock"); debug!("emscripten::_pthread_rwlock_unlock");
0 0
} }
pub fn _pthread_rwlock_wrlock(_ctx: &mut Ctx, _rwlock: i32) -> i32 {
debug!("emscripten::_pthread_rwlock_wrlock({})", _rwlock);
0
}
pub fn _pthread_setcancelstate(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 { pub fn _pthread_setcancelstate(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_setcancelstate"); debug!("emscripten::_pthread_setcancelstate");
0 0
} }
pub fn _pthread_setspecific(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_pthread_setspecific");
0
}
pub fn _pthread_sigmask(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32) -> i32 {
debug!("emscripten::_pthread_sigmask");
0
}
pub fn ___gxx_personality_v0( pub fn ___gxx_personality_v0(
_ctx: &mut Ctx, _ctx: &mut Ctx,
_a: i32, _a: i32,
@ -222,6 +252,10 @@ pub fn _gethostbyaddr(_ctx: &mut Ctx, _addr: i32, _addrlen: i32, _atype: i32) ->
debug!("emscripten::gethostbyaddr"); debug!("emscripten::gethostbyaddr");
0 0
} }
pub fn _gethostbyname(_ctx: &mut Ctx, _name: i32) -> i32 {
debug!("emscripten::gethostbyname_r");
0
}
pub fn _gethostbyname_r( pub fn _gethostbyname_r(
_ctx: &mut Ctx, _ctx: &mut Ctx,
_name: i32, _name: i32,

View File

@ -8,6 +8,26 @@ pub fn ___cxa_allocate_exception(ctx: &mut Ctx, size: u32) -> u32 {
env::call_malloc(ctx, size as _) env::call_malloc(ctx, size as _)
} }
pub fn ___cxa_current_primary_exception(_ctx: &mut Ctx) -> u32 {
debug!("emscripten::___cxa_current_primary_exception");
unimplemented!()
}
pub fn ___cxa_decrement_exception_refcount(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_decrement_exception_refcount({})", _a);
unimplemented!()
}
pub fn ___cxa_increment_exception_refcount(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_increment_exception_refcount({})", _a);
unimplemented!()
}
pub fn ___cxa_rethrow_primary_exception(_ctx: &mut Ctx, _a: u32) {
debug!("emscripten::___cxa_rethrow_primary_exception({})", _a);
unimplemented!()
}
/// emscripten: ___cxa_throw /// emscripten: ___cxa_throw
/// TODO: We don't have support for exceptions yet /// TODO: We don't have support for exceptions yet
pub fn ___cxa_throw(ctx: &mut Ctx, _ptr: u32, _ty: u32, _destructor: u32) { pub fn ___cxa_throw(ctx: &mut Ctx, _ptr: u32, _ty: u32, _destructor: u32) {

View File

@ -0,0 +1,6 @@
use wasmer_runtime_core::vm::Ctx;
pub fn addr(_ctx: &mut Ctx, _cp: i32) -> i32 {
debug!("inet::addr({})", _cp);
0
}

View File

@ -33,8 +33,10 @@ mod errno;
mod exception; mod exception;
mod exec; mod exec;
mod exit; mod exit;
mod inet;
mod io; mod io;
mod jmp; mod jmp;
mod libc;
mod linking; mod linking;
mod lock; mod lock;
mod math; mod math;
@ -45,6 +47,7 @@ mod storage;
mod syscalls; mod syscalls;
mod time; mod time;
mod ucontext; mod ucontext;
mod unistd;
mod utils; mod utils;
mod varargs; mod varargs;
@ -507,6 +510,9 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"__memory_base" => Global::new(Value::I32(globals.data.memory_base as i32)), "__memory_base" => Global::new(Value::I32(globals.data.memory_base as i32)),
"tempDoublePtr" => Global::new(Value::I32(globals.data.temp_double_ptr as i32)), "tempDoublePtr" => Global::new(Value::I32(globals.data.temp_double_ptr as i32)),
// inet
"_inet_addr" => func!(crate::inet::addr),
// IO // IO
"printf" => func!(crate::io::printf), "printf" => func!(crate::io::printf),
"putchar" => func!(crate::io::putchar), "putchar" => func!(crate::io::putchar),
@ -557,15 +563,24 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___syscall9" => func!(crate::syscalls::___syscall9), "___syscall9" => func!(crate::syscalls::___syscall9),
"___syscall10" => func!(crate::syscalls::___syscall10), "___syscall10" => func!(crate::syscalls::___syscall10),
"___syscall12" => func!(crate::syscalls::___syscall12), "___syscall12" => func!(crate::syscalls::___syscall12),
"___syscall14" => func!(crate::syscalls::___syscall14),
"___syscall15" => func!(crate::syscalls::___syscall15), "___syscall15" => func!(crate::syscalls::___syscall15),
"___syscall20" => func!(crate::syscalls::___syscall20), "___syscall20" => func!(crate::syscalls::___syscall20),
"___syscall21" => func!(crate::syscalls::___syscall21),
"___syscall25" => func!(crate::syscalls::___syscall25),
"___syscall29" => func!(crate::syscalls::___syscall29),
"___syscall32" => func!(crate::syscalls::___syscall32),
"___syscall33" => func!(crate::syscalls::___syscall33), "___syscall33" => func!(crate::syscalls::___syscall33),
"___syscall34" => func!(crate::syscalls::___syscall34), "___syscall34" => func!(crate::syscalls::___syscall34),
"___syscall36" => func!(crate::syscalls::___syscall36),
"___syscall39" => func!(crate::syscalls::___syscall39), "___syscall39" => func!(crate::syscalls::___syscall39),
"___syscall38" => func!(crate::syscalls::___syscall38), "___syscall38" => func!(crate::syscalls::___syscall38),
"___syscall40" => func!(crate::syscalls::___syscall40), "___syscall40" => func!(crate::syscalls::___syscall40),
"___syscall41" => func!(crate::syscalls::___syscall41), "___syscall41" => func!(crate::syscalls::___syscall41),
"___syscall42" => func!(crate::syscalls::___syscall42), "___syscall42" => func!(crate::syscalls::___syscall42),
"___syscall51" => func!(crate::syscalls::___syscall51),
"___syscall52" => func!(crate::syscalls::___syscall52),
"___syscall53" => func!(crate::syscalls::___syscall53),
"___syscall54" => func!(crate::syscalls::___syscall54), "___syscall54" => func!(crate::syscalls::___syscall54),
"___syscall57" => func!(crate::syscalls::___syscall57), "___syscall57" => func!(crate::syscalls::___syscall57),
"___syscall60" => func!(crate::syscalls::___syscall60), "___syscall60" => func!(crate::syscalls::___syscall60),
@ -578,23 +593,36 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___syscall85" => func!(crate::syscalls::___syscall85), "___syscall85" => func!(crate::syscalls::___syscall85),
"___syscall91" => func!(crate::syscalls::___syscall91), "___syscall91" => func!(crate::syscalls::___syscall91),
"___syscall94" => func!(crate::syscalls::___syscall94), "___syscall94" => func!(crate::syscalls::___syscall94),
"___syscall96" => func!(crate::syscalls::___syscall96),
"___syscall97" => func!(crate::syscalls::___syscall97), "___syscall97" => func!(crate::syscalls::___syscall97),
"___syscall102" => func!(crate::syscalls::___syscall102), "___syscall102" => func!(crate::syscalls::___syscall102),
"___syscall110" => func!(crate::syscalls::___syscall110), "___syscall110" => func!(crate::syscalls::___syscall110),
"___syscall114" => func!(crate::syscalls::___syscall114), "___syscall114" => func!(crate::syscalls::___syscall114),
"___syscall118" => func!(crate::syscalls::___syscall118), "___syscall118" => func!(crate::syscalls::___syscall118),
"___syscall121" => func!(crate::syscalls::___syscall121),
"___syscall122" => func!(crate::syscalls::___syscall122), "___syscall122" => func!(crate::syscalls::___syscall122),
"___syscall125" => func!(crate::syscalls::___syscall125),
"___syscall132" => func!(crate::syscalls::___syscall132),
"___syscall133" => func!(crate::syscalls::___syscall133),
"___syscall140" => func!(crate::syscalls::___syscall140), "___syscall140" => func!(crate::syscalls::___syscall140),
"___syscall142" => func!(crate::syscalls::___syscall142), "___syscall142" => func!(crate::syscalls::___syscall142),
"___syscall144" => func!(crate::syscalls::___syscall144),
"___syscall145" => func!(crate::syscalls::___syscall145), "___syscall145" => func!(crate::syscalls::___syscall145),
"___syscall146" => func!(crate::syscalls::___syscall146), "___syscall146" => func!(crate::syscalls::___syscall146),
"___syscall147" => func!(crate::syscalls::___syscall147),
"___syscall148" => func!(crate::syscalls::___syscall148), "___syscall148" => func!(crate::syscalls::___syscall148),
"___syscall150" => func!(crate::syscalls::___syscall150),
"___syscall151" => func!(crate::syscalls::___syscall151),
"___syscall152" => func!(crate::syscalls::___syscall152),
"___syscall153" => func!(crate::syscalls::___syscall153),
"___syscall163" => func!(crate::syscalls::___syscall163),
"___syscall168" => func!(crate::syscalls::___syscall168), "___syscall168" => func!(crate::syscalls::___syscall168),
"___syscall180" => func!(crate::syscalls::___syscall180), "___syscall180" => func!(crate::syscalls::___syscall180),
"___syscall181" => func!(crate::syscalls::___syscall181), "___syscall181" => func!(crate::syscalls::___syscall181),
"___syscall183" => func!(crate::syscalls::___syscall183), "___syscall183" => func!(crate::syscalls::___syscall183),
"___syscall191" => func!(crate::syscalls::___syscall191), "___syscall191" => func!(crate::syscalls::___syscall191),
"___syscall192" => func!(crate::syscalls::___syscall192), "___syscall192" => func!(crate::syscalls::___syscall192),
"___syscall193" => func!(crate::syscalls::___syscall193),
"___syscall194" => func!(crate::syscalls::___syscall194), "___syscall194" => func!(crate::syscalls::___syscall194),
"___syscall195" => func!(crate::syscalls::___syscall195), "___syscall195" => func!(crate::syscalls::___syscall195),
"___syscall196" => func!(crate::syscalls::___syscall196), "___syscall196" => func!(crate::syscalls::___syscall196),
@ -606,19 +634,38 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___syscall202" => func!(crate::syscalls::___syscall202), "___syscall202" => func!(crate::syscalls::___syscall202),
"___syscall205" => func!(crate::syscalls::___syscall205), "___syscall205" => func!(crate::syscalls::___syscall205),
"___syscall207" => func!(crate::syscalls::___syscall207), "___syscall207" => func!(crate::syscalls::___syscall207),
"___syscall209" => func!(crate::syscalls::___syscall209),
"___syscall211" => func!(crate::syscalls::___syscall211),
"___syscall212" => func!(crate::syscalls::___syscall212), "___syscall212" => func!(crate::syscalls::___syscall212),
"___syscall218" => func!(crate::syscalls::___syscall218),
"___syscall219" => func!(crate::syscalls::___syscall219), "___syscall219" => func!(crate::syscalls::___syscall219),
"___syscall220" => func!(crate::syscalls::___syscall220), "___syscall220" => func!(crate::syscalls::___syscall220),
"___syscall221" => func!(crate::syscalls::___syscall221), "___syscall221" => func!(crate::syscalls::___syscall221),
"___syscall268" => func!(crate::syscalls::___syscall268), "___syscall268" => func!(crate::syscalls::___syscall268),
"___syscall269" => func!(crate::syscalls::___syscall269),
"___syscall272" => func!(crate::syscalls::___syscall272), "___syscall272" => func!(crate::syscalls::___syscall272),
"___syscall295" => func!(crate::syscalls::___syscall295), "___syscall295" => func!(crate::syscalls::___syscall295),
"___syscall296" => func!(crate::syscalls::___syscall296),
"___syscall297" => func!(crate::syscalls::___syscall297),
"___syscall298" => func!(crate::syscalls::___syscall298),
"___syscall300" => func!(crate::syscalls::___syscall300), "___syscall300" => func!(crate::syscalls::___syscall300),
"___syscall301" => func!(crate::syscalls::___syscall301),
"___syscall302" => func!(crate::syscalls::___syscall302),
"___syscall303" => func!(crate::syscalls::___syscall303),
"___syscall304" => func!(crate::syscalls::___syscall304),
"___syscall305" => func!(crate::syscalls::___syscall305),
"___syscall306" => func!(crate::syscalls::___syscall306),
"___syscall307" => func!(crate::syscalls::___syscall307),
"___syscall308" => func!(crate::syscalls::___syscall308),
"___syscall320" => func!(crate::syscalls::___syscall320), "___syscall320" => func!(crate::syscalls::___syscall320),
"___syscall324" => func!(crate::syscalls::___syscall324), "___syscall324" => func!(crate::syscalls::___syscall324),
"___syscall330" => func!(crate::syscalls::___syscall330), "___syscall330" => func!(crate::syscalls::___syscall330),
"___syscall331" => func!(crate::syscalls::___syscall331),
"___syscall333" => func!(crate::syscalls::___syscall333),
"___syscall334" => func!(crate::syscalls::___syscall334), "___syscall334" => func!(crate::syscalls::___syscall334),
"___syscall337" => func!(crate::syscalls::___syscall337),
"___syscall340" => func!(crate::syscalls::___syscall340), "___syscall340" => func!(crate::syscalls::___syscall340),
"___syscall345" => func!(crate::syscalls::___syscall345),
// Process // Process
"abort" => func!(crate::process::em_abort), "abort" => func!(crate::process::em_abort),
@ -647,9 +694,17 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_setitimer" => func!(crate::process::_setitimer), "_setitimer" => func!(crate::process::_setitimer),
"_usleep" => func!(crate::process::_usleep), "_usleep" => func!(crate::process::_usleep),
"_nanosleep" => func!(crate::process::_nanosleep), "_nanosleep" => func!(crate::process::_nanosleep),
"_utime" => func!(crate::process::_utime),
"_utimes" => func!(crate::process::_utimes), "_utimes" => func!(crate::process::_utimes),
"_wait" => func!(crate::process::_wait),
"_wait3" => func!(crate::process::_wait3),
"_wait4" => func!(crate::process::_wait4),
"_waitid" => func!(crate::process::_waitid),
"_waitpid" => func!(crate::process::_waitpid), "_waitpid" => func!(crate::process::_waitpid),
// Emscripten
"_emscripten_asm_const_i" => func!(crate::emscripten_target::asm_const_i),
"_emscripten_exit_with_live_runtime" => func!(crate::emscripten_target::exit_with_live_runtime),
// Signal // Signal
"_sigemptyset" => func!(crate::signal::_sigemptyset), "_sigemptyset" => func!(crate::signal::_sigemptyset),
@ -673,6 +728,10 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
// Exception // Exception
"___cxa_allocate_exception" => func!(crate::exception::___cxa_allocate_exception), "___cxa_allocate_exception" => func!(crate::exception::___cxa_allocate_exception),
"___cxa_current_primary_exception" => func!(crate::exception::___cxa_current_primary_exception),
"___cxa_decrement_exception_refcount" => func!(crate::exception::___cxa_decrement_exception_refcount),
"___cxa_increment_exception_refcount" => func!(crate::exception::___cxa_increment_exception_refcount),
"___cxa_rethrow_primary_exception" => func!(crate::exception::___cxa_rethrow_primary_exception),
"___cxa_throw" => func!(crate::exception::___cxa_throw), "___cxa_throw" => func!(crate::exception::___cxa_throw),
"___cxa_begin_catch" => func!(crate::exception::___cxa_begin_catch), "___cxa_begin_catch" => func!(crate::exception::___cxa_begin_catch),
"___cxa_end_catch" => func!(crate::exception::___cxa_end_catch), "___cxa_end_catch" => func!(crate::exception::___cxa_end_catch),
@ -681,7 +740,9 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
// Time // Time
"_gettimeofday" => func!(crate::time::_gettimeofday), "_gettimeofday" => func!(crate::time::_gettimeofday),
"_clock_getres" => func!(crate::time::_clock_getres),
"_clock_gettime" => func!(crate::time::_clock_gettime), "_clock_gettime" => func!(crate::time::_clock_gettime),
"_clock_settime" => func!(crate::time::_clock_settime),
"___clock_gettime" => func!(crate::time::_clock_gettime), "___clock_gettime" => func!(crate::time::_clock_gettime),
"_clock" => func!(crate::time::_clock), "_clock" => func!(crate::time::_clock),
"_difftime" => func!(crate::time::_difftime), "_difftime" => func!(crate::time::_difftime),
@ -699,6 +760,8 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
// Math // Math
"f64-rem" => func!(crate::math::f64_rem), "f64-rem" => func!(crate::math::f64_rem),
"_llvm_copysign_f32" => func!(crate::math::_llvm_copysign_f32),
"_llvm_copysign_f64" => func!(crate::math::_llvm_copysign_f64),
"_llvm_log10_f64" => func!(crate::math::_llvm_log10_f64), "_llvm_log10_f64" => func!(crate::math::_llvm_log10_f64),
"_llvm_log2_f64" => func!(crate::math::_llvm_log2_f64), "_llvm_log2_f64" => func!(crate::math::_llvm_log2_f64),
"_llvm_log10_f32" => func!(crate::math::_llvm_log10_f32), "_llvm_log10_f32" => func!(crate::math::_llvm_log10_f32),
@ -720,6 +783,22 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
// Bitwise // Bitwise
"_llvm_bswap_i64" => func!(crate::bitwise::_llvm_bswap_i64), "_llvm_bswap_i64" => func!(crate::bitwise::_llvm_bswap_i64),
// libc
"_execv" => func!(crate::libc::execv),
"_endpwent" => func!(crate::libc::endpwent),
"_fexecve" => func!(crate::libc::fexecve),
"_fpathconf" => func!(crate::libc::fpathconf),
"_getitimer" => func!(crate::libc::getitimer),
"_getpwent" => func!(crate::libc::getpwent),
"_killpg" => func!(crate::libc::killpg),
"_pathconf" => func!(crate::libc::pathconf),
"_siginterrupt" => func!(crate::signal::_siginterrupt),
"_setpwent" => func!(crate::libc::setpwent),
"_sigismember" => func!(crate::libc::sigismember),
"_sigpending" => func!(crate::libc::sigpending),
"___libc_current_sigrtmax" => func!(crate::libc::current_sigrtmax),
"___libc_current_sigrtmin" => func!(crate::libc::current_sigrtmin),
// Linking // Linking
"_dlclose" => func!(crate::linking::_dlclose), "_dlclose" => func!(crate::linking::_dlclose),
"_dlerror" => func!(crate::linking::_dlerror), "_dlerror" => func!(crate::linking::_dlerror),
@ -751,40 +830,47 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"___cxa_free_exception" => func!(crate::emscripten_target::___cxa_free_exception), "___cxa_free_exception" => func!(crate::emscripten_target::___cxa_free_exception),
"___resumeException" => func!(crate::emscripten_target::___resumeException), "___resumeException" => func!(crate::emscripten_target::___resumeException),
"_dladdr" => func!(crate::emscripten_target::_dladdr), "_dladdr" => func!(crate::emscripten_target::_dladdr),
"_pthread_create" => func!(crate::emscripten_target::_pthread_create),
"_pthread_detach" => func!(crate::emscripten_target::_pthread_detach),
"_pthread_join" => func!(crate::emscripten_target::_pthread_join),
"_pthread_attr_init" => func!(crate::emscripten_target::_pthread_attr_init),
"_pthread_attr_destroy" => func!(crate::emscripten_target::_pthread_attr_destroy), "_pthread_attr_destroy" => func!(crate::emscripten_target::_pthread_attr_destroy),
"_pthread_attr_getstack" => func!(crate::emscripten_target::_pthread_attr_getstack), "_pthread_attr_getstack" => func!(crate::emscripten_target::_pthread_attr_getstack),
"_pthread_cond_init" => func!(crate::emscripten_target::_pthread_cond_init), "_pthread_attr_init" => func!(crate::emscripten_target::_pthread_attr_init),
"_pthread_attr_setstacksize" => func!(crate::emscripten_target::_pthread_attr_setstacksize),
"_pthread_cleanup_pop" => func!(crate::emscripten_target::_pthread_cleanup_pop),
"_pthread_cleanup_push" => func!(crate::emscripten_target::_pthread_cleanup_push),
"_pthread_cond_destroy" => func!(crate::emscripten_target::_pthread_cond_destroy), "_pthread_cond_destroy" => func!(crate::emscripten_target::_pthread_cond_destroy),
"_pthread_cond_init" => func!(crate::emscripten_target::_pthread_cond_init),
"_pthread_cond_signal" => func!(crate::emscripten_target::_pthread_cond_signal), "_pthread_cond_signal" => func!(crate::emscripten_target::_pthread_cond_signal),
"_pthread_cond_timedwait" => func!(crate::emscripten_target::_pthread_cond_timedwait), "_pthread_cond_timedwait" => func!(crate::emscripten_target::_pthread_cond_timedwait),
"_pthread_cond_wait" => func!(crate::emscripten_target::_pthread_cond_wait), "_pthread_cond_wait" => func!(crate::emscripten_target::_pthread_cond_wait),
"_pthread_condattr_destroy" => func!(crate::emscripten_target::_pthread_condattr_destroy), "_pthread_condattr_destroy" => func!(crate::emscripten_target::_pthread_condattr_destroy),
"_pthread_condattr_init" => func!(crate::emscripten_target::_pthread_condattr_init), "_pthread_condattr_init" => func!(crate::emscripten_target::_pthread_condattr_init),
"_pthread_condattr_setclock" => func!(crate::emscripten_target::_pthread_condattr_setclock), "_pthread_condattr_setclock" => func!(crate::emscripten_target::_pthread_condattr_setclock),
"_pthread_create" => func!(crate::emscripten_target::_pthread_create),
"_pthread_detach" => func!(crate::emscripten_target::_pthread_detach),
"_pthread_equal" => func!(crate::emscripten_target::_pthread_equal),
"_pthread_exit" => func!(crate::emscripten_target::_pthread_exit),
"_pthread_getattr_np" => func!(crate::emscripten_target::_pthread_getattr_np),
"_pthread_getspecific" => func!(crate::emscripten_target::_pthread_getspecific),
"_pthread_join" => func!(crate::emscripten_target::_pthread_join),
"_pthread_key_create" => func!(crate::emscripten_target::_pthread_key_create),
"_pthread_mutex_destroy" => func!(crate::emscripten_target::_pthread_mutex_destroy), "_pthread_mutex_destroy" => func!(crate::emscripten_target::_pthread_mutex_destroy),
"_pthread_mutex_init" => func!(crate::emscripten_target::_pthread_mutex_init), "_pthread_mutex_init" => func!(crate::emscripten_target::_pthread_mutex_init),
"_pthread_mutexattr_destroy" => func!(crate::emscripten_target::_pthread_mutexattr_destroy), "_pthread_mutexattr_destroy" => func!(crate::emscripten_target::_pthread_mutexattr_destroy),
"_pthread_mutexattr_init" => func!(crate::emscripten_target::_pthread_mutexattr_init), "_pthread_mutexattr_init" => func!(crate::emscripten_target::_pthread_mutexattr_init),
"_pthread_mutexattr_settype" => func!(crate::emscripten_target::_pthread_mutexattr_settype), "_pthread_mutexattr_settype" => func!(crate::emscripten_target::_pthread_mutexattr_settype),
"_pthread_rwlock_rdlock" => func!(crate::emscripten_target::_pthread_rwlock_rdlock),
"_pthread_rwlock_unlock" => func!(crate::emscripten_target::_pthread_rwlock_unlock),
"_pthread_setcancelstate" => func!(crate::emscripten_target::_pthread_setcancelstate),
"_pthread_getspecific" => func!(crate::emscripten_target::_pthread_getspecific),
"_pthread_getattr_np" => func!(crate::emscripten_target::_pthread_getattr_np),
"_pthread_setspecific" => func!(crate::emscripten_target::_pthread_setspecific),
"_pthread_once" => func!(crate::emscripten_target::_pthread_once), "_pthread_once" => func!(crate::emscripten_target::_pthread_once),
"_pthread_key_create" => func!(crate::emscripten_target::_pthread_key_create),
"_pthread_rwlock_destroy" => func!(crate::emscripten_target::_pthread_rwlock_destroy), "_pthread_rwlock_destroy" => func!(crate::emscripten_target::_pthread_rwlock_destroy),
"_pthread_rwlock_init" => func!(crate::emscripten_target::_pthread_rwlock_init), "_pthread_rwlock_init" => func!(crate::emscripten_target::_pthread_rwlock_init),
"_pthread_rwlock_rdlock" => func!(crate::emscripten_target::_pthread_rwlock_rdlock),
"_pthread_rwlock_unlock" => func!(crate::emscripten_target::_pthread_rwlock_unlock),
"_pthread_rwlock_wrlock" => func!(crate::emscripten_target::_pthread_rwlock_wrlock), "_pthread_rwlock_wrlock" => func!(crate::emscripten_target::_pthread_rwlock_wrlock),
"_pthread_setcancelstate" => func!(crate::emscripten_target::_pthread_setcancelstate),
"_pthread_setspecific" => func!(crate::emscripten_target::_pthread_setspecific),
"_pthread_sigmask" => func!(crate::emscripten_target::_pthread_sigmask),
"___gxx_personality_v0" => func!(crate::emscripten_target::___gxx_personality_v0), "___gxx_personality_v0" => func!(crate::emscripten_target::___gxx_personality_v0),
"_gai_strerror" => func!(crate::emscripten_target::_gai_strerror), "_gai_strerror" => func!(crate::emscripten_target::_gai_strerror),
"_getdtablesize" => func!(crate::emscripten_target::_getdtablesize), "_getdtablesize" => func!(crate::emscripten_target::_getdtablesize),
"_gethostbyaddr" => func!(crate::emscripten_target::_gethostbyaddr), "_gethostbyaddr" => func!(crate::emscripten_target::_gethostbyaddr),
"_gethostbyname" => func!(crate::emscripten_target::_gethostbyname),
"_gethostbyname_r" => func!(crate::emscripten_target::_gethostbyname_r), "_gethostbyname_r" => func!(crate::emscripten_target::_gethostbyname_r),
"_getloadavg" => func!(crate::emscripten_target::_getloadavg), "_getloadavg" => func!(crate::emscripten_target::_getloadavg),
"_getnameinfo" => func!(crate::emscripten_target::_getnameinfo), "_getnameinfo" => func!(crate::emscripten_target::_getnameinfo),
@ -833,6 +919,9 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"_makecontext" => func!(crate::ucontext::_makecontext), "_makecontext" => func!(crate::ucontext::_makecontext),
"_setcontext" => func!(crate::ucontext::_setcontext), "_setcontext" => func!(crate::ucontext::_setcontext),
"_swapcontext" => func!(crate::ucontext::_swapcontext), "_swapcontext" => func!(crate::ucontext::_swapcontext),
// unistd
"_confstr" => func!(crate::unistd::confstr),
}; };
for null_func_name in globals.null_func_names.iter() { for null_func_name in globals.null_func_names.iter() {

View File

@ -0,0 +1,72 @@
extern crate libc;
extern crate wasmer_runtime_core;
use std::convert::TryInto;
use wasmer_runtime_core::vm::Ctx;
pub fn current_sigrtmax(_ctx: &mut Ctx) -> i32 {
debug!("emscripten::current_sigrtmax");
0
}
pub fn current_sigrtmin(_ctx: &mut Ctx) -> i32 {
debug!("emscripten::current_sigrtmin");
0
}
pub fn endpwent(_ctx: &mut Ctx) {
debug!("emscripten::endpwent");
}
pub fn execv(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::execv");
0
}
pub fn fexecve(_ctx: &mut Ctx, _a: i32, _b: i32, _c: i32) -> i32 {
debug!("emscripten::fexecve");
0
}
pub fn fpathconf(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::fpathconf");
0
}
pub fn getitimer(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::getitimer");
0
}
pub fn getpwent(_ctx: &mut Ctx) -> i32 {
debug!("emscripten::getpwent");
0
}
pub fn killpg(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::killpg");
0
}
pub fn pathconf(ctx: &mut Ctx, path_ptr: i32, name: i32) -> i32 {
let path = emscripten_memory_pointer!(ctx.memory(0), path_ptr) as *const i8;
unsafe {
libc::pathconf(path, name).try_into().unwrap()
}
}
pub fn setpwent(_ctx: &mut Ctx) {
debug!("emscripten::setpwent");
}
pub fn sigismember(_ctx: &mut Ctx, _a: i32, _b: i32) -> i32 {
debug!("emscripten::sigismember");
0
}
pub fn sigpending(_ctx: &mut Ctx, _a: i32) -> i32 {
debug!("emscripten::sigpending");
0
}

View File

@ -0,0 +1,9 @@
extern crate libm;
extern crate wasmer_runtime_core;
use libm::fma;
use wasmer_runtime_core::vm::Ctx;
pub fn fma_f64(_ctx: &mut Ctx, x: f64, y: f64, z: f64) -> f64 {
fma(x, y, z)
}

View File

@ -1,5 +1,15 @@
use std::{f32, f64};
use wasmer_runtime_core::vm::Ctx; use wasmer_runtime_core::vm::Ctx;
pub fn _llvm_copysign_f32(_ctx: &mut Ctx, x: f64, y: f64) -> f64 {
// f32::copysign(x, y)
f64::copysign(x, y)
}
pub fn _llvm_copysign_f64(_ctx: &mut Ctx, x: f64, y: f64) -> f64 {
f64::copysign(x, y)
}
/// emscripten: _llvm_log10_f64 /// emscripten: _llvm_log10_f64
pub fn _llvm_log10_f64(_ctx: &mut Ctx, value: f64) -> f64 { pub fn _llvm_log10_f64(_ctx: &mut Ctx, value: f64) -> f64 {
debug!("emscripten::_llvm_log10_f64"); debug!("emscripten::_llvm_log10_f64");

View File

@ -131,11 +131,36 @@ pub fn _nanosleep(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn _utime(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_utime");
-1
}
pub fn _utimes(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn _utimes(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_utimes"); debug!("emscripten::_utimes");
-1 -1
} }
pub fn _wait(_ctx: &mut Ctx, _one: i32) -> i32 {
debug!("emscripten::_wait");
-1
}
pub fn _wait3(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_wait3");
-1
}
pub fn _wait4(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
debug!("emscripten::_wait4");
-1
}
pub fn _waitid(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
debug!("emscripten::_waitid");
-1
}
pub fn _waitpid(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 { pub fn _waitpid(_ctx: &mut Ctx, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_waitpid"); debug!("emscripten::_waitpid");
-1 -1

View File

@ -16,6 +16,11 @@ pub fn _sigaction(_ctx: &mut Ctx, _signum: u32, _act: u32, _oldact: u32) -> i32
0 0
} }
pub fn _siginterrupt(_ctx: &mut Ctx, _a: u32, _b: u32) -> i32 {
debug!("emscripten::_siginterrupt {}, {}", _a, _b);
0
}
#[allow(clippy::cast_ptr_alignment)] #[allow(clippy::cast_ptr_alignment)]
pub fn _sigaddset(ctx: &mut Ctx, set: u32, signum: u32) -> i32 { pub fn _sigaddset(ctx: &mut Ctx, set: u32, signum: u32) -> i32 {
debug!("emscripten::_sigaddset {}, {}", set, signum); debug!("emscripten::_sigaddset {}, {}", set, signum);

View File

@ -108,6 +108,11 @@ pub fn ___syscall10(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall14(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall14");
-1
}
pub fn ___syscall15(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall15(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall15"); debug!("emscripten::___syscall15");
-1 -1
@ -119,6 +124,36 @@ pub fn ___syscall20(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
unsafe { getpid() } unsafe { getpid() }
} }
pub fn ___syscall21(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall21");
-1
}
pub fn ___syscall25(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall25");
-1
}
pub fn ___syscall29(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall29");
-1
}
pub fn ___syscall32(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall32");
-1
}
pub fn ___syscall33(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall33");
-1
}
pub fn ___syscall36(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall36");
-1
}
// rename // rename
pub fn ___syscall38(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> i32 { pub fn ___syscall38(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall38 (rename)"); debug!("emscripten::___syscall38 (rename)");
@ -167,6 +202,21 @@ pub fn ___syscall42(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int
result result
} }
pub fn ___syscall51(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall51");
-1
}
pub fn ___syscall52(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall52");
-1
}
pub fn ___syscall53(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall53");
-1
}
pub fn ___syscall60(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall60(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall60"); debug!("emscripten::___syscall60");
-1 -1
@ -231,6 +281,11 @@ pub fn ___syscall91(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
0 0
} }
pub fn ___syscall96(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall96");
-1
}
pub fn ___syscall97(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall97(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall97"); debug!("emscripten::___syscall97");
-1 -1
@ -241,6 +296,61 @@ pub fn ___syscall110(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall121(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall121");
-1
}
pub fn ___syscall125(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall125");
-1
}
pub fn ___syscall132(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall132");
-1
}
pub fn ___syscall133(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall133");
-1
}
pub fn ___syscall144(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall144");
-1
}
pub fn ___syscall147(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall147");
-1
}
pub fn ___syscall150(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall150");
-1
}
pub fn ___syscall151(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall151");
-1
}
pub fn ___syscall152(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall152");
-1
}
pub fn ___syscall153(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall153");
-1
}
pub fn ___syscall163(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall163");
-1
}
// getcwd // getcwd
pub fn ___syscall183(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> i32 { pub fn ___syscall183(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall183"); debug!("emscripten::___syscall183");
@ -409,8 +519,8 @@ pub fn ___syscall191(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall199(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall193(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall199 - stub"); debug!("emscripten::___syscall193");
-1 -1
} }
@ -457,6 +567,26 @@ pub fn ___syscall197(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
0 0
} }
pub fn ___syscall199(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall199 - stub");
-1
}
pub fn ___syscall209(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall209");
-1
}
pub fn ___syscall211(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall211");
-1
}
pub fn ___syscall218(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall218");
-1
}
pub fn ___syscall220(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall220(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall220"); debug!("emscripten::___syscall220");
-1 -1
@ -485,6 +615,11 @@ pub fn ___syscall268(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall269(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall269");
-1
}
pub fn ___syscall272(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall272(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall272"); debug!("emscripten::___syscall272");
-1 -1
@ -495,22 +630,92 @@ pub fn ___syscall295(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
-1 -1
} }
pub fn ___syscall296(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall296");
-1
}
pub fn ___syscall297(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall297");
-1
}
pub fn ___syscall298(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall298");
-1
}
pub fn ___syscall300(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall300(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall300"); debug!("emscripten::___syscall300");
-1 -1
} }
pub fn ___syscall301(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall301");
-1
}
pub fn ___syscall302(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall302");
-1
}
pub fn ___syscall303(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall303");
-1
}
pub fn ___syscall304(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall304");
-1
}
pub fn ___syscall305(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall305");
-1
}
pub fn ___syscall306(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall306");
-1
}
pub fn ___syscall307(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall307");
-1
}
pub fn ___syscall308(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall308");
-1
}
// utimensat // utimensat
pub fn ___syscall320(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_int { pub fn ___syscall320(_ctx: &mut Ctx, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall320 (utimensat), {}", _which); debug!("emscripten::___syscall320 (utimensat), {}", _which);
0 0
} }
pub fn ___syscall331(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall331");
-1
}
pub fn ___syscall333(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall333");
-1
}
pub fn ___syscall334(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 { pub fn ___syscall334(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall334"); debug!("emscripten::___syscall334");
-1 -1
} }
pub fn ___syscall337(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall337");
-1
}
// prlimit64 // prlimit64
pub fn ___syscall340(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int { pub fn ___syscall340(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall340 (prlimit64), {}", _which); debug!("emscripten::___syscall340 (prlimit64), {}", _which);
@ -533,3 +738,8 @@ pub fn ___syscall340(ctx: &mut Ctx, _which: c_int, mut varargs: VarArgs) -> c_in
0 0
} }
pub fn ___syscall345(_ctx: &mut Ctx, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall345");
-1
}

View File

@ -1,5 +1,6 @@
use super::utils::{copy_cstr_into_wasm, write_to_buf}; use super::utils::{copy_cstr_into_wasm, write_to_buf};
use libc::{c_char, c_int}; use libc::{c_char, c_int};
// use libc::{c_char, c_int, clock_getres, clock_settime};
use std::mem; use std::mem;
use std::time::SystemTime; use std::time::SystemTime;
@ -69,6 +70,12 @@ pub fn _gettimeofday(ctx: &mut Ctx, tp: c_int, tz: c_int) -> c_int {
0 0
} }
pub fn _clock_getres(_ctx: &mut Ctx, _clk_id: i32, _tp: i32) -> i32 {
debug!("emscripten::_clock_getres");
// clock_getres(clk_id, tp)
0
}
/// emscripten: _clock_gettime /// emscripten: _clock_gettime
#[allow(clippy::cast_ptr_alignment)] #[allow(clippy::cast_ptr_alignment)]
pub fn _clock_gettime(ctx: &mut Ctx, clk_id: clockid_t, tp: c_int) -> c_int { pub fn _clock_gettime(ctx: &mut Ctx, clk_id: clockid_t, tp: c_int) -> c_int {
@ -103,6 +110,12 @@ pub fn _clock_gettime(ctx: &mut Ctx, clk_id: clockid_t, tp: c_int) -> c_int {
0 0
} }
pub fn _clock_settime(_ctx: &mut Ctx, _clk_id: i32, _tp: i32) -> i32 {
debug!("emscripten::_clock_settime");
// clock_settime(clk_id, tp)
0
}
/// emscripten: ___clock_gettime /// emscripten: ___clock_gettime
pub fn ___clock_gettime(ctx: &mut Ctx, clk_id: clockid_t, tp: c_int) -> c_int { pub fn ___clock_gettime(ctx: &mut Ctx, clk_id: clockid_t, tp: c_int) -> c_int {
debug!("emscripten::___clock_gettime {} {}", clk_id, tp); debug!("emscripten::___clock_gettime {} {}", clk_id, tp);

View File

@ -0,0 +1,6 @@
use wasmer_runtime_core::vm::Ctx;
pub fn confstr(_ctx: &mut Ctx, _name: i32, _bufPointer: i32, _len: i32) -> i32 {
debug!("unistd::confstr({}, {}, {})", _name, _bufPointer, _len);
0
}