Kernel/MM: Replace Region::Cacheable with a more generic MemoryType enum

This replaces all usages of Cacheable::Yes with MemoryType::Normal and
Cacheable::No with either MemoryType::NonCacheable or MemoryType::IO,
depending on the context.

The Page{Directory,Table}::set_cache_disabled function therefore also
has been replaced with a more appropriate set_memory_type_function.
Adding a memory_type "getter" would not be as easy, as some
architectures may not support all memory types, so getting the memory
type again may be a lossy conversion. The is_cache_disabled function
was never used, so just simply remove it altogether.

There is no difference between MemoryType::NonCacheable and
MemoryType::IO on x86 for now.

Other architectures currently don't respect the MemoryType at all.
This commit is contained in:
Sönke Holz
2024-10-10 21:28:30 +02:00
committed by Sönke Holz
parent a60e6d2f5d
commit d3a0ae5c57
14 changed files with 104 additions and 57 deletions

View File

@@ -29,7 +29,7 @@ void ContiguousFramebufferConsole::set_resolution(size_t width, size_t height, s
size_t size = Memory::page_round_up(pitch * height).release_value_but_fixme_should_propagate_errors();
dbgln("Framebuffer Console: taking {} bytes", size);
auto region_or_error = MM.allocate_mmio_kernel_region(m_framebuffer_address, size, "Framebuffer Console"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No);
auto region_or_error = MM.allocate_mmio_kernel_region(m_framebuffer_address, size, "Framebuffer Console"sv, Memory::Region::Access::ReadWrite, Memory::MemoryType::NonCacheable);
VERIFY(!region_or_error.is_error());
m_framebuffer_region = region_or_error.release_value();