mmu: Try to perform really bad TLB shootdowns?
This commit is contained in:
parent
e9d34d669b
commit
839dda7d41
@ -50,6 +50,7 @@ extern struct regs * _irq12(struct regs*);
|
||||
extern struct regs * _irq13(struct regs*);
|
||||
extern struct regs * _irq14(struct regs*);
|
||||
extern struct regs * _irq15(struct regs*);
|
||||
extern struct regs * _isr124(struct regs*); /* Does not actually take regs */
|
||||
extern struct regs * _isr125(struct regs*); /* Does not actually take regs */
|
||||
extern struct regs * _isr126(struct regs*); /* Does not actually take regs */
|
||||
extern struct regs * _isr127(struct regs*); /* Syscall entry point */
|
||||
|
@ -86,9 +86,10 @@ void idt_install(void) {
|
||||
idt_set_gate(46, _irq14, 0x08, 0x8E, 0);
|
||||
idt_set_gate(47, _irq15, 0x08, 0x8E, 0);
|
||||
|
||||
idt_set_gate(124, _isr124, 0x08, 0x8E, 0); /* Bad TLB shootdown. */
|
||||
idt_set_gate(125, _isr125, 0x08, 0x8E, 0); /* Halts everyone. */
|
||||
idt_set_gate(126, _isr126, 0x08, 0x8E, 0); /* Intentionally does nothing. */
|
||||
idt_set_gate(127, _isr127, 0x08, 0x8E, 1);
|
||||
idt_set_gate(126, _isr126, 0x08, 0x8E, 0); /* Does nothing, used to exit wait-for-interrupt sleep. */
|
||||
idt_set_gate(127, _isr127, 0x08, 0x8E, 1); /* Legacy system call entry point, called by userspace. */
|
||||
|
||||
asm volatile (
|
||||
"lidt %0"
|
||||
|
@ -80,6 +80,18 @@ IRQ 15, 47
|
||||
/* syscall entry point */
|
||||
ISR_NOERR 127
|
||||
|
||||
.global _isr124
|
||||
.type _isr124, @function
|
||||
_isr124:
|
||||
pushq %r12
|
||||
mov %cr3, %r12
|
||||
mov %r12, %cr3
|
||||
mov (lapic_final), %r12
|
||||
add $0xb0, %r12
|
||||
movl $0, (%r12)
|
||||
popq %r12
|
||||
iretq
|
||||
|
||||
/* No op, used to signal sleeping processor to wake and check the queue. */
|
||||
.extern lapic_final
|
||||
.global _isr126
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include <kernel/arch/x86_64/pml.h>
|
||||
#include <kernel/arch/x86_64/mmu.h>
|
||||
|
||||
extern void arch_tlb_shootdown(void);
|
||||
|
||||
/**
|
||||
* bitmap page allocator for 4KiB pages
|
||||
*/
|
||||
@ -630,6 +632,7 @@ void mmu_invalidate(uintptr_t addr) {
|
||||
asm volatile (
|
||||
"invlpg (%0)"
|
||||
: : "r"(addr));
|
||||
arch_tlb_shootdown();
|
||||
}
|
||||
|
||||
static char * heapStart = NULL;
|
||||
|
@ -294,3 +294,9 @@ void arch_wakeup_others(void) {
|
||||
* It should be gentle enough that busy cores dont't care. */
|
||||
lapic_send_ipi(0, 0x7E | (3 << 18));
|
||||
}
|
||||
|
||||
void arch_tlb_shootdown(void) {
|
||||
if (!lapic_final || processor_count < 2) return;
|
||||
|
||||
lapic_send_ipi(0, 0x7C | (3 << 18));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user