Skip to content

Commit

Permalink
Fix incidental references to static muts in sidecar (#466)
Browse files Browse the repository at this point in the history
Fix new warnings in sidecar from Rust 1.83 getting stricter around the
handling of mutable statics. The methods previously being called would
automatically create references. We shouldn't do that.
  • Loading branch information
smalis-msft authored Dec 12, 2024
1 parent 5109fee commit 0a17df9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openhcl/sidecar/src/arch/x86_64/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ fn init(
// no invariant requirements.
let hypercall_page = unsafe { mapper.map::<[u8; 4096]>(hypercall_page) };
// SAFETY: no concurrent accessors to the page.
unsafe { HYPERCALL_PAGE.copy_from_slice(&*hypercall_page) };
unsafe { (&raw mut HYPERCALL_PAGE).copy_from_nonoverlapping(&*hypercall_page, 1) };
}

// Initialize the IDT.
Expand Down
4 changes: 2 additions & 2 deletions openhcl/sidecar/src/arch/x86_64/vp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ fn set_debug_register(name: HvX64RegisterName, value: u64) -> bool {
HvX64RegisterName::Dr1 => core::arch::asm!("mov dr1, {}", in(reg) value),
HvX64RegisterName::Dr2 => core::arch::asm!("mov dr2, {}", in(reg) value),
HvX64RegisterName::Dr3 => core::arch::asm!("mov dr3, {}", in(reg) value),
HvX64RegisterName::Dr6 if VSM_CAPABILITIES.dr6_shared() => {
HvX64RegisterName::Dr6 if (&raw const VSM_CAPABILITIES).read().dr6_shared() => {
core::arch::asm!("mov dr6, {}", in(reg) value)
}
_ => return false,
Expand All @@ -382,7 +382,7 @@ fn get_debug_register(name: HvX64RegisterName) -> Option<u64> {
HvX64RegisterName::Dr1 => core::arch::asm!("mov {}, dr1", lateout(reg) v),
HvX64RegisterName::Dr2 => core::arch::asm!("mov {}, dr2", lateout(reg) v),
HvX64RegisterName::Dr3 => core::arch::asm!("mov {}, dr3", lateout(reg) v),
HvX64RegisterName::Dr6 if VSM_CAPABILITIES.dr6_shared() => {
HvX64RegisterName::Dr6 if (&raw const VSM_CAPABILITIES).read().dr6_shared() => {
core::arch::asm!("mov {}, dr6", lateout(reg) v)
}
_ => return None,
Expand Down

0 comments on commit 0a17df9

Please sign in to comment.