summaryrefslogtreecommitdiff
path: root/wasm2c/wasm-rt.h
diff options
context:
space:
mode:
authorShravan Narayan <shravanrn@gmail.com>2024-07-15 17:06:24 -0500
committerShravan Narayan <shravanrn@gmail.com>2024-09-06 16:48:31 -0500
commitc6853eb4857908072fd1d7c28dffb1d2613a0ee6 (patch)
tree78ef4f5369ee821c94aa643f7b82ebca726d6ad4 /wasm2c/wasm-rt.h
parente3b16dae4166b138bbd04bbe67281f4fa47fd4de (diff)
downloadwabt-c6853eb4857908072fd1d7c28dffb1d2613a0ee6.tar.gz
wabt-c6853eb4857908072fd1d7c28dffb1d2613a0ee6.tar.bz2
wabt-c6853eb4857908072fd1d7c28dffb1d2613a0ee6.zip
wasm2c: Segue support for CPUs without wrgsbase instructions
Diffstat (limited to 'wasm2c/wasm-rt.h')
-rw-r--r--wasm2c/wasm-rt.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/wasm2c/wasm-rt.h b/wasm2c/wasm-rt.h
index 5c07ff44..c489c850 100644
--- a/wasm2c/wasm-rt.h
+++ b/wasm2c/wasm-rt.h
@@ -294,6 +294,27 @@ extern WASM_RT_THREAD_LOCAL uint32_t wasm_rt_call_stack_depth;
#endif
+#if WASM_RT_USE_SEGUE || WASM_RT_ALLOW_SEGUE
+/**
+ * The segue optimization uses x86 segments to point to a linear memory. If
+ * used, the runtime must query whether it can use the fast userspace wrgsbase
+ * instructions or whether it must invoke syscalls to set the segment base,
+ * depending on the supported CPU features. The result of this query is saved in
+ * this variable.
+ */
+extern bool wasm_rt_fsgsbase_inst_supported;
+/**
+ * If fast userspace wrgsbase instructions don't exist, the runtime most provide
+ * a function that invokes the OS' underlying syscall to set the segment base.
+ */
+void wasm_rt_syscall_set_segue_base(void* base);
+/**
+ * If fast userspace rdgsbase instructions don't exist, the runtime most provide
+ * a function that invokes the OS' underlying syscall to get the segment base.
+ */
+void* wasm_rt_syscall_get_segue_base();
+#endif
+
#if defined(_MSC_VER)
#define WASM_RT_NO_RETURN __declspec(noreturn)
#else