#if WASM_RT_USE_SEGUE // Currently Segue is used only for linux #include <sys/auxv.h> #ifdef __GLIBC__ #include <gnu/libc-version.h> #endif 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
/* Install SIGSEGV and SIGBUS handlers, since macOS seems to use SIGBUS. */
if (sigaction(SIGSEGV, &sa, NULL) != 0 || sigaction(SIGBUS, &sa, NULL) != 0) {
perror("sigaction failed");
abort();
}
}
staticvoid os_cleanup_signal_handler(void) { /* Undo what was done in os_install_signal_handler */ struct sigaction sa;
memset(&sa, '\0', sizeof(sa));
sa.sa_handler = SIG_DFL;
if (sigaction(SIGSEGV, &sa, NULL) != 0 || sigaction(SIGBUS, &sa, NULL)) {
perror("sigaction failed");
abort();
}
} #endif
#if WASM_RT_STACK_EXHAUSTION_HANDLER staticbool os_has_altstack_installed() { /* check for altstack already in place */
stack_t ss;
if (sigaltstack(NULL, &ss) != 0) {
perror("sigaltstack failed");
abort();
}
return !(ss.ss_flags & SS_DISABLE);
}
/* These routines set up an altstack to handle SIGSEGV from stack overflow. */ staticvoid os_allocate_and_install_altstack(void) { /* verify altstack not already allocated */
assert(!g_alt_stack && "wasm-rt error: tried to re-allocate thread-local alternate stack");
/* We could check and warn if an altstack is already installed, but some *sanitizersinstalltheirownaltstack,sothiswarningwouldfire
* spuriously and break the test outputs. */
// Include table operations for funcref #define WASM_RT_TABLE_OPS_FUNCREF #include"wasm-rt-impl-tableops.inc" #undef WASM_RT_TABLE_OPS_FUNCREF
// Include table operations for externref #define WASM_RT_TABLE_OPS_EXTERNREF #include"wasm-rt-impl-tableops.inc" #undef WASM_RT_TABLE_OPS_EXTERNREF
const char* wasm_rt_strerror(wasm_rt_trap_t trap) { switch (trap) { case WASM_RT_TRAP_NONE: return"No error"; case WASM_RT_TRAP_OOB: #if WASM_RT_MERGED_OOB_AND_EXHAUSTION_TRAPS return"Out-of-bounds access in linear memory or a table, or call stack " "exhausted"; #else return"Out-of-bounds access in linear memory or a table"; case WASM_RT_TRAP_EXHAUSTION: return"Call stack exhausted"; #endif case WASM_RT_TRAP_INT_OVERFLOW: return"Integer overflow on divide or truncation"; case WASM_RT_TRAP_DIV_BY_ZERO: return"Integer divide by zero"; case WASM_RT_TRAP_INVALID_CONVERSION: return"Conversion from NaN to integer"; case WASM_RT_TRAP_UNREACHABLE: return"Unreachable instruction executed"; case WASM_RT_TRAP_CALL_INDIRECT: return"Invalid call_indirect or return_call_indirect"; case WASM_RT_TRAP_UNCAUGHT_EXCEPTION: return"Uncaught exception"; case WASM_RT_TRAP_UNALIGNED: return"Unaligned atomic memory access";
} return"invalid trap code";
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.