Merge branch 'master' into feature/emscripten-refactor

This commit is contained in:
Syrus 2018-12-17 22:24:44 -08:00
commit bb298f1890
14 changed files with 94 additions and 109 deletions

View File

@ -7,12 +7,6 @@ jobs:
steps: steps:
- checkout - checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache: - restore_cache:
keys: keys:
- v4-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} - v4-test-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
@ -34,12 +28,6 @@ jobs:
steps: steps:
- checkout - checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache: - restore_cache:
keys: keys:
- v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }} - v4-cargo-cache-linux-{{ arch }}-{{ checksum "Cargo.lock" }}
@ -82,12 +70,6 @@ jobs:
steps: steps:
- checkout - checkout
- run:
name: Pull submodules
command: |
# git pull --recurse-submodules
git submodule sync --recursive
git submodule update --recursive --init
- restore_cache: - restore_cache:
keys: keys:
- v4-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }} - v4-cargo-cache-darwin-{{ arch }}-{{ checksum "Cargo.lock" }}

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "cranelift"]
path = cranelift
url = https://github.com/wasmerio/cranelift.git
fetchrecursesubmodules = true

View File

@ -31,8 +31,8 @@ wasmer run examples/nginx/nginx.wasm -- -p examples/nginx -c nginx.conf
To build this project you will need Rust and Cargo. To build this project you will need Rust and Cargo.
```sh ```sh
# checkout code and associated submodules # checkout code
git clone --recursive https://github.com/wasmerio/wasmer.git git clone https://github.com/wasmerio/wasmer.git
cd wasmer cd wasmer
# install tools # install tools

@ -1 +0,0 @@
Subproject commit cb62a1ead2c5346ccb0f1224ecae5939ac064f87

View File

@ -1,7 +1,7 @@
// use std::collections::HashMap; // use std::collections::HashMap;
pub extern "C" fn ___seterrno(value: i32) -> i32 { pub extern "C" fn ___seterrno(value: i32) -> i32 {
debug!("emscripten::___seterrno"); debug!("emscripten::___seterrno {}", value);
// TODO: Incomplete impl // TODO: Incomplete impl
eprintln!("failed to set errno!"); eprintln!("failed to set errno!");
value value

View File

@ -7,7 +7,7 @@ pub use libc::putchar;
/// printf /// printf
pub extern "C" fn printf(memory_offset: i32, extra: i32, instance: &Instance) -> i32 { pub extern "C" fn printf(memory_offset: i32, extra: i32, instance: &Instance) -> i32 {
debug!("emscripten::printf"); debug!("emscripten::printf {}, {}", memory_offset, extra);
unsafe { unsafe {
let addr = instance.memory_offset_addr(0, memory_offset as _) as _; let addr = instance.memory_offset_addr(0, memory_offset as _) as _;
_printf(addr, extra) _printf(addr, extra)

View File

@ -2,11 +2,11 @@ use crate::webassembly::Instance;
use libc::c_int; use libc::c_int;
// NOTE: Not implemented by Emscripten // NOTE: Not implemented by Emscripten
pub extern "C" fn ___lock(_which: c_int, _varargs: c_int, _instance: &mut Instance) { pub extern "C" fn ___lock(which: c_int, varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___lock"); debug!("emscripten::___lock {}, {}", which, varargs);
} }
// NOTE: Not implemented by Emscripten // NOTE: Not implemented by Emscripten
pub extern "C" fn ___unlock(_which: c_int, _varargs: c_int, _instance: &mut Instance) { pub extern "C" fn ___unlock(which: c_int, varargs: c_int, _instance: &mut Instance) {
debug!("emscripten::___unlock"); debug!("emscripten::___unlock {}, {}", which, varargs);
} }

View File

@ -9,7 +9,10 @@ pub extern "C" fn _emscripten_memcpy_big(
len: u32, len: u32,
instance: &mut Instance, instance: &mut Instance,
) -> u32 { ) -> u32 {
debug!("emscripten::_emscripten_memcpy_big"); debug!(
"emscripten::_emscripten_memcpy_big {}, {}, {}",
dest, src, len
);
let dest_addr = instance.memory_offset_addr(0, dest as usize) as *mut c_void; let dest_addr = instance.memory_offset_addr(0, dest as usize) as *mut c_void;
let src_addr = instance.memory_offset_addr(0, src as usize) as *mut c_void; let src_addr = instance.memory_offset_addr(0, src as usize) as *mut c_void;
unsafe { unsafe {

View File

@ -355,6 +355,11 @@ pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> {
"nullFunc_iiiiii", "nullFunc_iiiiii",
ImportValue::Func(nullfunc::nullfunc_iiiiii as _), ImportValue::Func(nullfunc::nullfunc_iiiiii as _),
); );
import_object.set(
"env",
"nullFunc_v",
ImportValue::Func(nullfunc::nullfunc_v as _),
);
import_object.set( import_object.set(
"env", "env",
"nullFunc_vi", "nullFunc_vi",

View File

@ -1,47 +1,52 @@
use super::process::abort_with_message; use super::process::abort_with_message;
use crate::webassembly::Instance; use crate::webassembly::Instance;
pub extern "C" fn nullfunc_ii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_ii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_ii"); debug!("emscripten::nullfunc_ii {}", x);
abort_with_message("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'ii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_iii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_iii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iii"); debug!("emscripten::nullfunc_iii {}", x);
abort_with_message("Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'iii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_iiii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_iiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiii"); debug!("emscripten::nullfunc_iiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'iiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_iiiii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_iiiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiii"); debug!("emscripten::nullfunc_iiiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'iiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_iiiiii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_iiiiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_iiiiii"); debug!("emscripten::nullfunc_iiiiii {}", x);
abort_with_message("Invalid function pointer called with signature 'iiiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'iiiiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_vi(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_v(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vi"); debug!("emscripten::nullfunc_v {}", x);
abort_with_message("Invalid function pointer called with signature 'v'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
}
pub extern "C" fn nullfunc_vi(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vi {}", x);
abort_with_message("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'vi'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_vii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_vii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_vii"); debug!("emscripten::nullfunc_vii {}", x);
abort_with_message("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'vii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_viii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_viii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viii"); debug!("emscripten::nullfunc_viii {}", x);
abort_with_message("Invalid function pointer called with signature 'viii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'viii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }
pub extern "C" fn nullfunc_viiii(_x: u32, _instance: &Instance) { pub extern "C" fn nullfunc_viiii(x: u32, _instance: &Instance) {
debug!("emscripten::nullfunc_viiii"); debug!("emscripten::nullfunc_viiii {}", x);
abort_with_message("Invalid function pointer called with signature 'viiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)"); abort_with_message("Invalid function pointer called with signature 'viiii'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this)");
} }

View File

@ -25,12 +25,12 @@ pub extern "C" fn _fork(_instance: &mut Instance) -> pid_t {
} }
pub extern "C" fn _exit(status: c_int, _instance: &mut Instance) -> ! { pub extern "C" fn _exit(status: c_int, _instance: &mut Instance) -> ! {
debug!("emscripten::_exit"); debug!("emscripten::_exit {}", status);
unsafe { exit(status) } unsafe { exit(status) }
} }
pub extern "C" fn em_abort(message: u32, instance: &mut Instance) { pub extern "C" fn em_abort(message: u32, instance: &mut Instance) {
debug!("emscripten::em_abort"); debug!("emscripten::em_abort {}", message);
let message_addr = instance.memory_offset_addr(0, message as usize) as *mut c_char; let message_addr = instance.memory_offset_addr(0, message as usize) as *mut c_char;
unsafe { unsafe {
let message = CStr::from_ptr(message_addr) let message = CStr::from_ptr(message_addr)

View File

@ -10,18 +10,13 @@ pub extern "C" fn _sigemptyset(set: u32, instance: &mut Instance) -> i32 {
0 0
} }
pub extern "C" fn _sigaction( pub extern "C" fn _sigaction(signum: u32, act: u32, oldact: u32, _instance: &mut Instance) -> i32 {
_signum: u32, debug!("emscripten::_sigaction {}, {}, {}", signum, act, oldact);
_act: u32,
_oldact: u32,
_instance: &mut Instance,
) -> i32 {
debug!("emscripten::_sigaction");
0 0
} }
pub extern "C" fn _sigaddset(set: u32, signum: u32, instance: &mut Instance) -> i32 { pub extern "C" fn _sigaddset(set: u32, signum: u32, instance: &mut Instance) -> i32 {
debug!("emscripten::_sigaddset"); debug!("emscripten::_sigaddset {}, {}", set, signum);
let set_addr = instance.memory_offset_addr(0, set as _) as *mut u32; let set_addr = instance.memory_offset_addr(0, set as _) as *mut u32;
unsafe { unsafe {
*set_addr |= 1 << (signum - 1); *set_addr |= 1 << (signum - 1);

View File

@ -76,8 +76,8 @@ use libc::SO_NOSIGPIPE;
const SO_NOSIGPIPE: c_int = 0; const SO_NOSIGPIPE: c_int = 0;
/// exit /// exit
pub extern "C" fn ___syscall1(_which: c_int, mut varargs: VarArgs, instance: &mut Instance) { pub extern "C" fn ___syscall1(which: c_int, mut varargs: VarArgs, instance: &mut Instance) {
debug!("emscripten::___syscall1 (exit)"); debug!("emscripten::___syscall1 (exit) {}", which);
let status: i32 = varargs.get(instance); let status: i32 = varargs.get(instance);
unsafe { unsafe {
exit(status); exit(status);
@ -86,11 +86,11 @@ pub extern "C" fn ___syscall1(_which: c_int, mut varargs: VarArgs, instance: &mu
/// read /// read
pub extern "C" fn ___syscall3( pub extern "C" fn ___syscall3(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> ssize_t { ) -> ssize_t {
debug!("emscripten::___syscall3 (read)"); debug!("emscripten::___syscall3 (read) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
let count: usize = varargs.get(instance); let count: usize = varargs.get(instance);
@ -103,11 +103,11 @@ pub extern "C" fn ___syscall3(
/// write /// write
pub extern "C" fn ___syscall4( pub extern "C" fn ___syscall4(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall4 (write)"); debug!("emscripten::___syscall4 (write) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
let count: u32 = varargs.get(instance); let count: u32 = varargs.get(instance);
@ -118,11 +118,11 @@ pub extern "C" fn ___syscall4(
/// open /// open
pub extern "C" fn ___syscall5( pub extern "C" fn ___syscall5(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall5 (open)"); debug!("emscripten::___syscall5 (open) {}", which);
let pathname: u32 = varargs.get(instance); let pathname: u32 = varargs.get(instance);
let flags: i32 = varargs.get(instance); let flags: i32 = varargs.get(instance);
let mode: u32 = varargs.get(instance); let mode: u32 = varargs.get(instance);
@ -138,11 +138,11 @@ pub extern "C" fn ___syscall5(
/// close /// close
pub extern "C" fn ___syscall6( pub extern "C" fn ___syscall6(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall6 (close)"); debug!("emscripten::___syscall6 (close) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
debug!("fd: {}", fd); debug!("fd: {}", fd);
unsafe { close(fd) } unsafe { close(fd) }
@ -150,11 +150,11 @@ pub extern "C" fn ___syscall6(
// chdir // chdir
pub extern "C" fn ___syscall12( pub extern "C" fn ___syscall12(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall12 (chdir)"); debug!("emscripten::___syscall12 (chdir) {}", which);
let path_addr: i32 = varargs.get(instance); let path_addr: i32 = varargs.get(instance);
unsafe { unsafe {
let path_ptr = instance.memory_offset_addr(0, path_addr as usize) as *const i8; let path_ptr = instance.memory_offset_addr(0, path_addr as usize) as *const i8;
@ -173,11 +173,11 @@ pub extern "C" fn ___syscall20() -> pid_t {
// mkdir // mkdir
pub extern "C" fn ___syscall39( pub extern "C" fn ___syscall39(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall39 (mkdir)"); debug!("emscripten::___syscall39 (mkdir) {}", which);
let pathname: u32 = varargs.get(instance); let pathname: u32 = varargs.get(instance);
let mode: u32 = varargs.get(instance); let mode: u32 = varargs.get(instance);
let pathname_addr = instance.memory_offset_addr(0, pathname as usize) as *const i8; let pathname_addr = instance.memory_offset_addr(0, pathname as usize) as *const i8;
@ -194,11 +194,11 @@ pub extern "C" fn ___syscall64() -> pid_t {
/// ioctl /// ioctl
pub extern "C" fn ___syscall54( pub extern "C" fn ___syscall54(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall54 (ioctl)"); debug!("emscripten::___syscall54 (ioctl) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let request: u32 = varargs.get(instance); let request: u32 = varargs.get(instance);
debug!("fd: {}, op: {}", fd, request); debug!("fd: {}, op: {}", fd, request);
@ -240,11 +240,11 @@ pub extern "C" fn ___syscall54(
// socketcall // socketcall
pub extern "C" fn ___syscall102( pub extern "C" fn ___syscall102(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall102 (socketcall)"); debug!("emscripten::___syscall102 (socketcall) {}", which);
let call: u32 = varargs.get(instance); let call: u32 = varargs.get(instance);
let mut socket_varargs: VarArgs = varargs.get(instance); let mut socket_varargs: VarArgs = varargs.get(instance);
@ -518,11 +518,11 @@ pub extern "C" fn ___syscall102(
/// uname /// uname
// NOTE: Wondering if we should return custom utsname, like Emscripten. // NOTE: Wondering if we should return custom utsname, like Emscripten.
pub extern "C" fn ___syscall122( pub extern "C" fn ___syscall122(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall122 (uname)"); debug!("emscripten::___syscall122 (uname) {}", which);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
debug!("=> buf: {}", buf); debug!("=> buf: {}", buf);
let buf_addr = instance.memory_offset_addr(0, buf as usize) as *mut utsname; let buf_addr = instance.memory_offset_addr(0, buf as usize) as *mut utsname;
@ -531,11 +531,11 @@ pub extern "C" fn ___syscall122(
// mmap2 // mmap2
pub extern "C" fn ___syscall192( pub extern "C" fn ___syscall192(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall192 (mmap2)"); debug!("emscripten::___syscall192 (mmap2) {}", which);
let addr: i32 = varargs.get(instance); let addr: i32 = varargs.get(instance);
let len: u32 = varargs.get(instance); let len: u32 = varargs.get(instance);
let prot: i32 = varargs.get(instance); let prot: i32 = varargs.get(instance);
@ -566,11 +566,11 @@ pub extern "C" fn ___syscall192(
/// lseek /// lseek
pub extern "C" fn ___syscall140( pub extern "C" fn ___syscall140(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> off_t { ) -> off_t {
debug!("emscripten::___syscall140 (lseek)"); debug!("emscripten::___syscall140 (lseek) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let offset: i64 = varargs.get(instance); let offset: i64 = varargs.get(instance);
let whence: i32 = varargs.get(instance); let whence: i32 = varargs.get(instance);
@ -580,11 +580,11 @@ pub extern "C" fn ___syscall140(
/// readv /// readv
pub extern "C" fn ___syscall145( pub extern "C" fn ___syscall145(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> ssize_t { ) -> ssize_t {
debug!("emscripten::___syscall145 (readv)"); debug!("emscripten::___syscall145 (readv) {}", which);
// let fd: i32 = varargs.get(instance); // let fd: i32 = varargs.get(instance);
// let iov: u32 = varargs.get(instance); // let iov: u32 = varargs.get(instance);
// let iovcnt: i32 = varargs.get(instance); // let iovcnt: i32 = varargs.get(instance);
@ -625,11 +625,11 @@ pub extern "C" fn ___syscall145(
// writev // writev
pub extern "C" fn ___syscall146( pub extern "C" fn ___syscall146(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> ssize_t { ) -> ssize_t {
debug!("emscripten::___syscall146 (writev)"); debug!("emscripten::___syscall146 (writev) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let iov: i32 = varargs.get(instance); let iov: i32 = varargs.get(instance);
let iovcnt: i32 = varargs.get(instance); let iovcnt: i32 = varargs.get(instance);
@ -663,11 +663,11 @@ pub extern "C" fn ___syscall146(
// pread // pread
pub extern "C" fn ___syscall180( pub extern "C" fn ___syscall180(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall180 (pread)"); debug!("emscripten::___syscall180 (pread) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
let count: u32 = varargs.get(instance); let count: u32 = varargs.get(instance);
@ -684,11 +684,11 @@ pub extern "C" fn ___syscall180(
// pwrite // pwrite
pub extern "C" fn ___syscall181( pub extern "C" fn ___syscall181(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall181 (pwrite)"); debug!("emscripten::___syscall181 (pwrite) {}", which);
let fd: i32 = varargs.get(instance); let fd: i32 = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
let count: u32 = varargs.get(instance); let count: u32 = varargs.get(instance);
@ -709,11 +709,11 @@ pub extern "C" fn ___syscall181(
// stat64 // stat64
pub extern "C" fn ___syscall195( pub extern "C" fn ___syscall195(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall195 (stat64)"); debug!("emscripten::___syscall195 (stat64) {}", which);
let pathname: u32 = varargs.get(instance); let pathname: u32 = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
@ -733,11 +733,11 @@ pub extern "C" fn ___syscall195(
// fstat64 // fstat64
pub extern "C" fn ___syscall197( pub extern "C" fn ___syscall197(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall197 (fstat64)"); debug!("emscripten::___syscall197 (fstat64) {}", which);
let fd: c_int = varargs.get(instance); let fd: c_int = varargs.get(instance);
let buf: u32 = varargs.get(instance); let buf: u32 = varargs.get(instance);
@ -783,11 +783,11 @@ pub extern "C" fn ___syscall202() -> gid_t {
// chown // chown
pub extern "C" fn ___syscall212( pub extern "C" fn ___syscall212(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall212 (chown)"); debug!("emscripten::___syscall212 (chown) {}", which);
let pathname: u32 = varargs.get(instance); let pathname: u32 = varargs.get(instance);
let owner: u32 = varargs.get(instance); let owner: u32 = varargs.get(instance);
@ -800,11 +800,11 @@ pub extern "C" fn ___syscall212(
// fcntl64 // fcntl64
pub extern "C" fn ___syscall221( pub extern "C" fn ___syscall221(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall221 (fcntl64)"); debug!("emscripten::___syscall221 (fcntl64) {}", which);
// fcntl64 // fcntl64
let _fd: i32 = varargs.get(instance); let _fd: i32 = varargs.get(instance);
let cmd: u32 = varargs.get(instance); let cmd: u32 = varargs.get(instance);
@ -816,11 +816,11 @@ pub extern "C" fn ___syscall221(
// prlimit64 // prlimit64
pub extern "C" fn ___syscall340( pub extern "C" fn ___syscall340(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall340 (prlimit64)"); debug!("emscripten::___syscall340 (prlimit64), {}", which);
// NOTE: Doesn't really matter. Wasm modules cannot exceed WASM_PAGE_SIZE anyway. // NOTE: Doesn't really matter. Wasm modules cannot exceed WASM_PAGE_SIZE anyway.
let _pid: i32 = varargs.get(instance); let _pid: i32 = varargs.get(instance);
let _resource: i32 = varargs.get(instance); let _resource: i32 = varargs.get(instance);
@ -843,11 +843,11 @@ pub extern "C" fn ___syscall340(
// dup2 // dup2
pub extern "C" fn ___syscall63( pub extern "C" fn ___syscall63(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall63 (dup2)"); debug!("emscripten::___syscall63 (dup2) {}", which);
let src: i32 = varargs.get(instance); let src: i32 = varargs.get(instance);
let dst: i32 = varargs.get(instance); let dst: i32 = varargs.get(instance);
@ -857,11 +857,11 @@ pub extern "C" fn ___syscall63(
// select // select
pub extern "C" fn ___syscall142( pub extern "C" fn ___syscall142(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall142 (newselect)"); debug!("emscripten::___syscall142 (newselect) {}", which);
let nfds: i32 = varargs.get(instance); let nfds: i32 = varargs.get(instance);
let readfds: u32 = varargs.get(instance); let readfds: u32 = varargs.get(instance);
@ -880,11 +880,11 @@ pub extern "C" fn ___syscall142(
// setpgid // setpgid
pub extern "C" fn ___syscall57( pub extern "C" fn ___syscall57(
_which: c_int, which: c_int,
mut varargs: VarArgs, mut varargs: VarArgs,
instance: &mut Instance, instance: &mut Instance,
) -> c_int { ) -> c_int {
debug!("emscripten::___syscall57 (setpgid)"); debug!("emscripten::___syscall57 (setpgid) {}", which);
let pid: i32 = varargs.get(instance); let pid: i32 = varargs.get(instance);
let pgid: i32 = varargs.get(instance); let pgid: i32 = varargs.get(instance);
unsafe { setpgid(pid, pgid) } unsafe { setpgid(pid, pgid) }

View File

@ -119,7 +119,7 @@ pub extern "C" fn _asctime(time: u32, instance: &mut Instance) -> u32 {
/// emscripten: _asctime_r /// emscripten: _asctime_r
pub extern "C" fn _asctime_r(time: u32, buf: u32, instance: &mut Instance) -> u32 { pub extern "C" fn _asctime_r(time: u32, buf: u32, instance: &mut Instance) -> u32 {
debug!("emscripten::_asctime_r {}", time); debug!("emscripten::_asctime_r {}, {}", time, buf);
unsafe { unsafe {
// NOTE: asctime_r is specced to behave in an undefined manner if the algorithm would attempt // NOTE: asctime_r is specced to behave in an undefined manner if the algorithm would attempt