mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 10:25:10 +00:00
Fix some paging related bugs exposed by the spawn stress test.
- Process::exec() needs to restore the original paging scope when called on a non-current process. - Add missing InterruptDisabler guards around g_processes access. - Only flush the TLB when modifying the active page tables.
This commit is contained in:
parent
7b96218389
commit
e71cb1c56b
13 changed files with 110 additions and 67 deletions
|
@ -444,7 +444,8 @@ void MemoryManager::remap_region_page(PageDirectory* page_directory, Region& reg
|
|||
else
|
||||
pte.setWritable(region.is_writable);
|
||||
pte.setUserAllowed(user_allowed);
|
||||
flushTLB(page_laddr);
|
||||
if (page_directory->is_active())
|
||||
flushTLB(page_laddr);
|
||||
#ifdef MM_DEBUG
|
||||
dbgprintf("MM: >> remap_region_page (PD=%x) '%s' L%x => P%x (@%p)\n", page_directory, region.name.characters(), page_laddr.get(), physical_page->paddr().get(), physical_page.ptr());
|
||||
#endif
|
||||
|
@ -478,7 +479,8 @@ void MemoryManager::map_region_at_address(PageDirectory* page_directory, Region&
|
|||
pte.setWritable(region.is_writable);
|
||||
}
|
||||
pte.setUserAllowed(user_allowed);
|
||||
flushTLB(page_laddr);
|
||||
if (page_directory->is_active())
|
||||
flushTLB(page_laddr);
|
||||
#ifdef MM_DEBUG
|
||||
dbgprintf("MM: >> map_region_at_address (PD=%x) '%s' L%x => P%x (@%p)\n", page_directory, region.name.characters(), page_laddr, physical_page ? physical_page->paddr().get() : 0, physical_page.ptr());
|
||||
#endif
|
||||
|
@ -498,7 +500,8 @@ void MemoryManager::unmap_range(PageDirectory* page_directory, LinearAddress lad
|
|||
pte.setPresent(false);
|
||||
pte.setWritable(false);
|
||||
pte.setUserAllowed(false);
|
||||
flushTLB(page_laddr);
|
||||
if (page_directory->is_active())
|
||||
flushTLB(page_laddr);
|
||||
#ifdef MM_DEBUG
|
||||
dbgprintf("MM: << unmap_range L%x =/> 0\n", page_laddr);
|
||||
#endif
|
||||
|
@ -547,7 +550,8 @@ bool MemoryManager::unmapRegion(Process& process, Region& region)
|
|||
pte.setPresent(false);
|
||||
pte.setWritable(false);
|
||||
pte.setUserAllowed(false);
|
||||
flushTLB(laddr);
|
||||
if (process.m_page_directory->is_active())
|
||||
flushTLB(laddr);
|
||||
#ifdef MM_DEBUG
|
||||
auto& physical_page = region.vmo().physical_pages()[region.first_page_index() + i];
|
||||
dbgprintf("MM: >> Unmapped L%x => P%x <<\n", laddr, physical_page ? physical_page->paddr().get() : 0);
|
||||
|
@ -764,3 +768,8 @@ void MemoryManager::unregister_region(Region& region)
|
|||
InterruptDisabler disabler;
|
||||
m_regions.remove(®ion);
|
||||
}
|
||||
|
||||
inline bool PageDirectory::is_active() const
|
||||
{
|
||||
return ¤t->page_directory() == this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue