summaryrefslogtreecommitdiffstats
path: root/sys/arm64
diff options
context:
space:
mode:
authorandrew <andrew@FreeBSD.org>2017-05-30 13:02:10 +0000
committerandrew <andrew@FreeBSD.org>2017-05-30 13:02:10 +0000
commitf354de911172b86d13bfda0df1c76729f9609fd2 (patch)
tree137721053ad961b5e3ab8ff2fe28f74532c4f915 /sys/arm64
parentedb010ea9cd5ce05e055474ade71fb8687a74eb6 (diff)
downloadFreeBSD-src-f354de911172b86d13bfda0df1c76729f9609fd2.zip
FreeBSD-src-f354de911172b86d13bfda0df1c76729f9609fd2.tar.gz
MFC r313396:
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.
Diffstat (limited to 'sys/arm64')
-rw-r--r--sys/arm64/arm64/exception.S4
-rw-r--r--sys/arm64/arm64/genassym.c1
-rw-r--r--sys/arm64/arm64/trap.c6
-rw-r--r--sys/arm64/include/frame.h3
4 files changed, 9 insertions, 5 deletions
diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S
index 63aa04c..432c4d4 100644
--- a/sys/arm64/arm64/exception.S
+++ b/sys/arm64/arm64/exception.S
@@ -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)
diff --git a/sys/arm64/arm64/genassym.c b/sys/arm64/arm64/genassym.c
index 36ad877..8d75ffa 100644
--- a/sys/arm64/arm64/genassym.c
+++ b/sys/arm64/arm64/genassym.c
@@ -62,4 +62,5 @@ ASSYM(TD_LOCK, offsetof(struct thread, td_lock));
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));
diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c
index 33002f7..5f2d7e6 100644
--- a/sys/arm64/arm64/trap.c
+++ b/sys/arm64/arm64/trap.c
@@ -254,7 +254,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
@@ -264,7 +264,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
@@ -341,7 +341,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:
diff --git a/sys/arm64/include/frame.h b/sys/arm64/include/frame.h
index 6d43e13..198ae69 100644
--- a/sys/arm64/include/frame.h
+++ b/sys/arm64/include/frame.h
@@ -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];
};
OpenPOWER on IntegriCloud