Unify rmm.rs between x86 and x86_64
This commit is contained in:
@@ -16,8 +16,6 @@ pub mod interrupt;
|
||||
/// Paging
|
||||
pub mod paging;
|
||||
|
||||
pub mod rmm;
|
||||
|
||||
pub use ::rmm::X86Arch as CurrentRmmArch;
|
||||
|
||||
// Flags
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,6 @@ pub mod misc;
|
||||
/// Paging
|
||||
pub mod paging;
|
||||
|
||||
pub mod rmm;
|
||||
|
||||
pub use ::rmm::X8664Arch as CurrentRmmArch;
|
||||
|
||||
// Flags
|
||||
|
||||
@@ -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"))))
|
||||
}
|
||||
Reference in New Issue
Block a user