1
+ //! This crate provides the definition of page table entry for various hardware
2
+ //! architectures.
3
+ //!
4
+ //! Currently supported architectures and page table entry types:
5
+ //!
6
+ //! - x86: [`x86_64::X64PTE`]
7
+ //! - ARM: [`aarch64::A64PTE`]
8
+ //! - RISC-V: [`riscv::Rv64PTE`]
9
+ //!
10
+ //! All these types implement the [`GenericPTE`] trait, which provides unified
11
+ //! methods for manipulating various page table entries.
12
+
1
13
#![ no_std]
2
14
#![ feature( const_trait_impl) ]
3
15
#![ feature( doc_auto_cfg) ]
@@ -11,20 +23,30 @@ use memory_addr::PhysAddr;
11
23
pub use self :: arch:: * ;
12
24
13
25
bitflags:: bitflags! {
26
+ /// Generic page table entry flags that indicate the corresponding mapped
27
+ /// memory region permissions and attributes.
14
28
#[ derive( Debug , Clone , Copy ) ]
15
29
pub struct MappingFlags : usize {
30
+ /// The memory is readable.
16
31
const READ = 1 << 0 ;
32
+ /// The memory is writable.
17
33
const WRITE = 1 << 1 ;
34
+ /// The memory is executable.
18
35
const EXECUTE = 1 << 2 ;
36
+ /// The memory is user accessible.
19
37
const USER = 1 << 3 ;
38
+ /// The memory is device memory.
20
39
const DEVICE = 1 << 4 ;
21
40
}
22
41
}
23
42
43
+ /// A generic page table entry.
44
+ ///
45
+ /// All architecture-specific page table entry types implement this trait.
24
46
pub trait GenericPTE : Debug + Clone + Copy + Sync + Send + Sized {
25
- // Create a page table entry point to a terminate page or block.
47
+ /// Create a page table entry point to a terminate page or block.
26
48
fn new_page ( paddr : PhysAddr , flags : MappingFlags , is_huge : bool ) -> Self ;
27
- // Create a page table entry point to a next level page table.
49
+ /// Create a page table entry point to a next level page table.
28
50
fn new_table ( paddr : PhysAddr ) -> Self ;
29
51
30
52
/// Returns the physical address mapped by this entry.
0 commit comments