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
|
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;
|
ksiginfo_t ksi;
|
||||||
|
|
||||||
@ -112,6 +112,7 @@ call_trapsignal(struct thread *td, int sig, int code, void *addr)
|
|||||||
ksi.ksi_signo = sig;
|
ksi.ksi_signo = sig;
|
||||||
ksi.ksi_code = code;
|
ksi.ksi_code = code;
|
||||||
ksi.ksi_addr = addr;
|
ksi.ksi_addr = addr;
|
||||||
|
ksi.ksi_trapno = trapno;
|
||||||
trapsignal(td, &ksi);
|
trapsignal(td, &ksi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,7 +162,8 @@ svc_handler(struct thread *td, struct trapframe *frame)
|
|||||||
syscallenter(td);
|
syscallenter(td);
|
||||||
syscallret(td);
|
syscallret(td);
|
||||||
} else {
|
} 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);
|
userret(td, frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,7 +179,8 @@ align_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
|
|||||||
panic("Misaligned access from kernel space!");
|
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);
|
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);
|
error = vm_fault_trap(map, far, ftype, VM_FAULT_NORMAL, &sig, &ucode);
|
||||||
if (error != KERN_SUCCESS) {
|
if (error != KERN_SUCCESS) {
|
||||||
if (lower) {
|
if (lower) {
|
||||||
call_trapsignal(td, sig, ucode, (void *)far);
|
call_trapsignal(td, sig, ucode, (void *)far,
|
||||||
|
ESR_ELx_EXCEPTION(esr));
|
||||||
} else {
|
} else {
|
||||||
if (td->td_intr_nesting_level == 0 &&
|
if (td->td_intr_nesting_level == 0 &&
|
||||||
pcb->pcb_onfault != 0) {
|
pcb->pcb_onfault != 0) {
|
||||||
@ -483,24 +487,29 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
|
|||||||
break;
|
break;
|
||||||
case EXCP_UNKNOWN:
|
case EXCP_UNKNOWN:
|
||||||
if (!undef_insn(0, frame))
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
case EXCP_SP_ALIGN:
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
case EXCP_PC_ALIGN:
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
case EXCP_BRKPT_EL0:
|
case EXCP_BRKPT_EL0:
|
||||||
case EXCP_BRK:
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
case EXCP_MSR:
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
case EXCP_SOFTSTP_EL0:
|
case EXCP_SOFTSTP_EL0:
|
||||||
@ -509,11 +518,12 @@ do_el0_sync(struct thread *td, struct trapframe *frame)
|
|||||||
WRITE_SPECIALREG(mdscr_el1,
|
WRITE_SPECIALREG(mdscr_el1,
|
||||||
READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_SS);
|
READ_SPECIALREG(mdscr_el1) & ~DBG_MDSCR_SS);
|
||||||
call_trapsignal(td, SIGTRAP, TRAP_TRACE,
|
call_trapsignal(td, SIGTRAP, TRAP_TRACE,
|
||||||
(void *)frame->tf_elr);
|
(void *)frame->tf_elr, exception);
|
||||||
userret(td, frame);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
default:
|
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);
|
userret(td, frame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user