1 //! "Dummy" implementations of some system primitives for MIRI emulation. 2 //! 3 //! Note that at this time this is just enough to run some tests in MIRI but 4 //! notably WebAssembly tests are not executed at this time (MIRI can't execute 5 //! Cranelift-generated code). 6 7 use std::cell::Cell; 8 9 pub mod mmap; 10 pub mod traphandlers; 11 pub mod unwind; 12 pub mod vm; 13 14 std::thread_local!(static TLS: Cell<*mut u8> = const { Cell::new(std::ptr::null_mut()) }); 15 16 #[inline] tls_get() -> *mut u817pub fn tls_get() -> *mut u8 { 18 TLS.with(|p| p.get()) 19 } 20 21 #[inline] tls_set(ptr: *mut u8)22pub fn tls_set(ptr: *mut u8) { 23 TLS.with(|p| p.set(ptr)); 24 } 25