summaryrefslogtreecommitdiff
path: root/Kernel/VM
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2020-01-21 04:41:02 +0200
committerAndreas Kling <kling@serenityos.org>2020-01-21 11:29:58 +0100
commit200a5b0649f3c0d1df117beb55bdeffba0ce9451 (patch)
tree6fdfeb47534b84c536f5ce666e933bca2db02aad /Kernel/VM
parent60c32f44dd48a18e1a8f4ddeaba1d3a33eb738f3 (diff)
downloadserenity-200a5b0649f3c0d1df117beb55bdeffba0ce9451.zip
Kernel: Remove map_for_kernel() in MemoryManager
We don't need to have this method anymore. It was a hack that was used in many components in the system but currently we use better methods to create virtual memory mappings. To prevent any further use of this method it's best to just remove it completely. Also, the APIC code is disabled for now since it doesn't help booting the system, and is broken since it relies on identity mapping to exist in the first 1MB. Any call to the APIC code will result in assertion failed. In addition to that, the name of the method which is responsible to create an identity mapping between 1MB to 2MB was changed, to be more precise about its purpose.
Diffstat (limited to 'Kernel/VM')
-rw-r--r--Kernel/VM/MemoryManager.cpp17
-rw-r--r--Kernel/VM/MemoryManager.h4
2 files changed, 4 insertions, 17 deletions
diff --git a/Kernel/VM/MemoryManager.cpp b/Kernel/VM/MemoryManager.cpp
index 80dd6fedaf..36fe7113b4 100644
--- a/Kernel/VM/MemoryManager.cpp
+++ b/Kernel/VM/MemoryManager.cpp
@@ -55,7 +55,7 @@ MemoryManager::MemoryManager()
asm volatile("movl %%eax, %%cr3" ::"a"(kernel_page_directory().cr3()));
- setup_low_1mb();
+ setup_low_identity_mapping();
protect_kernel_image();
}
@@ -83,7 +83,7 @@ void MemoryManager::protect_kernel_image()
}
}
-void MemoryManager::setup_low_1mb()
+void MemoryManager::setup_low_identity_mapping()
{
m_low_page_table = allocate_user_physical_page(ShouldZeroFill::Yes);
@@ -101,7 +101,7 @@ void MemoryManager::setup_low_1mb()
if (g_cpu_supports_nx)
pde_zero.set_execute_disabled(true);
- for (uintptr_t offset = 0; offset < (2 * MB); offset += PAGE_SIZE) {
+ for (uintptr_t offset = (1 * MB); offset < (2 * MB); offset += PAGE_SIZE) {
auto& page_table_page = m_low_page_table;
auto& pte = quickmap_pt(page_table_page->paddr())[offset / PAGE_SIZE];
pte.set_physical_page_base(offset);
@@ -532,17 +532,6 @@ PageTableEntry* MemoryManager::quickmap_pt(PhysicalAddress pt_paddr)
return (PageTableEntry*)0xffe08000;
}
-void MemoryManager::map_for_kernel(VirtualAddress vaddr, PhysicalAddress paddr, bool cache_disabled)
-{
- auto& pte = ensure_pte(kernel_page_directory(), vaddr);
- pte.set_physical_page_base(paddr.get());
- pte.set_present(true);
- pte.set_writable(true);
- pte.set_user_allowed(false);
- pte.set_cache_disabled(cache_disabled);
- flush_tlb(vaddr);
-}
-
u8* MemoryManager::quickmap_page(PhysicalPage& physical_page)
{
ASSERT_INTERRUPTS_DISABLED();
diff --git a/Kernel/VM/MemoryManager.h b/Kernel/VM/MemoryManager.h
index 0cd372022d..abb4591401 100644
--- a/Kernel/VM/MemoryManager.h
+++ b/Kernel/VM/MemoryManager.h
@@ -108,8 +108,6 @@ public:
void deallocate_user_physical_page(PhysicalPage&&);
void deallocate_supervisor_physical_page(PhysicalPage&&);
- void map_for_kernel(VirtualAddress, PhysicalAddress, bool cache_disabled = false);
-
OwnPtr<Region> allocate_kernel_region(size_t, const StringView& name, u8 access, bool user_accessible = false, bool should_commit = true, bool cacheable = true);
OwnPtr<Region> allocate_kernel_region(PhysicalAddress, size_t, const StringView& name, u8 access, bool user_accessible = false, bool cacheable = false);
OwnPtr<Region> allocate_kernel_region_with_vmobject(VMObject&, size_t, const StringView& name, u8 access, bool user_accessible = false, bool cacheable = false);
@@ -149,7 +147,7 @@ private:
void unregister_region(Region&);
void detect_cpu_features();
- void setup_low_1mb();
+ void setup_low_identity_mapping();
void protect_kernel_image();
void parse_memory_map();
void flush_entire_tlb();