1 //! Implementation of Wasmtime's system primitives for Windows.
2 
3 use std::cell::Cell;
4 
5 #[cfg(has_virtual_memory)]
6 pub mod mmap;
7 pub mod traphandlers;
8 #[cfg(has_native_signals)]
9 mod vectored_exceptions;
10 pub mod vm;
11 
12 #[cfg(all(target_pointer_width = "64", has_host_compiler_backend))]
13 pub mod unwind64;
14 #[cfg(all(target_pointer_width = "64", has_host_compiler_backend))]
15 pub use unwind64 as unwind;
16 
17 #[cfg(all(not(target_pointer_width = "64"), has_host_compiler_backend))]
18 compile_error!("don't know how to unwind non-64 bit platforms");
19 
20 std::thread_local!(static TLS: Cell<*mut u8> = const { Cell::new(std::ptr::null_mut()) });
21 
22 #[inline]
tls_get() -> *mut u823 pub fn tls_get() -> *mut u8 {
24     TLS.with(|p| p.get())
25 }
26 
27 #[inline]
tls_set(ptr: *mut u8)28 pub fn tls_set(ptr: *mut u8) {
29     TLS.with(|p| p.set(ptr));
30 }
31