Compare commits

..

5 Commits

Author SHA1 Message Date
978cc419f9 Don't save disabled FPU registers 2022-10-30 17:22:04 -05:00
Gary Guo
2f3ffefe8e Bump version 2022-09-12 21:46:09 +01:00
Gary Guo
c72e9cb824 Increase unwind table stack size
GDB binary seems to need 2
2022-09-12 21:45:30 +01:00
Gary Guo
9217c76d3d Fix name for ForcedUnwind 2022-09-12 21:45:29 +01:00
Nick Spinale
fe407b61e1 Swap usage of drop_panic and foreign_exception 2022-09-08 18:26:30 +02:00
6 changed files with 12 additions and 12 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "unwinding"
version = "0.1.4"
version = "0.1.5"
authors = ["Gary Guo <gary@garyguo.net>"]
edition = "2018"
license = "MIT OR Apache-2.0"

View File

@ -137,7 +137,7 @@ binding! {
extern "C-unwind" fn _Unwind_RaiseException(
exception: &mut UnwindException,
) -> UnwindReasonCode;
extern "C-unwind" fn _Unwind_ForceUnwind(
extern "C-unwind" fn _Unwind_ForcedUnwind(
exception: &mut UnwindException,
stop: UnwindStopFn,
stop_arg: *mut c_void,

View File

@ -8,15 +8,15 @@ pub use crate::panic_handler::*;
use crate::panicking::Exception;
#[repr(transparent)]
struct RustPanic(Box<dyn Any + Send>, ForeignGuard);
struct RustPanic(Box<dyn Any + Send>, DropGuard);
struct ForeignGuard;
struct DropGuard;
impl Drop for ForeignGuard {
impl Drop for DropGuard {
fn drop(&mut self) {
#[cfg(feature = "panic-handler")]
{
foreign_exception();
drop_panic();
}
core::intrinsics::abort();
}
@ -45,7 +45,7 @@ unsafe impl Exception for RustPanic {
}
pub fn begin_panic(payload: Box<dyn Any + Send>) -> UnwindReasonCode {
crate::panicking::begin_panic(RustPanic(payload, ForeignGuard))
crate::panicking::begin_panic(RustPanic(payload, DropGuard))
}
pub fn catch_unwind<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>> {
@ -55,7 +55,7 @@ pub fn catch_unwind<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<dyn Any + Send>>
None => {
#[cfg(feature = "panic-handler")]
{
drop_panic();
foreign_exception();
}
core::intrinsics::abort();
}

View File

@ -77,7 +77,7 @@ pub extern "C-unwind" fn save_context() -> Context {
mov [rax + 0x78], r15
mov rdx, [rsp]
mov [rax + 0x80], rdx
stmxcsr [rax + 0x88]
/* stmxcsr [rax + 0x88] */
fnstcw [rax + 0x90]
ret
",
@ -95,7 +95,7 @@ pub unsafe extern "C" fn restore_context(ctx: &Context) -> ! {
mov rsp, [rdi + 0x38]
/* Restore callee-saved control registers */
ldmxcsr [rdi + 0x88]
/* ldmxcsr [rdi + 0x88] */
fldcw [rdi + 0x90]
/* Restore return address */

View File

@ -27,7 +27,7 @@ const fn next_value(x: usize) -> usize {
impl<R: gimli::Reader> gimli::UnwindContextStorage<R> for StoreOnStack {
type Rules = [(Register, RegisterRule<R>); next_value(MAX_REG_RULES)];
type Stack = [UnwindTableRow<R, Self>; 1];
type Stack = [UnwindTableRow<R, Self>; 2];
}
#[cfg(feature = "dwarf-expr")]

View File

@ -217,7 +217,7 @@ fn raise_exception_phase2(
#[inline(never)]
#[no_mangle]
pub extern "C-unwind" fn _Unwind_ForceUnwind(
pub extern "C-unwind" fn _Unwind_ForcedUnwind(
exception: &mut UnwindException,
stop: UnwindStopFn,
stop_arg: *mut c_void,