Skip to content

Commit

Permalink
wasm2c: minor code cleanup for OS checks for segue
Browse files Browse the repository at this point in the history
  • Loading branch information
shravanrn committed Nov 11, 2024
1 parent c7c8968 commit 94c25a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wasm2c/wasm-rt-impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ bool wasm_rt_fsgsbase_inst_supported = false;
#include <asm/prctl.h> // For ARCH_SET_GS
#include <sys/syscall.h> // For SYS_arch_prctl
#include <unistd.h> // For syscall

#ifndef HWCAP2_FSGSBASE
#define HWCAP2_FSGSBASE (1 << 1)
#endif
#endif

#if WASM_RT_SEGUE_FREE_SEGMENT
Expand Down Expand Up @@ -245,7 +249,7 @@ void wasm_rt_init(void) {
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 18
// Check for support for userspace wrgsbase instructions
unsigned long val = getauxval(AT_HWCAP2);
wasm_rt_fsgsbase_inst_supported = val & (1 << 1);
wasm_rt_fsgsbase_inst_supported = val & HWCAP2_FSGSBASE;
#endif
#endif

Expand Down

0 comments on commit 94c25a9

Please sign in to comment.