Skip to content

Commit 4cfc2e5

Browse files
committed
feat(paging): make Page, PhysFrame, and the range types repr(Rust)
1 parent a96374a commit 4cfc2e5

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- `OffsetPageTable`'s `PageTableFrameMapping` implementation is now public as `PhysOffset`.
1010
- [make range types `!Copy`](https://github.com/rust-osdev/x86_64/pull/581)
1111
- To migrate, use `.clone()` if necessary.
12+
- [make `Page`, `PhysFrame`, and the range types `repr(Rust)`](https://github.com/rust-osdev/x86_64/pull/584)
1213

1314
# 0.15.4 – 2025-11-24
1415

src/structures/paging/frame.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use core::ops::{Add, AddAssign, Sub, SubAssign};
99

1010
/// A physical memory frame.
1111
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12-
#[repr(C)]
1312
pub struct PhysFrame<S: PageSize = Size4KiB> {
1413
// TODO: Make private when our minimum supported stable Rust version is 1.61
1514
pub(crate) start_address: PhysAddr,
@@ -134,7 +133,6 @@ impl<S: PageSize> Sub<PhysFrame<S>> for PhysFrame<S> {
134133

135134
/// An range of physical memory frames, exclusive the upper bound.
136135
#[derive(Clone, PartialEq, Eq, Hash)]
137-
#[repr(C)]
138136
pub struct PhysFrameRange<S: PageSize = Size4KiB> {
139137
/// The start of the range, inclusive.
140138
pub start: PhysFrame<S>,
@@ -192,7 +190,6 @@ impl<S: PageSize> fmt::Debug for PhysFrameRange<S> {
192190

193191
/// An range of physical memory frames, inclusive the upper bound.
194192
#[derive(Clone, PartialEq, Eq, Hash)]
195-
#[repr(C)]
196193
pub struct PhysFrameRangeInclusive<S: PageSize = Size4KiB> {
197194
/// The start of the range, inclusive.
198195
pub start: PhysFrame<S>,

src/structures/paging/page.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl Sealed for super::Size1GiB {}
6363

6464
/// A virtual memory page.
6565
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
66-
#[repr(C)]
6766
pub struct Page<S: PageSize = Size4KiB> {
6867
start_address: VirtAddr,
6968
size: PhantomData<S>,
@@ -326,7 +325,6 @@ impl<S: PageSize> Step for Page<S> {
326325

327326
/// A range of pages with exclusive upper bound.
328327
#[derive(Clone, PartialEq, Eq, Hash)]
329-
#[repr(C)]
330328
pub struct PageRange<S: PageSize = Size4KiB> {
331329
/// The start of the range, inclusive.
332330
pub start: Page<S>,
@@ -395,7 +393,6 @@ impl<S: PageSize> fmt::Debug for PageRange<S> {
395393

396394
/// A range of pages with inclusive upper bound.
397395
#[derive(Clone, PartialEq, Eq, Hash)]
398-
#[repr(C)]
399396
pub struct PageRangeInclusive<S: PageSize = Size4KiB> {
400397
/// The start of the range, inclusive.
401398
pub start: Page<S>,

0 commit comments

Comments
 (0)