svn commit: r269310 - in projects/arm64/sys/arm64: arm64 include

Andrew Turner andrew at FreeBSD.org
Wed Jul 30 17:37:46 UTC 2014


Author: andrew
Date: Wed Jul 30 17:37:45 2014
New Revision: 269310
URL: http://svnweb.freebsd.org/changeset/base/269310

Log:
  Store and restore the frame around exceptions

Modified:
  projects/arm64/sys/arm64/arm64/exception.S
  projects/arm64/sys/arm64/include/cpu.h
  projects/arm64/sys/arm64/include/frame.h

Modified: projects/arm64/sys/arm64/arm64/exception.S
==============================================================================
--- projects/arm64/sys/arm64/arm64/exception.S	Wed Jul 30 17:19:11 2014	(r269309)
+++ projects/arm64/sys/arm64/arm64/exception.S	Wed Jul 30 17:37:45 2014	(r269310)
@@ -50,6 +50,59 @@ sintrcnt:
 	mov	x1, 0x1c090000; \
 	str	x0, [x1];
 
+.macro	save_registers
+	stp	x28, x29, [sp, #-16]!
+	stp	x26, x27, [sp, #-16]!
+	stp	x24, x25, [sp, #-16]!
+	stp	x22, x23, [sp, #-16]!
+	stp	x20, x21, [sp, #-16]!
+	stp	x18, x19, [sp, #-16]!
+	stp	x16, x17, [sp, #-16]!
+	stp	x14, x15, [sp, #-16]!
+	stp	x12, x13, [sp, #-16]!
+	stp	x10, x11, [sp, #-16]!
+	stp	x8, x9, [sp, #-16]!
+	stp	x6, x7, [sp, #-16]!
+	stp	x4, x5, [sp, #-16]!
+	stp	x2, x3, [sp, #-16]!
+	stp	x0, x1, [sp, #-16]!
+	mrs	x10, elr_el1
+	mrs	x11, spsr_el1
+	mov	x12, sp
+	stp	x10, x11, [sp, #-16]!
+	stp	x12, lr, [sp, #-16]!
+.endm
+
+.macro	restore_registers
+	ldp	x12, lr, [sp], #16
+	ldp	x10, x11, [sp], #16
+	mov	sp, x12
+	msr	spsr_el1, x11
+	msr	elr_el1, x10
+	ldp	x0, x1, [sp], #16
+	ldp	x2, x3, [sp], #16
+	ldp	x4, x5, [sp], #16
+	ldp	x6, x7, [sp], #16
+	ldp	x8, x9, [sp], #16
+	ldp	x10, x11, [sp], #16
+	ldp	x12, x13, [sp], #16
+	ldp	x14, x15, [sp], #16
+	ldp	x16, x17, [sp], #16
+	ldp	x18, x19, [sp], #16
+	ldp	x20, x21, [sp], #16
+	ldp	x22, x23, [sp], #16
+	ldp	x24, x25, [sp], #16
+	ldp	x26, x27, [sp], #16
+	ldp	x28, x29, [sp], #16
+.endm
+
+handle_el1h_sync:
+	save_registers
+	mov	x0, sp
+	bl	do_el1h_sync
+	restore_registers
+	eret
+
 .macro	vempty
 	.align 7
 	EMIT('Z');
@@ -58,8 +111,7 @@ sintrcnt:
 
 .macro	el1h_sync
 	.align 7
-	EMIT('B');
-	1: b	1b
+	b	handle_el1h_sync
 .endm
 
 .macro	el1h_error

Modified: projects/arm64/sys/arm64/include/cpu.h
==============================================================================
--- projects/arm64/sys/arm64/include/cpu.h	Wed Jul 30 17:19:11 2014	(r269309)
+++ projects/arm64/sys/arm64/include/cpu.h	Wed Jul 30 17:37:45 2014	(r269310)
@@ -39,7 +39,7 @@
 
 #include <machine/frame.h>
 
-#define	TRAPF_PC(tfp)		((tfp)->tf_pc)
+#define	TRAPF_PC(tfp)		((tfp)->tf_lr)
 #define	TRAPF_USERMODE(tfp)	(0) /* TODO: Fix */
 
 #define	cpu_getstack(td)	((td)->td_frame->tf_sp)

Modified: projects/arm64/sys/arm64/include/frame.h
==============================================================================
--- projects/arm64/sys/arm64/include/frame.h	Wed Jul 30 17:19:11 2014	(r269309)
+++ projects/arm64/sys/arm64/include/frame.h	Wed Jul 30 17:37:45 2014	(r269310)
@@ -35,10 +35,11 @@
  * NOTE: keep this structure in sync with struct reg and struct mcontext.
  */
 struct trapframe {
-	uint64_t tf_x[31];
 	uint64_t tf_sp;
-	uint64_t tf_pc;
+	uint64_t tf_lr;
+	uint64_t tf_elr;
 	uint64_t tf_spsr;
+	uint64_t tf_x[30];
 };
 
 /*


More information about the svn-src-projects mailing list