1 //! ISA-specific stack-switching routines.
2 
3 // The bodies are defined in inline assembly in the conditionally
4 // included modules below; their symbols are visible in the binary and
5 // accessed via the `extern "C"` declarations below that.
6 
7 cfg_if::cfg_if! {
8     if #[cfg(target_arch = "aarch64")] {
9         mod aarch64;
10     } else if #[cfg(target_arch = "x86_64")] {
11         mod x86_64;
12     } else if #[cfg(target_arch = "x86")] {
13         mod x86;
14     } else if #[cfg(target_arch = "arm")] {
15         mod arm;
16     } else if #[cfg(target_arch = "s390x")] {
17         // currently `global_asm!` isn't stable on s390x so this is an external
18         // assembler file built with the `build.rs`.
19     } else if #[cfg(target_arch = "riscv64")]  {
20         mod riscv64;
21     } else {
22         compile_error!("fibers are not supported on this CPU architecture");
23     }
24 }
25 
26 unsafe extern "C" {
27     #[wasmtime_versioned_export_macros::versioned_link]
28     pub(crate) fn wasmtime_fiber_init(
29         top_of_stack: *mut u8,
30         entry: extern "C" fn(*mut u8, *mut u8),
31         entry_arg0: *mut u8,
32     );
33     #[wasmtime_versioned_export_macros::versioned_link]
34     pub(crate) fn wasmtime_fiber_switch(top_of_stack: *mut u8);
35     #[allow(dead_code, reason = "only used on some platforms for inline asm")]
36     #[wasmtime_versioned_export_macros::versioned_link]
37     pub(crate) fn wasmtime_fiber_start();
38 }
39