Use PageFlags::write_combining instead of custom flag

This commit is contained in:
bjorn3
2026-03-30 19:25:51 +02:00
parent c0065bc893
commit a5fd001dcb
3 changed files with 7 additions and 13 deletions
-1
View File
@@ -8,6 +8,5 @@ bitflags::bitflags! {
pub struct EntryFlags: usize {
const NO_CACHE = 1 << 4;
const DEV_MEM = 0;
const WRITE_COMBINING = 0;
}
}
-2
View File
@@ -1,8 +1,6 @@
bitflags::bitflags! {
pub struct EntryFlags: usize {
const NO_CACHE = 1 << 4;
const HUGE_PAGE = 1 << 7;
const GLOBAL = 1 << 8;
const DEV_MEM = 0;
}
}
+7 -10
View File
@@ -149,23 +149,20 @@ impl MemoryScheme {
// Default
MemoryType::Writeback => (),
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] // TODO: AARCH64
MemoryType::WriteCombining => {
page_flags = page_flags.custom_flag(EntryFlags::HUGE_PAGE.bits(), true)
}
MemoryType::WriteCombining => page_flags = page_flags.write_combining(true),
MemoryType::Uncacheable => {
page_flags = page_flags.custom_flag(EntryFlags::NO_CACHE.bits(), true)
}
// MemoryType::DeviceMemory doesn't exist on x86 && x86_64, which instead support
// uncacheable, write-combining, write-through, write-protect, and write-back.
#[cfg(target_arch = "aarch64")]
MemoryType::DeviceMemory => {
page_flags = page_flags.custom_flag(EntryFlags::DEV_MEM.bits(), true)
// MemoryType::DeviceMemory doesn't exist on x86 && x86_64, which instead support
// uncacheable, write-combining, write-through, write-protect, and write-back.
#[cfg(target_arch = "aarch64")]
{
page_flags = page_flags.custom_flag(EntryFlags::DEV_MEM.bits(), true);
}
}
_ => (),
}
Grant::physmap(