diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-05-23 09:04:19 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-05-27 12:49:13 +0200 |
commit | 18e1e5bbf11e637c7aa40ac12e4e9bd109df677b (patch) | |
tree | d2ac9617407fff20c60ce11b26d849d25d5f427c /cpukit/score/cpu/arm/arm_exc_interrupt.S | |
parent | dosfs: Add RTEMS_DOSFS_SEMAPHORES_PER_INSTANCE (diff) | |
download | rtems-18e1e5bbf11e637c7aa40ac12e4e9bd109df677b.tar.bz2 |
arm: Fix CPSR and SPSR access
The GNU assembler translates for example a
msr spsr, rN
into
msr SPSR_fc, rN
This would update only a subset of the register and leads to an
incomplete exceptions restore sequence resulting in system corruption.
Correct is this:
msr SPSR_fsxc, rN
Diffstat (limited to 'cpukit/score/cpu/arm/arm_exc_interrupt.S')
-rw-r--r-- | cpukit/score/cpu/arm/arm_exc_interrupt.S | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cpukit/score/cpu/arm/arm_exc_interrupt.S b/cpukit/score/cpu/arm/arm_exc_interrupt.S index a1363e571e..708af229f1 100644 --- a/cpukit/score/cpu/arm/arm_exc_interrupt.S +++ b/cpukit/score/cpu/arm/arm_exc_interrupt.S @@ -63,13 +63,13 @@ _ARMV4_Exception_interrupt: /* Set exchange registers */ mov EXCHANGE_LR, lr - mrs EXCHANGE_SPSR, spsr - mrs EXCHANGE_CPSR, cpsr + mrs EXCHANGE_SPSR, SPSR + mrs EXCHANGE_CPSR, CPSR sub EXCHANGE_INT_SP, sp, #EXCHANGE_SIZE /* Switch to SVC mode */ orr EXCHANGE_CPSR, EXCHANGE_CPSR, #0x1 - msr cpsr, EXCHANGE_CPSR + msr CPSR_c, EXCHANGE_CPSR /* * Save context. We save the LR separately because it has to be @@ -183,11 +183,11 @@ thread_dispatch_done: add sp, #CONTEXT_SIZE /* Get INT mode program status register */ - mrs r1, cpsr + mrs r1, CPSR bic r1, r1, #0x1 /* Switch to INT mode */ - msr cpsr, r1 + msr CPSR_c, r1 /* Save EXCHANGE_LR and EXCHANGE_SPSR registers to exchange area */ stmdb sp!, {EXCHANGE_LR, EXCHANGE_SPSR} @@ -197,7 +197,7 @@ thread_dispatch_done: /* Set return address and program status */ mov lr, EXCHANGE_LR - msr spsr, EXCHANGE_SPSR + msr SPSR_fsxc, EXCHANGE_SPSR /* Restore EXCHANGE_LR and EXCHANGE_SPSR registers from exchange area */ ldmia sp!, {EXCHANGE_LR, EXCHANGE_SPSR} |