summaryrefslogtreecommitdiffstats
path: root/sys/arm/include
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-15 15:40:05 +0000
committerian <ian@FreeBSD.org>2014-05-15 15:40:05 +0000
commitdcc5cc2e24c7d9e6e059f99797df7acb6c77633e (patch)
treed77df79e9c1ba2b26ad30c28e635a65b9edad155 /sys/arm/include
parentfc17b609325ddeec39fd53728652360e8f9148b9 (diff)
downloadFreeBSD-src-dcc5cc2e24c7d9e6e059f99797df7acb6c77633e.zip
FreeBSD-src-dcc5cc2e24c7d9e6e059f99797df7acb6c77633e.tar.gz
MFC r261137, r261393
Correct the alignment of sp through functions that use UNWINDSVCFRAME. Update all arm code that manipulates the PSR registers to use modern syntax.
Diffstat (limited to 'sys/arm/include')
-rw-r--r--sys/arm/include/asmacros.h27
-rw-r--r--sys/arm/include/atomic.h4
2 files changed, 18 insertions, 13 deletions
diff --git a/sys/arm/include/asmacros.h b/sys/arm/include/asmacros.h
index 0c107a4..ff92cc6 100644
--- a/sys/arm/include/asmacros.h
+++ b/sys/arm/include/asmacros.h
@@ -70,7 +70,7 @@
add r0, sp, #(4*13); /* Adjust the stack pointer */ \
stmia r0, {r13-r14}^; /* Push the user mode registers */ \
mov r0, r0; /* NOP for previous instruction */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
+ mrs r0, spsr; /* Put the SPSR on the stack */ \
str r0, [sp, #-4]!; \
ldr r0, =ARM_RAS_START; \
mov r1, #0; \
@@ -86,7 +86,7 @@
add r0, sp, #(4*13); /* Adjust the stack pointer */ \
stmia r0, {r13-r14}^; /* Push the user mode registers */ \
mov r0, r0; /* NOP for previous instruction */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
+ mrs r0, spsr; /* Put the SPSR on the stack */ \
str r0, [sp, #-4]!;
#endif
@@ -98,7 +98,7 @@
#ifdef ARM_TP_ADDRESS
#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 */ \
@@ -107,7 +107,7 @@
#else
#define PULLFRAME \
ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; \
+ msr spsr_fsxc, r0; \
clrex; \
ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \
mov r0, r0; /* NOP for previous instruction */ \
@@ -142,7 +142,7 @@
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-r12}; /* Push the user mode registers */ \
@@ -161,7 +161,7 @@
ldrne r1, [r0, #16]; /* adjust the saved PC so that */ \
cmpne r4, r1; /* execution later resumes at */ \
strhi r3, [r0, #16]; /* the RAS_START location. */ \
- mrs r0, spsr_all; \
+ mrs r0, spsr; \
str r0, [sp, #-4]!
#else
#define PUSHFRAMEINSVC \
@@ -179,14 +179,14 @@
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-r12}; /* Push the user mode registers */ \
add r0, sp, #(4*13); /* Adjust the stack pointer */ \
stmia r0, {r13-r14}^; /* Push the user mode registers */ \
mov r0, r0; /* NOP for previous instruction */ \
- mrs r0, spsr_all; /* Put the SPSR on the stack */ \
+ mrs r0, spsr; /* Put the SPSR on the stack */ \
str r0, [sp, #-4]!
#endif
@@ -200,7 +200,7 @@
#ifdef ARM_TP_ADDRESS
#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 */ \
@@ -208,7 +208,7 @@
#else
#define PULLFRAMEFROMSVCANDEXIT \
ldr r0, [sp], #0x0004; /* Get the SPSR from stack */ \
- msr spsr_all, r0; /* restore SPSR */ \
+ msr spsr_fsxc, r0; /* restore SPSR */ \
clrex; \
ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \
mov r0, r0; /* NOP for previous instruction */ \
@@ -216,8 +216,13 @@
ldmia sp, {sp, lr, pc}^ /* Restore lr and exit */
#endif
#if defined(__ARM_EABI__)
+/*
+ * Unwind hints so we can unwind past functions that use
+ * PULLFRAMEFROMSVCANDEXIT. They are run in reverse order.
+ * As the last thing we do is restore the stack pointer
+ * we can ignore the padding at the end of struct trapframe.
+ */
#define UNWINDSVCFRAME \
- .pad #(4); /* Skip stack alignment */ \
.save {r13-r15}; /* Restore sp, lr, pc */ \
.pad #(2*4); /* Skip user sp and lr */ \
.save {r0-r12}; /* Restore r0-r12 */ \
diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h
index 2bd08c1..4ac5a3f 100644
--- a/sys/arm/include/atomic.h
+++ b/sys/arm/include/atomic.h
@@ -450,13 +450,13 @@ atomic_store_rel_long(volatile u_long *p, u_long v)
__asm __volatile( \
"mrs %0, cpsr;" \
"orr %1, %0, %2;" \
- "msr cpsr_all, %1;" \
+ "msr cpsr_fsxc, %1;" \
: "=r" (cpsr_save), "=r" (tmp) \
: "I" (I32_bit | F32_bit) \
: "cc" ); \
(expr); \
__asm __volatile( \
- "msr cpsr_all, %0" \
+ "msr cpsr_fsxc, %0" \
: /* no output */ \
: "r" (cpsr_save) \
: "cc" ); \
OpenPOWER on IntegriCloud