mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 13:17:31 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									8d88471c46
								
							
						
					
					
						commit
						5fb5119239
					
				|  | @ -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); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang