Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2020 18:50:48 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363191 - head/sys/arm64/arm64
Message-ID:  <202007141850.06EIomTb031592@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Jul 14 18:50:48 2020
New Revision: 363191
URL: https://svnweb.freebsd.org/changeset/base/363191

Log:
  Print the arm64 registers in more exception handling panics
  
  It can be useful to get a dump of all registers when investigating why we
  received an exception that we are unable to handle. In these cases we
  already call panic, however we don't always print the registers.
  
  Add calls to print_registers and print esr and far when applicable.
  
  Sponsored by:	Innovate UK

Modified:
  head/sys/arm64/arm64/trap.c

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c	Tue Jul 14 18:31:15 2020	(r363190)
+++ head/sys/arm64/arm64/trap.c	Tue Jul 14 18:50:48 2020	(r363191)
@@ -170,8 +170,12 @@ static void
 align_abort(struct thread *td, struct trapframe *frame, uint64_t esr,
     uint64_t far, int lower)
 {
-	if (!lower)
+	if (!lower) {
+		print_registers(frame);
+		printf(" far: %16lx\n", far);
+		printf(" esr:         %.8lx\n", esr);
 		panic("Misaligned access from kernel space!");
+	}
 
 	call_trapsignal(td, SIGBUS, BUS_ADRALN, (void *)frame->tf_elr);
 	userret(td, frame);
@@ -361,6 +365,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
 		} else {
 			print_registers(frame);
 			printf(" far: %16lx\n", far);
+			printf(" esr:         %.8lx\n", esr);
 			panic("Unhandled EL1 %s abort: %x",
 			    exception == EXCP_INSN_ABORT ? "instruction" :
 			    "data", dfsc);
@@ -397,6 +402,7 @@ do_el1h_sync(struct thread *td, struct trapframe *fram
 		/* FALLTHROUGH */
 	default:
 		print_registers(frame);
+		printf(" far: %16lx\n", READ_SPECIALREG(far_el1));
 		panic("Unknown kernel exception %x esr_el1 %lx\n", exception,
 		    esr);
 	}
@@ -466,10 +472,14 @@ do_el0_sync(struct thread *td, struct trapframe *frame
 		if (dfsc < nitems(abort_handlers) &&
 		    abort_handlers[dfsc] != NULL)
 			abort_handlers[dfsc](td, frame, esr, far, 1);
-		else
+		else {
+			print_registers(frame);
+			printf(" far: %16lx\n", far);
+			printf(" esr:         %.8lx\n", esr);
 			panic("Unhandled EL0 %s abort: %x",
 			    exception == EXCP_INSN_ABORT_L ? "instruction" :
 			    "data", dfsc);
+		}
 		break;
 	case EXCP_UNKNOWN:
 		if (!undef_insn(0, frame))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202007141850.06EIomTb031592>