diff --git a/CHANGELOG.md b/CHANGELOG.md index dd90dab..aefba6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Breaking changes + +- Updated to `zerocopy` 0.8.2. + ### New features - Added `mair` module with types to build MAIR values. diff --git a/Cargo.toml b/Cargo.toml index f6a971c..1f95a1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ categories = ["embedded", "no-std", "hardware-support"] [dependencies] bitflags = "2.6.0" -zerocopy = { version = "0.7.35", features = ["derive"], optional = true } +zerocopy = { version = "0.8.2", features = ["derive"], optional = true } [features] default = ["alloc", "zerocopy"] diff --git a/src/paging.rs b/src/paging.rs index 5f5f4a3..2104f91 100644 --- a/src/paging.rs +++ b/src/paging.rs @@ -14,7 +14,7 @@ use core::marker::PhantomData; use core::ops::{Add, Range, Sub}; use core::ptr::NonNull; #[cfg(feature = "zerocopy")] -use zerocopy::{AsBytes, FromBytes, FromZeroes}; +use zerocopy::{FromBytes, FromZeros, Immutable, IntoBytes, KnownLayout}; const PAGE_SHIFT: usize = 12; @@ -64,7 +64,10 @@ impl TranslationRegime { } /// An aarch64 virtual address, the input type of a stage 1 page table. -#[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes, FromZeroes))] +#[cfg_attr( + feature = "zerocopy", + derive(FromBytes, Immutable, IntoBytes, KnownLayout) +)] #[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)] #[repr(transparent)] pub struct VirtualAddress(pub usize); @@ -111,7 +114,10 @@ pub struct MemoryRegion(Range); /// An aarch64 physical address or intermediate physical address, the output type of a stage 1 page /// table. -#[cfg_attr(feature = "zerocopy", derive(AsBytes, FromBytes, FromZeroes))] +#[cfg_attr( + feature = "zerocopy", + derive(FromBytes, Immutable, IntoBytes, KnownLayout) +)] #[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)] #[repr(transparent)] pub struct PhysicalAddress(pub usize); @@ -834,7 +840,10 @@ impl PageTableWithLevel { /// A single level of a page table. #[repr(C, align(4096))] -#[cfg_attr(feature = "zerocopy", derive(AsBytes, FromZeroes))] +#[cfg_attr( + feature = "zerocopy", + derive(FromZeros, Immutable, IntoBytes, KnownLayout) +)] pub struct PageTable { entries: [Descriptor; 1 << BITS_PER_LEVEL], } @@ -856,7 +865,10 @@ impl PageTable { /// - A page mapping, if it is in the lowest level page table. /// - A block mapping, if it is not in the lowest level page table. /// - A pointer to a lower level pagetable, if it is not in the lowest level page table. -#[cfg_attr(feature = "zerocopy", derive(AsBytes, FromZeroes))] +#[cfg_attr( + feature = "zerocopy", + derive(FromZeros, Immutable, IntoBytes, KnownLayout) +)] #[derive(Clone, Copy, PartialEq, Eq)] #[repr(C)] pub struct Descriptor(usize); diff --git a/src/target.rs b/src/target.rs index 0e543bd..e26e2b1 100644 --- a/src/target.rs +++ b/src/target.rs @@ -10,7 +10,7 @@ use crate::paging::{deallocate, PageTable, PhysicalAddress, Translation}; use alloc::{vec, vec::Vec}; use core::{mem::size_of, ptr::NonNull}; #[cfg(feature = "zerocopy")] -use zerocopy::AsBytes; +use zerocopy::IntoBytes; /// An implementation of `Translation` which builds a static pagetable to be built into a binary for /// some target device.