Disable writting GS register on linux-sgx platform (#2255)

Writing GS segment register is not allowed on linux-sgx since it is used as
the base address of thread data in 64-bit hw mode. Reported in #2252.
Disable writing it and disable segue optimization for linux-sgx platform.
This commit is contained in:
Wenyong Huang 2023-06-05 09:39:26 +08:00 committed by GitHub
parent 8d88471c46
commit 5fb5119239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,20 +56,6 @@ typedef unsigned int korp_sem;
#define OS_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
#endif
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
#define os_writegsbase(base_addr) \
do { \
uint64 __gs_value = (uint64)(uintptr_t)base_addr; \
asm volatile("wrgsbase %0" ::"r"(__gs_value) : "memory"); \
} while (0)
#if 0
/* _writegsbase_u64 also works, but need to add -mfsgsbase flag for gcc */
#include <immintrin.h>
#define os_writegsbase(base_addr) \
_writegsbase_u64(((uint64)(uintptr_t)base_addr))
#endif
#endif
typedef int (*os_print_function_t)(const char *message);
void
os_set_print_function(os_print_function_t pf);