Skip to content

Commit 7096d46

Browse files
committed
feat: add empty fn to all pte except aarch64
1 parent 315508b commit 7096d46

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

page_table_entry/src/arch/loongarch64.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ pub struct LA64PTE(u64);
125125

126126
impl LA64PTE {
127127
const PHYS_ADDR_MASK: u64 = 0x0000_ffff_ffff_f000; // bits 12..48
128+
129+
/// Creates an empty descriptor with all bits set to zero.
130+
pub const fn empty() -> Self {
131+
Self(0)
132+
}
128133
}
129134

130135
impl GenericPTE for LA64PTE {

page_table_entry/src/arch/riscv.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ pub struct Rv64PTE(u64);
8181

8282
impl Rv64PTE {
8383
const PHYS_ADDR_MASK: u64 = (1 << 54) - (1 << 10); // bits 10..54
84+
85+
/// Creates an empty descriptor with all bits set to zero.
86+
pub const fn empty() -> Self {
87+
Self(0)
88+
}
8489
}
8590

8691
impl GenericPTE for Rv64PTE {

page_table_entry/src/arch/x86_64.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ pub struct X64PTE(u64);
5858

5959
impl X64PTE {
6060
const PHYS_ADDR_MASK: u64 = 0x000f_ffff_ffff_f000; // bits 12..52
61+
62+
/// Creates an empty descriptor with all bits set to zero.
63+
pub const fn empty() -> Self {
64+
Self(0)
65+
}
6166
}
6267

6368
impl GenericPTE for X64PTE {

0 commit comments

Comments
 (0)