Enable WASI feature, enhance security and add SGX sample (#142)
Change emcc to clang Refine interpreter to improve perforamnce
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
add_definitions (-D__POSIX__ -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=199309L)
|
||||
add_definitions (-D__POSIX__ -D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200809L -D_BSD_SOURCE)
|
||||
|
||||
set (PLATFORM_LIB_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include "wasm_log.h"
|
||||
#include "wasm_memory.h"
|
||||
#include "wasm_platform_log.h"
|
||||
#include "bh_common.h"
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/uio.h>
|
||||
@ -92,7 +93,7 @@ __syscall3_wrapper(WASMModuleInstance *module_inst,
|
||||
return 0;
|
||||
|
||||
wsz = (struct winsize*)addr_app_to_native(arg3);
|
||||
return syscall(54, arg1, arg2, wsz);
|
||||
return (int32)syscall(54, arg1, arg2, wsz);
|
||||
}
|
||||
|
||||
case 146: /* writev */
|
||||
@ -104,7 +105,7 @@ __syscall3_wrapper(WASMModuleInstance *module_inst,
|
||||
uint32 iov_len;
|
||||
} *vec;
|
||||
int32 vec_offset = arg2, str_offset;
|
||||
uint32 iov_count = arg3, i;
|
||||
uint32 iov_count = (uint32)arg3, i;
|
||||
int32 count = 0;
|
||||
char *iov_base, *str;
|
||||
|
||||
@ -123,7 +124,7 @@ __syscall3_wrapper(WASMModuleInstance *module_inst,
|
||||
|
||||
str = addr_app_to_native(str_offset);
|
||||
|
||||
memcpy(str, iov_base, vec->iov_len);
|
||||
bh_memcpy_s(str, vec->iov_len + 1, iov_base, vec->iov_len);
|
||||
str[vec->iov_len] = '\0';
|
||||
count += wasm_printf("%s", str);
|
||||
|
||||
@ -232,7 +233,7 @@ EMCC_SYSCALL_WRAPPER3(221)
|
||||
|
||||
EMCC_SYSCALL_WRAPPER5(140)
|
||||
|
||||
static int32
|
||||
static uint32
|
||||
getTotalMemory_wrapper(WASMModuleInstance *module_inst)
|
||||
{
|
||||
WASMMemoryInstance *memory = module_inst->default_memory;
|
||||
|
||||
Reference in New Issue
Block a user