From 52b5868c7e7f4ffdf26828e338103dac1b5dcaf0 Mon Sep 17 00:00:00 2001 From: niluxv Date: Thu, 11 Apr 2024 20:36:54 +0200 Subject: [PATCH] Use underlying type of `ptr_t` for atomic ops --- library/panic_unwind/src/seh.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs index 0d45eb45ef1f9..6bc0559c88f49 100644 --- a/library/panic_unwind/src/seh.rs +++ b/library/panic_unwind/src/seh.rs @@ -122,6 +122,10 @@ mod imp { pub const fn new(ptr: *mut u8) -> Self { Self(ptr) } + + pub const fn raw(self) -> *mut u8 { + self.0 + } } } @@ -157,6 +161,10 @@ mod imp { let offset: usize = addr - image_base; Self(offset as u32) } + + pub const fn raw(self) -> u32 { + self.0 + } } } @@ -319,23 +327,23 @@ pub unsafe fn panic(data: Box) -> u32 { // express more operations in statics (and we may never be able to). atomic_store_seqcst( addr_of_mut!(THROW_INFO.pmfnUnwind).cast(), - ptr_t::new(exception_cleanup as *mut u8), + ptr_t::new(exception_cleanup as *mut u8).raw(), ); atomic_store_seqcst( addr_of_mut!(THROW_INFO.pCatchableTypeArray).cast(), - ptr_t::new(addr_of_mut!(CATCHABLE_TYPE_ARRAY).cast()), + ptr_t::new(addr_of_mut!(CATCHABLE_TYPE_ARRAY).cast()).raw(), ); atomic_store_seqcst( addr_of_mut!(CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0]).cast(), - ptr_t::new(addr_of_mut!(CATCHABLE_TYPE).cast()), + ptr_t::new(addr_of_mut!(CATCHABLE_TYPE).cast()).raw(), ); atomic_store_seqcst( addr_of_mut!(CATCHABLE_TYPE.pType).cast(), - ptr_t::new(addr_of_mut!(TYPE_DESCRIPTOR).cast()), + ptr_t::new(addr_of_mut!(TYPE_DESCRIPTOR).cast()).raw(), ); atomic_store_seqcst( addr_of_mut!(CATCHABLE_TYPE.copyFunction).cast(), - ptr_t::new(exception_copy as *mut u8), + ptr_t::new(exception_copy as *mut u8).raw(), ); extern "system-unwind" {