Enable WASI feature, enhance security and add SGX sample (#142)

Change emcc to clang
Refine interpreter to improve perforamnce
This commit is contained in:
Weining
2019-11-20 21:16:36 +08:00
committed by wenyongh
parent 29c7c743e9
commit 27f246b5f3
159 changed files with 9543 additions and 3789 deletions

View File

@ -52,16 +52,3 @@ int b_strcpy_s(char * s1, size_t s1max, const char * s2)
return 0;
}
int fopen_s(FILE ** pFile, const char *filename, const char *mode)
{
if (NULL == pFile || NULL == filename || NULL == mode) {
return -1;
}
*pFile = fopen(filename, mode);
if (NULL == *pFile)
return -1;
return 0;
}

View File

@ -15,12 +15,35 @@ static bh_print_function_t print_function = NULL;
char *bh_strdup(const char *s)
{
uint32 size;
char *s1 = NULL;
if (s && (s1 = bh_malloc(strlen(s) + 1)))
memcpy(s1, s, strlen(s) + 1);
if (s) {
size = (uint32)(strlen(s) + 1);
if ((s1 = bh_malloc(size)))
bh_memcpy_s(s1, size, s, size);
}
return s1;
}
const unsigned short ** __ctype_b_loc(void)
{
/* TODO */
return NULL;
}
const int32_t ** __ctype_toupper_loc(void)
{
/* TODO */
return NULL;
}
const int32_t ** __ctype_tolower_loc(void)
{
/* TODO */
return NULL;
}
int bh_platform_init()
{
return 0;

View File

@ -14,6 +14,7 @@
#include <assert.h>
#include <time.h>
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@ -21,6 +22,7 @@
#include <ctype.h>
#include <pthread.h>
#include <limits.h>
#include <fcntl.h>
#include <errno.h>
#ifdef __cplusplus

View File

@ -20,14 +20,14 @@ void vm_thread_sys_destroy(void)
}
int _vm_thread_create_with_prio(korp_tid *tid, thread_start_routine_t start,
void *arg, unsigned int stack_size, int prio)
void *arg, unsigned int stack_size, int prio)
{
return BHT_ERROR;
// return BHT_OK;
}
int _vm_thread_create(korp_tid *tid, thread_start_routine_t start, void *arg,
unsigned int stack_size)
unsigned int stack_size)
{
return _vm_thread_create_with_prio(tid, start, arg, stack_size,
BH_THREAD_DEFAULT_PRIORITY);