diff options
-rw-r--r-- | cpukit/score/cpu/arm/ChangeLog | 4 | ||||
-rw-r--r-- | cpukit/score/cpu/arm/rtems/score/cpu.h | 30 |
2 files changed, 19 insertions, 15 deletions
diff --git a/cpukit/score/cpu/arm/ChangeLog b/cpukit/score/cpu/arm/ChangeLog index 39ff8d8f1e..19a4b591c8 100644 --- a/cpukit/score/cpu/arm/ChangeLog +++ b/cpukit/score/cpu/arm/ChangeLog @@ -1,3 +1,7 @@ +2002-10-04 Jay Monkman <jtm@smoothsmoothie.com> + + * rtems/score/cpu.h: Fix u16 and u32 swap routines. + 2002-08-05 Joel Sherrill <joel@OARcorp.com> * rtems/score/cpu.h, rtems/score/types.h: Updated to fix some typos. diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index d2f19e469d..1c4d3e82a6 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -897,27 +897,27 @@ static inline unsigned int CPU_swap_u32( unsigned int value ) { - unsigned32 tmp; - 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)); + unsigned32 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; } static inline unsigned16 CPU_swap_u16(unsigned16 value) { - unsigned32 tmp = value; /* make compiler warnings go away */ - asm volatile ("MOV %1, %0, LSR #8\n" \ - "BIC %0, %0, #0xff00\n" \ - "MOV %0, %0, LSL #8\n" \ - "ORR %0, %0, %1\n" \ - : "=&r" (value), "=&r" (tmp) \ - : "0" (value)); - return value; + unsigned16 lower; + unsigned16 upper; + + value = value & (unsigned16) 0xffff; + lower = (value >> 8) ; + upper = (value << 8) ; + + return (lower | upper); } #ifdef __cplusplus |