summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-11 22:54:18 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-12-11 22:54:18 +0000
commit1c62f169876f57f315a37c0b4e92a9672df74b22 (patch)
tree528e04c44f9c57bc6a82650df5ca95ff3e2d8bf0 /cpukit/score/cpu
parent2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-1c62f169876f57f315a37c0b4e92a9672df74b22.tar.bz2
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/score/cpu.h: Temporarily use C implementation of swap u32 for thumb mode.
Diffstat (limited to 'cpukit/score/cpu')
-rw-r--r--cpukit/score/cpu/arm/ChangeLog5
-rw-r--r--cpukit/score/cpu/arm/rtems/score/cpu.h29
2 files changed, 25 insertions, 9 deletions
diff --git a/cpukit/score/cpu/arm/ChangeLog b/cpukit/score/cpu/arm/ChangeLog
index e1a57544b5..0d7c5c2fdb 100644
--- a/cpukit/score/cpu/arm/ChangeLog
+++ b/cpukit/score/cpu/arm/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
+
+ * rtems/score/cpu.h: Temporarily use C implementation of swap u32 for
+ thumb mode.
+
2007-12-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* cpu.c, rtems/score/cpu.h: Move interrupt_stack_size field from CPU
diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h
index 30d2504e4b..0c3da70d18 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -805,15 +805,26 @@ static inline uint32_t CPU_swap_u32(
uint32_t value
)
{
- uint32_t tmp = value; /* make compiler warnings go away */
- asm volatile ("EOR %1, %0, %0, ROR #16\n"
- "BIC %1, %1, #0xff0000\n"
- "MOV %0, %0, ROR #8\n"
- "EOR %0, %0, %1, LSR #8\n"
- : "=r" (value), "=r" (tmp)
- : "0" (value), "1" (tmp));
-
- return value;
+#if defined(__thumb__)
+ uint32_t byte1, byte2, byte3, byte4, swapped;
+
+ byte4 = (value >> 24) & 0xff;
+ byte3 = (value >> 16) & 0xff;
+ byte2 = (value >> 8) & 0xff;
+ byte1 = value & 0xff;
+
+ swapped = (byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4;
+ return swapped;
+#else
+ uint32_t tmp = value; /* make compiler warnings go away */
+ asm volatile ("EOR %1, %0, %0, ROR #16\n"
+ "BIC %1, %1, #0xff0000\n"
+ "MOV %0, %0, ROR #8\n"
+ "EOR %0, %0, %1, LSR #8\n"
+ : "=r" (value), "=r" (tmp)
+ : "0" (value), "1" (tmp));
+ return value;
+#endif
}
static inline uint16_t CPU_swap_u16(uint16_t value)