From 3423d738e665c8aaf8cbc00eb4e4da661ad2ad31 Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sat, 11 Apr 2026 06:46:10 +0100 Subject: [PATCH] libkernel: arm64: memory: add a MemoryType AT to PaMapper Allow implementors of the `PaMapper` trait to choose a type which represents a memory type when mapping a PA region. --- libkernel/src/arch/arm64/memory/pg_descriptors.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libkernel/src/arch/arm64/memory/pg_descriptors.rs b/libkernel/src/arch/arm64/memory/pg_descriptors.rs index 2ab1413..71ae99b 100644 --- a/libkernel/src/arch/arm64/memory/pg_descriptors.rs +++ b/libkernel/src/arch/arm64/memory/pg_descriptors.rs @@ -36,6 +36,9 @@ pub trait TableMapper: PageTableEntry { /// A descriptor that maps a physical address (L1, L2 blocks and L3 page). pub trait PaMapper: PageTableEntry { + /// A type that encodes different types of memory for this architecture. + type MemoryType; + /// Constructs a new valid page descriptor that maps a physical address. fn new_map_pa(page_address: PA, memory_type: MemoryType, perms: PtePermissions) -> Self; @@ -200,6 +203,8 @@ macro_rules! define_descriptor { } impl PaMapper for $name { + type MemoryType = MemoryType; + fn map_shift() -> usize { $tbl_shift } fn could_map(region: PhysMemoryRegion, va: VA) -> bool {