Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions arch/all-pc/kernel/cpu_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,19 @@ SAVE_XMM_INTO_AREA(localarea)
)
if (pdata)
pdata->kb_PDFlags &= ~PLATFORMF_INEXCPT;

/*
* The LAPIC timer and IPIs are the only interrupts an AP takes, so
* like a device IRQ they take a pending task switch on the way back
* to user mode; the heartbeat only sets the flag. cpu_Trap() has
* sent the EOI.
*/
if ((exception_number >= X86_CPU_EXCEPT_COUNT) && (exception_number < APIC_EXCEPT_SYSCALL) &&
(SysBase != NULL) && INTR_FROMUSERMODE)
{
__asm__ __volatile__("cld;");
core_ExitInterrupt(regs);
}
}
else
{
Expand Down Expand Up @@ -545,6 +558,9 @@ SAVE_XMM_INTO_AREA(localarea)
bug("[Kernel]" DEBUGCOLOR_SET " %s(%u): calling LeaveInterrupt...(%08X)" DEBUGCOLOR_RESET "\n", __func__, int_number, regs->Flags);
)

/* core_ExitInterrupt() may return with interrupts on (SoftIntDispatch() ends in KrnSti()) */
__asm__ __volatile__("cli");

#if (__WORDSIZE==64)
/* Restore first four XMM registers. They could have been modified by any interrupt handler.
Interrupt handler or soft interrupt code is required to preserve XMM registers 5-15. */
Expand Down
Loading