re-org platform APIs, simplify porting process (#201)
Co-authored-by: Xu Jun <jun1.xu@intel.com>
This commit is contained in:
@ -388,7 +388,7 @@ sprintf_out(int c, struct str_context *ctx)
|
||||
static int
|
||||
printf_out(int c, struct str_context *ctx)
|
||||
{
|
||||
bh_printf("%c", c);
|
||||
os_printf("%c", c);
|
||||
ctx->count++;
|
||||
return c;
|
||||
}
|
||||
@ -470,13 +470,13 @@ snprintf_wrapper(wasm_exec_env_t exec_env, char *str, uint32 size,
|
||||
static int
|
||||
puts_wrapper(wasm_exec_env_t exec_env, const char *str)
|
||||
{
|
||||
return bh_printf("%s\n", str);
|
||||
return os_printf("%s\n", str);
|
||||
}
|
||||
|
||||
static int
|
||||
putchar_wrapper(wasm_exec_env_t exec_env, int c)
|
||||
{
|
||||
bh_printf("%c", c);
|
||||
os_printf("%c", c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -908,7 +908,7 @@ static void
|
||||
llvm_stackrestore_wrapper(wasm_exec_env_t exec_env, uint32 llvm_stack)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst(exec_env);
|
||||
bh_printf("_llvm_stackrestore called!\n");
|
||||
os_printf("_llvm_stackrestore called!\n");
|
||||
wasm_runtime_set_llvm_stack(module_inst, llvm_stack);
|
||||
}
|
||||
|
||||
@ -916,7 +916,7 @@ static uint32
|
||||
llvm_stacksave_wrapper(wasm_exec_env_t exec_env)
|
||||
{
|
||||
wasm_module_inst_t module_inst = get_module_inst(exec_env);
|
||||
bh_printf("_llvm_stacksave called!\n");
|
||||
os_printf("_llvm_stacksave called!\n");
|
||||
return wasm_runtime_get_llvm_stack(module_inst);
|
||||
}
|
||||
|
||||
@ -996,7 +996,7 @@ __cxa_throw_wrapper(wasm_exec_env_t exec_env,
|
||||
static void
|
||||
print_i32_wrapper(wasm_exec_env_t exec_env, int32 i32)
|
||||
{
|
||||
bh_printf("%d\n", i32);
|
||||
os_printf("%d\n", i32);
|
||||
}
|
||||
|
||||
#define REG_NATIVE_FUNC(func_name, signature) \
|
||||
@ -1028,7 +1028,7 @@ static NativeSymbol native_symbols_libc_builtin[] = {
|
||||
REG_NATIVE_FUNC(exit, "(i)"),
|
||||
REG_NATIVE_FUNC(strtol, "($*i)i"),
|
||||
REG_NATIVE_FUNC(strtoul, "($*i)i"),
|
||||
REG_NATIVE_FUNC(memchr, "(*ii)"),
|
||||
REG_NATIVE_FUNC(memchr, "(*ii)i"),
|
||||
REG_NATIVE_FUNC(strncasecmp, "($$i)"),
|
||||
REG_NATIVE_FUNC(strspn, "($$)i"),
|
||||
REG_NATIVE_FUNC(strcspn, "($$)i"),
|
||||
|
||||
@ -47,6 +47,7 @@
|
||||
#include "str.h"
|
||||
|
||||
#include "bh_common.h"
|
||||
#include "bh_assert.h"
|
||||
|
||||
#if 0 /* TODO: -std=gnu99 causes compile error, comment them first */
|
||||
// struct iovec must have the same layout as __wasi_iovec_t.
|
||||
|
||||
Reference in New Issue
Block a user