mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +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
Notes:
sideshowbarker
2024-07-19 18:44:53 +09:00
Author: https://github.com/awesomekling
Commit: 98f76f0153
3 changed files with 11 additions and 2 deletions
|
@ -156,6 +156,14 @@ byte* MemoryManager::quickMapOnePage(PhysicalAddress physicalAddress)
|
||||||
return (byte*)(4 * MB);
|
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)
|
bool MemoryManager::unmapRegion(Task& task, Task::Region& region)
|
||||||
{
|
{
|
||||||
auto& zone = *region.zone;
|
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());
|
// kprintf("MM: >> Unmapped L%x => P%x <<\n", laddr, zone.m_pages[i].get());
|
||||||
}
|
}
|
||||||
|
flushTLB();
|
||||||
return true;
|
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());
|
//kprintf("MM: >> Mapped L%x => P%x <<\n", laddr, zone.m_pages[i].get());
|
||||||
}
|
}
|
||||||
|
flushTLB();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,7 @@ private:
|
||||||
~MemoryManager();
|
~MemoryManager();
|
||||||
|
|
||||||
void initializePaging();
|
void initializePaging();
|
||||||
|
void flushTLB();
|
||||||
|
|
||||||
void protectMap(LinearAddress, size_t length);
|
void protectMap(LinearAddress, size_t length);
|
||||||
void identityMap(LinearAddress, size_t length);
|
void identityMap(LinearAddress, size_t length);
|
||||||
|
|
|
@ -168,8 +168,6 @@ static void init_stage2()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//auto* idTask = Task::create("/bin/id", (uid_t)209, (gid_t)1985);
|
|
||||||
|
|
||||||
auto* shTask = Task::create("/bin/sh", (uid_t)100, (gid_t)100);
|
auto* shTask = Task::create("/bin/sh", (uid_t)100, (gid_t)100);
|
||||||
|
|
||||||
//new Task(motd_main, "motd", IPC::Handle::MotdTask, Task::Ring0);
|
//new Task(motd_main, "motd", IPC::Handle::MotdTask, Task::Ring0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue