Skip to content

Commit

Permalink
fix(x86_64): make use of static mut safer (#468)
Browse files Browse the repository at this point in the history
Apparently taking a reference to a `static mut` is going to be
disallowed by a future compiler, and we should use `addr_of!` instead.
This is because `static mut`s are only sound to access through a raw
pointer.
  • Loading branch information
hawkw committed Jan 21, 2024
1 parent cfa13d8 commit 8365530
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/arch/x86_64/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static TSS: sync::Lazy<task::StateSegment> = sync::Lazy::new(|| {
let mut tss = task::StateSegment::empty();
tss.interrupt_stacks[Idt::DOUBLE_FAULT_IST_OFFSET] = unsafe {
// safety: asdf
VAddr::of(&DOUBLE_FAULT_STACK).offset(DOUBLE_FAULT_STACK_SIZE as i32)
VAddr::from_usize_unchecked(core::ptr::addr_of!(DOUBLE_FAULT_STACK) as usize)
.offset(DOUBLE_FAULT_STACK_SIZE as i32)
};
tracing::debug!(?tss, "TSS initialized");
tss
Expand Down

0 comments on commit 8365530

Please sign in to comment.