forked from Imagelibrary/rtems
2007-12-11 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/score/cpu.h: Temporarily use C implementation of swap u32 for thumb mode.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user