Skip to content

Commit 2a0dd08

Browse files
hack3ricJake-Shadle
authored andcommitted
crash-handler: add riscv64 support
1 parent 313452f commit 2a0dd08

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

crash-handler/src/linux/jmp.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ cfg_if::cfg_if! {
3737
#[doc(hidden)]
3838
#[allow(non_camel_case_types)]
3939
pub struct __jmp_buf([u64; 22]);
40+
} else if #[cfg(target_arch = "riscv64")] {
41+
#[repr(C)]
42+
#[doc(hidden)]
43+
#[allow(non_camel_case_types)]
44+
pub struct __jmp_buf {
45+
__pc: u64,
46+
__regs: [u64; 12],
47+
__sp: u64,
48+
__fpregs: [f64; 12],
49+
}
4050
}
4151
}
4252

crash-handler/src/linux/state.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ impl HandlerInner {
457457
if (*fp_ptr).head.magic == crash_context::FPSIMD_MAGIC {
458458
ptr::copy_nonoverlapping(fp_ptr, &mut cc.float_state, 1);
459459
}
460+
} else if #[cfg(target_arch = "riscv64")] {
461+
cc.float_state = uc_ptr.uc_mcontext.__fpregs;
460462
} else if #[cfg(not(target_arch = "arm"))] {
461463
if !uc_ptr.uc_mcontext.fpregs.is_null() {
462464
ptr::copy_nonoverlapping(uc_ptr.uc_mcontext.fpregs, ((&mut cc.float_state) as *mut crash_context::fpregset_t).cast(), 1);

0 commit comments

Comments
 (0)