Skip to content

Commit

Permalink
Derive Default for Attributes, PhysicalAddress and VirtualAddress.
Browse files Browse the repository at this point in the history
  • Loading branch information
qwandor committed Oct 15, 2024
1 parent 8a11e32 commit cd1a272
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
### New features

- Added `mair` module with types to build MAIR values.
- Implemented `Default` for `Descriptor` and `PageTable`, and added associated `EMPTY` constant.
- Implemented `Default` for `Attributes`, `Descriptor`, `PageTable`, `PhysicalAddress` and
`VirtualAddress`. Added associated `EMPTY` constant for `Descriptor` and `PageTable`.

## 0.7.1

Expand Down
6 changes: 3 additions & 3 deletions src/paging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl TranslationRegime {
feature = "zerocopy",
derive(FromBytes, Immutable, IntoBytes, KnownLayout)
)]
#[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Default, Eq, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct VirtualAddress(pub usize);

Expand Down Expand Up @@ -118,7 +118,7 @@ pub struct MemoryRegion(Range<VirtualAddress>);
feature = "zerocopy",
derive(FromBytes, Immutable, IntoBytes, KnownLayout)
)]
#[derive(Copy, Clone, Eq, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Default, Eq, Ord, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct PhysicalAddress(pub usize);

Expand Down Expand Up @@ -520,7 +520,7 @@ impl Iterator for ChunkedIterator<'_> {

bitflags! {
/// Attribute bits for a mapping in a page table.
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Attributes: usize {
const VALID = 1 << 0;
const TABLE_OR_PAGE = 1 << 1;
Expand Down

0 comments on commit cd1a272

Please sign in to comment.