diff --git a/src/arch/aarch64.rs b/src/arch/aarch64.rs index 9a2de5b48d..8045d60d1b 100644 --- a/src/arch/aarch64.rs +++ b/src/arch/aarch64.rs @@ -111,7 +111,7 @@ impl DerefMut for IntRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct FloatRegisters { pub fp_simd_regs: [u128; 32], pub fpsr: u32, @@ -142,7 +142,7 @@ impl DerefMut for FloatRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct EnvRegisters { pub tpidr_el0: usize, pub tpidrro_el0: usize, diff --git a/src/arch/riscv64.rs b/src/arch/riscv64.rs index 199f91c9bf..7885d2c3b6 100644 --- a/src/arch/riscv64.rs +++ b/src/arch/riscv64.rs @@ -79,7 +79,7 @@ impl DerefMut for IntRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct FloatRegisters { //TODO } diff --git a/src/arch/x86.rs b/src/arch/x86.rs index d43021511d..a1cf93fa8d 100644 --- a/src/arch/x86.rs +++ b/src/arch/x86.rs @@ -139,7 +139,7 @@ impl DerefMut for IntRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct FloatRegisters { pub fcw: u16, pub fsw: u16, @@ -179,7 +179,7 @@ impl DerefMut for FloatRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct EnvRegisters { pub fsbase: u32, pub gsbase: u32, diff --git a/src/arch/x86_64.rs b/src/arch/x86_64.rs index 6aaca56066..360715c5be 100644 --- a/src/arch/x86_64.rs +++ b/src/arch/x86_64.rs @@ -90,7 +90,7 @@ impl DerefMut for IntRegisters { } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct FloatRegisters { pub fcw: u16, pub fsw: u16, @@ -129,7 +129,7 @@ impl DerefMut for FloatRegisters { } } #[derive(Clone, Copy, Debug, Default)] -#[repr(packed)] +#[repr(C, packed)] pub struct EnvRegisters { pub fsbase: u64, pub gsbase: u64, diff --git a/src/io/mmio.rs b/src/io/mmio.rs index 1af643fa13..1a846f2122 100644 --- a/src/io/mmio.rs +++ b/src/io/mmio.rs @@ -4,17 +4,12 @@ use core::{mem::MaybeUninit, ptr}; use super::io::Io; -#[repr(packed)] +#[repr(transparent)] pub struct Mmio { value: MaybeUninit, } impl Mmio { - /// Create a new Mmio without initializing - #[deprecated = "unsound because it's possible to read even though it's uninitialized"] - pub fn new() -> Self { - unsafe { Self::uninit() } - } pub unsafe fn zeroed() -> Self { Self { value: MaybeUninit::zeroed(),