mirror of
https://github.com/RGBCube/serenity
synced 2025-07-07 12:47:36 +00:00
Flush the TLB after modifying page tables.
This is a very inefficient naive implementation, but it gets us going. Mapping tasks in and out of a shared address space now totally works.
This commit is contained in:
parent
56ed448424
commit
98f76f0153
3 changed files with 11 additions and 2 deletions
|
@ -156,6 +156,14 @@ byte* MemoryManager::quickMapOnePage(PhysicalAddress physicalAddress)
|
|||
return (byte*)(4 * MB);
|
||||
}
|
||||
|
||||
void MemoryManager::flushTLB()
|
||||
{
|
||||
asm volatile(
|
||||
"mov %cr3, %eax\n"
|
||||
"mov %eax, %cr3\n"
|
||||
);
|
||||
}
|
||||
|
||||
bool MemoryManager::unmapRegion(Task& task, Task::Region& region)
|
||||
{
|
||||
auto& zone = *region.zone;
|
||||
|
@ -169,6 +177,7 @@ bool MemoryManager::unmapRegion(Task& task, Task::Region& region)
|
|||
|
||||
// kprintf("MM: >> Unmapped L%x => P%x <<\n", laddr, zone.m_pages[i].get());
|
||||
}
|
||||
flushTLB();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -194,6 +203,7 @@ bool MemoryManager::mapRegion(Task& task, Task::Region& region)
|
|||
|
||||
//kprintf("MM: >> Mapped L%x => P%x <<\n", laddr, zone.m_pages[i].get());
|
||||
}
|
||||
flushTLB();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue