From owner-svn-src-all@freebsd.org Thu Jul 23 21:40:04 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E62C364B22; Thu, 23 Jul 2020 21:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BCQjJ2rJxz4Bjb; Thu, 23 Jul 2020 21:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A1611FAEF; Thu, 23 Jul 2020 21:40:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 06NLe40Q083961; Thu, 23 Jul 2020 21:40:04 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 06NLe4UW083960; Thu, 23 Jul 2020 21:40:04 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202007232140.06NLe4UW083960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 Jul 2020 21:40:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363460 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 363460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2020 21:40:04 -0000 Author: jhb Date: Thu Jul 23 21:40:03 2020 New Revision: 363460 URL: https://svnweb.freebsd.org/changeset/base/363460 Log: Set si_trapno to the exception code from esr. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D25771 Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Jul 23 21:33:10 2020 (r363459) +++ head/sys/arm64/arm64/trap.c Thu Jul 23 21:40:03 2020 (r363460) @@ -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, 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 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, 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; }