Path: blob/main/crates/unwinder/src/arch/s390x.rs
1693 views
//! s390x-specific definitions of architecture-specific functions in Wasmtime.12#[inline]3pub fn get_stack_pointer() -> usize {4let mut sp;5unsafe {6core::arch::asm!(7"lgr {}, %r15",8out(reg) sp,9options(nostack, nomem),10);11}12sp13}1415pub unsafe fn get_next_older_pc_from_fp(fp: usize) -> usize {16// The next older PC can be found in register %r14 at function entry, which17// was saved into slot 14 of the register save area pointed to by "FP" (the18// backchain pointer).19unsafe { *(fp as *mut usize).offset(14) }20}2122pub unsafe fn resume_to_exception_handler(23pc: usize,24sp: usize,25_fp: usize,26payload1: usize,27payload2: usize,28) -> ! {29unsafe {30core::arch::asm!(31"lgr %r15, {}",32"br {}",33in(reg) sp,34in(reg_addr) pc,35in("r6") payload1,36in("r7") payload2,37options(nostack, nomem, noreturn),38);39}40}4142// The next older "FP" (backchain pointer) was saved in the slot pointed to43// by the current "FP".44pub const NEXT_OLDER_FP_FROM_FP_OFFSET: usize = 0;4546// SP of caller is "FP" (backchain pointer) in callee.47pub const NEXT_OLDER_SP_FROM_FP_OFFSET: usize = 0;4849pub fn assert_fp_is_aligned(fp: usize) {50assert_eq!(fp % 8, 0, "stack should always be aligned to 8");51}525354