Skip to content

Commit

Permalink
Use underlying type of ptr_t for atomic ops
Browse files Browse the repository at this point in the history
  • Loading branch information
niluxv committed Apr 11, 2024
1 parent 3d0ed4a commit 52b5868
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions library/panic_unwind/src/seh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down Expand Up @@ -157,6 +161,10 @@ mod imp {
let offset: usize = addr - image_base;
Self(offset as u32)
}

pub const fn raw(self) -> u32 {
self.0
}
}
}

Expand Down Expand Up @@ -319,23 +327,23 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> 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" {
Expand Down

0 comments on commit 52b5868

Please sign in to comment.