wasmtime/runtime/vm/sys/unix/
mod.rs

1//! Implementation of Wasmtime's system primitives for Unix-like operating
2//! systems.
3//!
4//! This module handles Linux and macOS for example.
5
6use core::cell::Cell;
7
8#[cfg(has_virtual_memory)]
9pub mod mmap;
10pub mod traphandlers;
11#[cfg(has_host_compiler_backend)]
12pub mod unwind;
13#[cfg(has_virtual_memory)]
14pub mod vm;
15
16#[cfg(all(has_native_signals, target_vendor = "apple"))]
17pub mod machports;
18#[cfg(has_native_signals)]
19pub mod signals;
20
21std::thread_local!(static TLS: Cell<*mut u8> = const { Cell::new(std::ptr::null_mut()) });
22
23#[inline]
24pub fn tls_get() -> *mut u8 {
25    TLS.with(|p| p.get())
26}
27
28#[inline]
29pub fn tls_set(ptr: *mut u8) {
30    TLS.with(|p| p.set(ptr));
31}