Unify rmm.rs between x86 and x86_64

This commit is contained in:
bjorn3
2025-06-28 20:03:06 +02:00
parent b06aa61676
commit ba66388ca7
5 changed files with 3 additions and 22 deletions
-2
View File
@@ -16,8 +16,6 @@ pub mod interrupt;
/// Paging
pub mod paging;
pub mod rmm;
pub use ::rmm::X86Arch as CurrentRmmArch;
// Flags
-17
View File
@@ -1,17 +0,0 @@
use rmm::{Arch, PageFlags, VirtualAddress};
pub unsafe fn page_flags<A: Arch>(virt: VirtualAddress) -> PageFlags<A> {
use crate::kernel_executable_offsets::*;
let virt_addr = virt.data();
if virt_addr >= __text_start() && virt_addr < __text_end() {
// Remap text read-only, execute
PageFlags::new().execute(true)
} else if virt_addr >= __rodata_start() && virt_addr < __rodata_end() {
// Remap rodata read-only, no execute
PageFlags::new()
} else {
// Remap everything else read-write, no execute
PageFlags::new().write(true)
}
}
-2
View File
@@ -24,8 +24,6 @@ pub mod misc;
/// Paging
pub mod paging;
pub mod rmm;
pub use ::rmm::X8664Arch as CurrentRmmArch;
// Flags
+2
View File
@@ -20,6 +20,8 @@ pub mod ipi;
/// Page table isolation
pub mod pti;
pub mod rmm;
/// Initialization and start function
pub mod start;
@@ -14,5 +14,5 @@ pub unsafe fn page_flags<A: Arch>(virt: VirtualAddress) -> PageFlags<A> {
// Remap everything else read-write, no execute
PageFlags::new().write(true)
})
.global(cfg!(not(feature = "pti")))
.global(cfg!(all(target_arch = "x86_64", not(feature = "pti"))))
}