Set si_trapno to the exception code from esr.
Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25771
This commit is contained in:
parent
09483f4a44
commit
a9c79eb484
@ -104,7 +104,7 @@ static abort_handler *abort_handlers[] = {
|
||||
};
|
||||
|
||||
static __inline void
|
||||
call_trapsignal(struct thread *td, int sig, int code, void *addr)
|
||||
call_trapsignal(struct thread *td, int sig, int code, void *addr, int trapno)
|
||||
{
|
||||
ksiginfo_t ksi;
|
||||
|
||||
@ -112,6 +112,7 @@ call_trapsignal(struct thread *td, int sig, int code, void *addr)
|
||||
ksi.ksi_signo = sig;
|
||||
ksi.ksi_code = code;
|
||||
ksi.ksi_addr = addr;
|
||||
ksi.ksi_trapno = trapno;
|
||||
trapsignal(td, &ksi);
|
||||
}
|
||||
|
||||
@ -161,7 +162,8 @@ svc_handler(struct thread *td, struct trapframe *frame)
|
||||
syscallenter(td);
|
||||
syscallret(td);
|
||||
} else {
|
||||
call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGILL, ILL_ILLOPN, (void *)frame->tf_elr,
|
||||
ESR_ELx_EXCEPTION(frame->tf_esr));
|
||||
userret(td, frame);
|
||||
}
|
||||
}
|
||||
@ -177,7 +179,8 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
|
||||
panic("Misaligned access from kernel space!");
|
||||
}
|
||||
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr,
|
||||
ESR_ELx_EXCEPTION(frame->tf_esr));
|
||||
userret(td, frame);
|
||||
}
|
||||
|
||||
@ -261,7 +264,8 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
|
||||
error = vm_fault_trap(map, far, ftype, VM_FAULT_NORMAL, &sig, &ucode);
|
||||
if (error != KERN_SUCCESS) {
|
||||
if (lower) {
|
||||
call_trapsignal(td, sig, ucode, (void *)far);
|
||||
call_trapsignal(td, sig, ucode, (void *)far,
|
||||
ESR_ELx_EXCEPTION(esr));
|
||||
} else {
|
||||
if (td->td_intr_nesting_level == 0 &&
|
||||
pcb->pcb_onfault != 0) {
|
||||
@ -483,24 +487,29 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
|
||||
break;
|
||||
case EXCP_UNKNOWN:
|
||||
if (!undef_insn(0, frame))
|
||||
call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far);
|
||||
call_trapsignal(td, SIGILL, ILL_ILLTRP, (void *)far,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
case EXCP_SP_ALIGN:
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp);
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_sp,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
case EXCP_PC_ALIGN:
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
case EXCP_BRKPT_EL0:
|
||||
case EXCP_BRK:
|
||||
call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGTRAP, TRAP_BRKPT, (void *)frame->tf_elr,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
case EXCP_MSR:
|
||||
call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGILL, ILL_PRVOPC, (void *)frame->tf_elr,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
case EXCP_SOFTSTP_EL0:
|
||||
@ -509,11 +518,12 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
|
||||
WRITE_SPECIALREG(mdscr_el1,
|
||||
READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_SS);
|
||||
call_trapsignal(td, SIGTRAP, TRAP_TRACE,
|
||||
(void *)frame->tf_elr);
|
||||
(void *)frame->tf_elr, exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
default:
|
||||
call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr);
|
||||
call_trapsignal(td, SIGBUS, BUS_OBJERR, (void *)frame->tf_elr,
|
||||
exception);
|
||||
userret(td, frame);
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user