mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 09:44:57 +00:00
Kernel: Flush the TLB (page only) when copying in a new kernel mapping
Not flushing the TLB here puts us in an infinite page fault loop.
This commit is contained in:
parent
72798519cb
commit
b5f1a4ac07
2 changed files with 3 additions and 2 deletions
|
@ -408,8 +408,9 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
|
||||||
if (fault.is_not_present() && fault.vaddr().get() >= 0xc0000000) {
|
if (fault.is_not_present() && fault.vaddr().get() >= 0xc0000000) {
|
||||||
u32 page_directory_index = (fault.vaddr().get() >> 22) & 0x3ff;
|
u32 page_directory_index = (fault.vaddr().get() >> 22) & 0x3ff;
|
||||||
if (kernel_page_directory().entries()[page_directory_index].is_present()) {
|
if (kernel_page_directory().entries()[page_directory_index].is_present()) {
|
||||||
current->process().page_directory().entries()[page_directory_index].copy_from({}, kernel_page_directory().entries()[page_directory_index]);
|
|
||||||
dbgprintf("NP(kernel): copying new kernel mapping for L%x into process\n", fault.vaddr().get());
|
dbgprintf("NP(kernel): copying new kernel mapping for L%x into process\n", fault.vaddr().get());
|
||||||
|
current->process().page_directory().entries()[page_directory_index].copy_from({}, kernel_page_directory().entries()[page_directory_index]);
|
||||||
|
flush_tlb(fault.vaddr().page_base());
|
||||||
return PageFaultResponse::Continue;
|
return PageFaultResponse::Continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
u8* as_ptr() { return reinterpret_cast<u8*>(m_address); }
|
u8* as_ptr() { return reinterpret_cast<u8*>(m_address); }
|
||||||
const u8* as_ptr() const { return reinterpret_cast<const u8*>(m_address); }
|
const u8* as_ptr() const { return reinterpret_cast<const u8*>(m_address); }
|
||||||
|
|
||||||
u32 page_base() const { return m_address & 0xfffff000; }
|
VirtualAddress page_base() const { return VirtualAddress(m_address & 0xfffff000); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
u32 m_address { 0 };
|
u32 m_address { 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue