Set the si_code appropriately for exception-caused signals.

LLDB checks the si_code, and aborts if a code isn't known.

MFC after:	2 weeks
Relnotes:	yes
This commit is contained in:
Justin Hibbits 2014-08-08 06:22:32 +00:00
parent 12a6eb99a1
commit 6bff82d03d

View File

@ -192,6 +192,7 @@ trap(struct trapframe *frame)
case EXC_TRC: case EXC_TRC:
frame->srr1 &= ~PSL_SE; frame->srr1 &= ~PSL_SE;
sig = SIGTRAP; sig = SIGTRAP;
ucode = TRAP_TRACE;
break; break;
#ifdef __powerpc64__ #ifdef __powerpc64__
@ -199,13 +200,17 @@ trap(struct trapframe *frame)
case EXC_DSE: case EXC_DSE:
if (handle_user_slb_spill(&p->p_vmspace->vm_pmap, if (handle_user_slb_spill(&p->p_vmspace->vm_pmap,
(type == EXC_ISE) ? frame->srr0 : (type == EXC_ISE) ? frame->srr0 :
frame->cpu.aim.dar) != 0) frame->cpu.aim.dar) != 0) {
sig = SIGSEGV; sig = SIGSEGV;
ucode = SEGV_MAPERR;
}
break; break;
#endif #endif
case EXC_DSI: case EXC_DSI:
case EXC_ISI: case EXC_ISI:
sig = trap_pfault(frame, 1); sig = trap_pfault(frame, 1);
if (sig == SIGSEGV)
ucode = SEGV_MAPERR;
break; break;
case EXC_SC: case EXC_SC:
@ -240,8 +245,10 @@ trap(struct trapframe *frame)
break; break;
case EXC_ALI: case EXC_ALI:
if (fix_unaligned(td, frame) != 0) if (fix_unaligned(td, frame) != 0) {
sig = SIGBUS; sig = SIGBUS;
ucode = BUS_ADRALN;
}
else else
frame->srr0 += 4; frame->srr0 += 4;
break; break;
@ -259,8 +266,16 @@ trap(struct trapframe *frame)
} }
#endif #endif
sig = SIGTRAP; sig = SIGTRAP;
ucode = TRAP_BRKPT;
} else { } else {
sig = ppc_instr_emulate(frame, td->td_pcb); sig = ppc_instr_emulate(frame, td->td_pcb);
if (sig == SIGILL) {
if (frame->srr1 & EXC_PGM_PRIV)
ucode = ILL_PRVOPC;
else if (frame->srr1 & EXC_PGM_ILLEGAL)
ucode = ILL_ILLOPC;
} else if (sig == SIGFPE)
ucode = FPE_FLTINV; /* Punt for now, invalid operation. */
} }
break; break;
@ -271,6 +286,7 @@ trap(struct trapframe *frame)
* but it at least prevents the kernel from dying. * but it at least prevents the kernel from dying.
*/ */
sig = SIGBUS; sig = SIGBUS;
ucode = BUS_OBJERR;
break; break;
default: default: