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
21#[cfg(all(target_os = "linux", target_pointer_width = "64", feature = "std"))]
22mod pagemap;
23#[cfg(not(all(target_os = "linux", target_pointer_width = "64", feature = "std")))]
24use crate::vm::pagemap_disabled as pagemap;
25
26std::thread_local!(static TLS: Cell<*mut u8> = const { Cell::new(std::ptr::null_mut()) });
27
28#[inline]
29pub fn tls_get() -> *mut u8 {
30    TLS.with(|p| p.get())
31}
32
33#[inline]
34pub fn tls_set(ptr: *mut u8) {
35    TLS.with(|p| p.set(ptr));
36}