diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 16:10:16 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 16:10:16 +0000 |
commit | b0aba4c46b14204f7de6471512136de7003877c4 (patch) | |
tree | c3128754275e49fb155f41a327d5938385395cb8 /c/src/exec/score/cpu/i386/i386.h | |
parent | Fixed spelling errors. (diff) | |
download | rtems-b0aba4c46b14204f7de6471512136de7003877c4.tar.bz2 |
Added swap of unsigned16
Diffstat (limited to 'c/src/exec/score/cpu/i386/i386.h')
-rw-r--r-- | c/src/exec/score/cpu/i386/i386.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/c/src/exec/score/cpu/i386/i386.h b/c/src/exec/score/cpu/i386/i386.h index 7f35a68ace..91c5294221 100644 --- a/c/src/exec/score/cpu/i386/i386.h +++ b/c/src/exec/score/cpu/i386/i386.h @@ -165,10 +165,26 @@ static inline unsigned int i386_swap_U32( unsigned int value ) { + unsigned long lout; + asm volatile( "rorw $8,%%ax;" "rorl $16,%0;" - "rorw $8,%%ax" : "=a" (value) : "0" (value) ); - return( value ); + "rorw $8,%%ax" : "=a" (lout) : "0" (value) ); +/* this should be better for i486dx and above */ +/* + __asm__ volatile( "bswap %0" : "=r" (lout) : "0" (lin)); +*/ + return( lout ); +} + +static inline unsigned int i386_swap_U16( + unsigned int value +) +{ + unsigned short sout; + + __asm__ volatile( "rorw $8,%0" : "=r" (sout) : "0" (value)); + return (sout); } /* @@ -439,6 +455,7 @@ void i386_Install_idt( #define get_gs() i386_get_gs() #define CPU_swap_u32( _value ) i386_swap_U32( _value ) +#define CPU_swap_u16( _value ) i386_swap_U16( _value ) /* i80x86 I/O instructions */ |