Skip to content

Commit

Permalink
Implement ___syscall122 (uname())
Browse files Browse the repository at this point in the history
  • Loading branch information
rianhunter committed Sep 25, 2018
1 parent 65b6bda commit 398737c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/wasmjit/emscripten_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2662,6 +2662,31 @@ uint32_t wasmjit_emscripten____syscall12(uint32_t which, uint32_t varargs,
return check_ret(sys_chdir(base + args.pathname));
}

/* uname */
uint32_t wasmjit_emscripten____syscall122(uint32_t which, uint32_t varargs,
struct FuncInst *funcinst)
{
char *base;

LOAD_ARGS(funcinst, varargs, 1,
uint32_t, buf);

(void) which;

if (!_wasmjit_emscripten_check_range(funcinst, args.buf, 390))
return -SYS_EFAULT;

base = wasmjit_emscripten_get_base_address(funcinst);

strcpy(base + args.buf + 0, "Emscripten");
strcpy(base + args.buf + 65, "emscripten");
strcpy(base + args.buf + 130, "1.0");
strcpy(base + args.buf + 195, "#1");
strcpy(base + args.buf + 260, "x86-JS");

return 0;
}

void wasmjit_emscripten_cleanup(struct ModuleInst *moduleinst) {
(void)moduleinst;
/* TODO: implement */
Expand Down
1 change: 1 addition & 0 deletions src/wasmjit/emscripten_runtime_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ DEFINE_EMSCRIPTEN_FUNCTION(___syscall10, VALTYPE_I32, 2, VALTYPE_I32, VALTYPE_I3
DEFINE_EMSCRIPTEN_FUNCTION(___syscall102, VALTYPE_I32, 2, VALTYPE_I32, VALTYPE_I32)
DEFINE_EMSCRIPTEN_FUNCTION(___syscall221, VALTYPE_I32, 2, VALTYPE_I32, VALTYPE_I32)
DEFINE_EMSCRIPTEN_FUNCTION(___syscall12, VALTYPE_I32, 2, VALTYPE_I32, VALTYPE_I32)
DEFINE_EMSCRIPTEN_FUNCTION(___syscall122, VALTYPE_I32, 2, VALTYPE_I32, VALTYPE_I32)
END_FUNCTION_DEFS()

DEFINE_WASM_START_FUNCTION(wasmjit_emscripten_start_func)
Expand Down

0 comments on commit 398737c

Please sign in to comment.