summaryrefslogtreecommitdiff
path: root/sys/arch/arm
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2015-01-18 16:26:40 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2015-01-18 16:26:40 +0000
commitbf72daf8f50bce3f472e6340ab1ab037497f0f07 (patch)
treeddaf64e49e2ed2041965be96be3fc871cc8aff6a /sys/arch/arm
parentae67cc0fa8453ee1955ed68cb3daa814b9898977 (diff)
When restoring spsr values when handling traps use spsr_fsxc instead
of spsr_all so all the bits are restored. Using the msr instruction with spsr_all is treated the same as spsr_fc and does not include the status and extension fields (bits 23:8). This fixes the problem of some i.MX6 machines powering up with the big endian bit set in the extension field causing them to crash on returning from the first interrupt. From NetBSD.
Diffstat (limited to 'sys/arch/arm')
-rw-r--r--sys/arch/arm/include/frame.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/arm/include/frame.h b/sys/arch/arm/include/frame.h
index e55378f802a..9f2adffef58 100644
--- a/sys/arch/arm/include/frame.h
+++ b/sys/arch/arm/include/frame.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: frame.h,v 1.5 2015/01/18 12:03:11 jsg Exp $ */
+/* $OpenBSD: frame.h,v 1.6 2015/01/18 16:26:39 jsg Exp $ */
/* $NetBSD: frame.h,v 1.9 2003/12/01 08:48:33 scw Exp $ */
/*
@@ -217,7 +217,7 @@ struct frame {
#define PULLFRAME \
ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
+ msr spsr_fsxc, r0; \
ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \
mov r0, r0; /* NOP for previous instruction */ \
add sp, sp, #(4*17); /* Adjust the stack pointer */ \
@@ -244,7 +244,7 @@ struct frame {
str r0, [sp, #-4]!; /* Push return address */ \
str lr, [sp, #-4]!; /* Push SVC lr */ \
str r2, [sp, #-4]!; /* Push SVC sp */ \
- msr spsr_all, r3; /* Restore correct spsr */ \
+ msr spsr_fsxc, r3; /* Restore correct spsr */ \
ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \
sub sp, sp, #(4*15); /* Adjust the stack pointer */ \
stmia sp, {r0-r14}^; /* Push the user mode registers */ \
@@ -261,7 +261,7 @@ struct frame {
#define PULLFRAMEFROMSVCANDEXIT \
ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; /* restore SPSR */ \
+ msr spsr_fsxc, r0; /* restore SPSR */ \
ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \
mov r0, r0; /* NOP for previous instruction */ \
add sp, sp, #(4*15); /* Adjust the stack pointer */ \