[kernel] Make grabbing an IST stack atomic

In the beginning of the interrupt handler, we had previously checked if
the current handler had grabbed an IST stack from the IDT/TSS. If it
was, it saved this value and set it to 0 in the IDT, then restored it at
the end.

Now this is an atomic action. This is unlikely to make a difference
unless the interrupt handler is itself interrupted by an exception
before being able to swap the IDT value, but such a situation is now
impossible.
This commit is contained in:
Justin C. Miller
2022-03-13 17:49:29 -07:00
parent 90663a674a
commit 5c3943bf38
2 changed files with 20 additions and 8 deletions

View File

@@ -75,8 +75,6 @@ isr_handler(cpu_state *regs)
// this stack
IDT &idt = IDT::current();
uint8_t old_ist = idt.get_ist(vector);
if (old_ist)
idt.set_ist(vector, 0);
char message[200];
@@ -165,7 +163,7 @@ isr_handler(cpu_state *regs)
// Return the IST for this vector to what it was
if (old_ist)
idt.set_ist(vector, old_ist);
idt.return_ist(vector, old_ist);
*reinterpret_cast<uint32_t *>(apic_eoi_addr) = 0;
}