Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm2c: minor code cleanup for OS checks for segue #2504

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading