Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Feb 2017 18:19:11 +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: r313396 - in head/sys/arm64: arm64 include
Message-ID:  <201702071819.v17IJBMc001382@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Feb  7 18:19:11 2017
New Revision: 313396
URL: https://svnweb.freebsd.org/changeset/base/313396

Log:
  Push reading of ESR_EL1 to assembly. Among other uses this will allow us
  to expose this to signal handlers, e.g. for the clang sanitizers.
  
  Sponsored by:	DARPA, AFRL

Modified:
  head/sys/arm64/arm64/exception.S
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/trap.c
  head/sys/arm64/include/frame.h

Modified: head/sys/arm64/arm64/exception.S
==============================================================================
--- head/sys/arm64/arm64/exception.S	Tue Feb  7 17:40:59 2017	(r313395)
+++ head/sys/arm64/arm64/exception.S	Tue Feb  7 18:19:11 2017	(r313396)
@@ -56,10 +56,12 @@ __FBSDID("$FreeBSD$");
 	stp	x0,  x1,  [sp, #(TF_X + 0  * 8)]
 	mrs	x10, elr_el1
 	mrs	x11, spsr_el1
+	mrs	x12, esr_el1
 .if \el == 0
 	mrs	x18, sp_el0
 .endif
-	stp	x10, x11, [sp, #(TF_ELR)]
+	str	x10, [sp, #(TF_ELR)]
+	stp	w11, w12, [sp, #(TF_SPSR)]
 	stp	x18,  lr, [sp, #(TF_SP)]
 	mrs	x18, tpidr_el1
 	add	x29, sp, #(TF_SIZE)

Modified: head/sys/arm64/arm64/genassym.c
==============================================================================
--- head/sys/arm64/arm64/genassym.c	Tue Feb  7 17:40:59 2017	(r313395)
+++ head/sys/arm64/arm64/genassym.c	Tue Feb  7 18:19:11 2017	(r313396)
@@ -62,4 +62,5 @@ ASSYM(TD_LOCK, offsetof(struct thread, t
 ASSYM(TF_SIZE, sizeof(struct trapframe));
 ASSYM(TF_SP, offsetof(struct trapframe, tf_sp));
 ASSYM(TF_ELR, offsetof(struct trapframe, tf_elr));
+ASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr));
 ASSYM(TF_X, offsetof(struct trapframe, tf_x));

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c	Tue Feb  7 17:40:59 2017	(r313395)
+++ head/sys/arm64/arm64/trap.c	Tue Feb  7 18:19:11 2017	(r313396)
@@ -257,7 +257,7 @@ print_registers(struct trapframe *frame)
 	printf("  sp: %16lx\n", frame->tf_sp);
 	printf("  lr: %16lx\n", frame->tf_lr);
 	printf(" elr: %16lx\n", frame->tf_elr);
-	printf("spsr: %16lx\n", frame->tf_spsr);
+	printf("spsr:         %8x\n", frame->tf_spsr);
 }
 
 void
@@ -267,7 +267,7 @@ do_el1h_sync(struct trapframe *frame)
 	uint64_t esr, far;
 
 	/* Read the esr register to get the exception details */
-	esr = READ_SPECIALREG(esr_el1);
+	esr = frame->tf_esr;
 	exception = ESR_ELx_EXCEPTION(esr);
 
 #ifdef KDTRACE_HOOKS
@@ -352,7 +352,7 @@ do_el0_sync(struct trapframe *frame)
 	td = curthread;
 	td->td_frame = frame;
 
-	esr = READ_SPECIALREG(esr_el1);
+	esr = frame->tf_esr;
 	exception = ESR_ELx_EXCEPTION(esr);
 	switch (exception) {
 	case EXCP_UNKNOWN:

Modified: head/sys/arm64/include/frame.h
==============================================================================
--- head/sys/arm64/include/frame.h	Tue Feb  7 17:40:59 2017	(r313395)
+++ head/sys/arm64/include/frame.h	Tue Feb  7 18:19:11 2017	(r313396)
@@ -45,7 +45,8 @@ struct trapframe {
 	uint64_t tf_sp;
 	uint64_t tf_lr;
 	uint64_t tf_elr;
-	uint64_t tf_spsr;
+	uint32_t tf_spsr;
+	uint32_t tf_esr;
 	uint64_t tf_x[30];
 };
 



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