[kernel] Add a _very_ basic TLB shootdown mechanism

This TLB shootdown implementation is pretty janky: When the kernel
unmaps a mapping, it sends an IPI to all other cores and doesn't even
wait to ensure they've finished handling it. Upon getting one of these
IPIs, the core just re-writes cr3 to flush all TLBs.
This commit is contained in:
Justin C. Miller
2024-08-13 19:02:40 -07:00
parent d3c1d6cc34
commit 4649d5f77b
4 changed files with 28 additions and 10 deletions

View File

@@ -21,6 +21,7 @@ constexpr uintptr_t apic_eoi_addr = 0xfee000b0 + mem::linear_offset;
extern "C" {
void isr_handler(cpu_state*);
void irq_handler(cpu_state*);
void _reload_cr3();
}
uint8_t
@@ -187,6 +188,11 @@ isr_handler(cpu_state *regs)
scheduler::get().schedule();
break;
case isr::ipiShootdown:
// TODO: Real shootdown algorithm
_reload_cr3();
break;
default:
util::format({message, sizeof(message)}, "Unknown interrupt 0x%lx", regs->interrupt);
kassert(false, message, regs);