You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@teaclave.apache.org by GitBox <gi...@apache.org> on 2021/06/14 07:44:34 UTC

[GitHub] [incubator-teaclave] m4sterchain commented on a change in pull request #504: Add WebAssembly Executor Support

m4sterchain commented on a change in pull request #504:
URL: https://github.com/apache/incubator-teaclave/pull/504#discussion_r650164329



##########
File path: third_party/wamr.patch
##########
@@ -0,0 +1,511 @@
+diff --git a/core/shared/platform/teaclave/platform_internal.h b/core/shared/platform/teaclave/platform_internal.h
+new file mode 100644
+index 0000000..83a08f4
+--- /dev/null
++++ b/core/shared/platform/teaclave/platform_internal.h
+@@ -0,0 +1,98 @@
++/*
++ * Copyright (C) 2019 Intel Corporation.  All rights reserved.
++ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
++ */
++
++#ifndef _PLATFORM_INTERNAL_H
++#define _PLATFORM_INTERNAL_H
++
++#include <inttypes.h>
++#include <stdbool.h>
++#include <assert.h>
++#include <time.h>
++#include <string.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <math.h>
++#include <stdarg.h>
++#include <ctype.h>
++#include <pthread.h>
++#include <signal.h>
++#include <semaphore.h>
++#include <limits.h>
++#include <dirent.h>
++#include <fcntl.h>
++#include <unistd.h>
++#include <poll.h>
++#include <sched.h>
++#include <errno.h>
++#include <netinet/in.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <sys/mman.h>
++#include <sys/time.h>
++#include <sys/timeb.h>
++#include <sys/uio.h>
++#include <sys/ioctl.h>
++#include <sys/socket.h>
++#include <sys/resource.h>
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#ifndef BH_PLATFORM_TEACLAVE
++#define BH_PLATFORM_TEACLAVE
++#endif
++
++/* Stack size of applet threads's native part.  */
++#define BH_APPLET_PRESERVED_STACK_SIZE (32 * 1024)
++
++/* Default thread priority */
++#define BH_THREAD_DEFAULT_PRIORITY 0
++// #define os_thread_get_stack_boundary null
++
++typedef pthread_t korp_tid;
++typedef pthread_mutex_t korp_mutex;
++typedef pthread_cond_t korp_cond;
++typedef pthread_t korp_thread;
++
++#define os_thread_local_attribute __thread
++
++#if WASM_DISABLE_HW_BOUND_CHECK == 0
++#if defined(BUILD_TARGET_X86_64) \
++    || defined(BUILD_TARGET_AMD_64) \
++    || defined(BUILD_TARGET_AARCH64)
++
++#include <setjmp.h>
++
++#define OS_ENABLE_HW_BOUND_CHECK
++
++typedef jmp_buf korp_jmpbuf;
++
++#define os_setjmp setjmp
++#define os_longjmp longjmp
++#define os_alloca alloca
++
++#define os_getpagesize getpagesize
++
++typedef void (*os_signal_handler)(void *sig_addr);
++
++int os_thread_signal_init(os_signal_handler handler);
++
++void os_thread_signal_destroy();
++
++bool os_thread_signal_inited();
++
++void os_signal_unmask();
++
++void os_sigreturn();
++#endif /* end of BUILD_TARGET_X86_64/AMD_64/AARCH64 */
++#endif /* end of WASM_DISABLE_HW_BOUND_CHECK */
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* end of _PLATFORM_INTERNAL_H */
++
+diff --git a/core/shared/platform/teaclave/shared_platform.cmake b/core/shared/platform/teaclave/shared_platform.cmake
+new file mode 100644
+index 0000000..0b8e32a
+--- /dev/null
++++ b/core/shared/platform/teaclave/shared_platform.cmake
+@@ -0,0 +1,16 @@
++# Copyright (C) 2019 Intel Corporation.  All rights reserved.
++# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
++
++set (PLATFORM_SHARED_DIR ${CMAKE_CURRENT_LIST_DIR})
++
++add_definitions(-DBH_PLATFORM_TEACLAVE)
++
++include_directories(${PLATFORM_SHARED_DIR})
++include_directories(${PLATFORM_SHARED_DIR}/../include)
++
++file (GLOB_RECURSE source_all ${PLATFORM_SHARED_DIR}/*.c)
++
++set (PLATFORM_SHARED_SOURCE ${source_all} ${PLATFORM_COMMON_POSIX_SOURCE})
++
++file (GLOB header ${PLATFORM_SHARED_DIR}/../include/*.h)
++LIST (APPEND RUNTIME_LIB_HEADER_LIST ${header})
+diff --git a/core/shared/platform/teaclave/teaclave_platform.c b/core/shared/platform/teaclave/teaclave_platform.c
+new file mode 100644
+index 0000000..95cd650
+--- /dev/null
++++ b/core/shared/platform/teaclave/teaclave_platform.c

Review comment:
       Could you elaborate more about this patch compared to the [linux-sgx platform](https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/core/shared/platform/linux-sgx/sgx_platform.c)?
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@teaclave.apache.org
For additional commands, e-mail: notifications-help@teaclave.apache.org