mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-27 11:48:59 +00:00
Kernel/riscv64: Don't flush the entire TLB in Processor::flush_tlb_local
This commit is contained in:
parent
cf92efc497
commit
c57e39d52b
Notes:
sideshowbarker
2024-07-17 02:35:27 +09:00
Author: https://github.com/spholz
Commit: c57e39d52b
Pull-request: https://github.com/SerenityOS/serenity/pull/24053
Reviewed-by: https://github.com/ADKaster ✅
1 changed files with 13 additions and 3 deletions
|
@ -137,10 +137,19 @@ template<typename T>
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ProcessorBase<T>::flush_tlb_local(VirtualAddress, size_t)
|
void ProcessorBase<T>::flush_tlb_local(VirtualAddress vaddr, size_t page_count)
|
||||||
{
|
{
|
||||||
// FIXME: Don't flush all pages
|
auto addr = vaddr.get();
|
||||||
flush_entire_tlb_local();
|
while (page_count > 0) {
|
||||||
|
// clang-format off
|
||||||
|
asm volatile("sfence.vma %0"
|
||||||
|
:
|
||||||
|
: "r"(addr)
|
||||||
|
: "memory");
|
||||||
|
// clang-format on
|
||||||
|
addr += PAGE_SIZE;
|
||||||
|
page_count--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -152,6 +161,7 @@ void ProcessorBase<T>::flush_entire_tlb_local()
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void ProcessorBase<T>::flush_tlb(Memory::PageDirectory const*, VirtualAddress vaddr, size_t page_count)
|
void ProcessorBase<T>::flush_tlb(Memory::PageDirectory const*, VirtualAddress vaddr, size_t page_count)
|
||||||
{
|
{
|
||||||
|
// FIXME: Use the SBI RFENCE extension to flush the TLB of other harts when we support SMP on riscv64.
|
||||||
flush_tlb_local(vaddr, page_count);
|
flush_tlb_local(vaddr, page_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue