Skip to content
Merged
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
20 changes: 19 additions & 1 deletion arch/x86_64/src/intel64/intel64_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,13 +620,31 @@ static int x86_64_fault_user_isr(int irq, void *c, void *arg)

/****************************************************************************
* Name: x86_64_fault_kill_isr
*
* Description:
* Send SIGFPE to the task that raised a divide error or an x87 FPU
* error. The handler returns to the instruction that faulted, so a fault
* of the kernel itself (a kernel thread, the idle task, or ring 0 code in
* a build with a user mode) panics instead of looping on that instruction.
*
****************************************************************************/

static int x86_64_fault_kill_isr(int irq, void *c, void *arg)
{
struct tcb_s *tcb = this_task();

if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL
#ifndef CONFIG_BUILD_FLAT
|| (tcb->xcp.regs[REG_CS] & X86_GDT_PL_MASK) != X86_GDT_RPL_USER
#endif
)
{
return x86_64_fault_panic_isr(irq, c, arg);
}

__asm__ volatile("fnclex":::"memory");

nxsig_kill(running_task()->pid, SIGFPE);
nxsig_kill(tcb->pid, SIGFPE);

return 0;
}
Expand Down
Loading