From 5fb5119239220b0803e7045ca49b0a29fe65e70e Mon Sep 17 00:00:00 2001 From: Wenyong Huang Date: Mon, 5 Jun 2023 09:39:26 +0800 Subject: [PATCH] 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. --- core/shared/platform/linux-sgx/platform_internal.h | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/core/shared/platform/linux-sgx/platform_internal.h b/core/shared/platform/linux-sgx/platform_internal.h index 7fdbf22d..d18f015e 100644 --- a/core/shared/platform/linux-sgx/platform_internal.h +++ b/core/shared/platform/linux-sgx/platform_internal.h @@ -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 -#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);