diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 18:18:13 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1998-04-27 18:18:13 +0000 |
commit | 0c508af979cae5bdfe01f433fd51efaad6708a08 (patch) | |
tree | e641d1d3910fdfaf8c0b88f92d7fd8c0e42b39ef /c/src/exec/score | |
parent | Added swap of unsigned16 (diff) | |
download | rtems-0c508af979cae5bdfe01f433fd51efaad6708a08.tar.bz2 |
Added I386_HAS_BSWAP cpu model feature flag so swap u32 could take
advantage of this instruction.
Also up conditionals mapping cpu models to feature flags by having a
section which defaults all the i386 family feature flags to the most
common value.
Diffstat (limited to 'c/src/exec/score')
-rw-r--r-- | c/src/exec/score/cpu/i386/i386.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/c/src/exec/score/cpu/i386/i386.h b/c/src/exec/score/cpu/i386/i386.h index 91c5294221..692c1538b7 100644 --- a/c/src/exec/score/cpu/i386/i386.h +++ b/c/src/exec/score/cpu/i386/i386.h @@ -36,25 +36,30 @@ extern "C" { * i486sx * pentium * - * Floating point is the only feature which currently varies. Eventually - * the i486-plus level instruction for endian swapping should be added - * to this feature list. + * CPU Model Feature Flags: + * + * I386_HAS_BSWAP: Defined to "1" if the instruction for endian swapping + * (bswap) should be used. This instruction appears to + * be present in all i486's and above. + * + * I386_HAS_FPU: Defined to "1" if the CPU has an FPU. + * */ #if defined(i386_fp) #define CPU_MODEL_NAME "i386 with i387" -#define I386_HAS_FPU 1 +#define I386_HAS_BSWAP 0 #elif defined(i386_nofp) #define CPU_MODEL_NAME "i386 w/o i387" -#define I386_HAS_FPU 0 +#define I386_HAS_FPU 0 +#define I386_HAS_BSWAP 0 #elif defined(i486dx) #define CPU_MODEL_NAME "i486dx" -#define I386_HAS_FPU 1 #elif defined(i486sx) @@ -64,7 +69,6 @@ extern "C" { #elif defined(pentium) #define CPU_MODEL_NAME "Pentium" -#define I386_HAS_FPU 1 #else @@ -73,6 +77,20 @@ extern "C" { #endif /* + * Set default values for CPU model feature flags + * + * NOTE: These settings are chosen to reflect most of the family members. + */ + +#ifndef I386_HAS_FPU +#define I386_HAS_FPU 1 +#endif + +#ifndef I386_HAS_BSWAP +#define I386_HAS_BSWAP 1 +#endif + +/* * Define the name of the CPU family. */ @@ -167,13 +185,13 @@ static inline unsigned int i386_swap_U32( { unsigned long lout; +#if (I386_HAS_BSWAP == 0) asm volatile( "rorw $8,%%ax;" "rorl $16,%0;" "rorw $8,%%ax" : "=a" (lout) : "0" (value) ); -/* this should be better for i486dx and above */ -/* +#else __asm__ volatile( "bswap %0" : "=r" (lout) : "0" (lin)); -*/ +#endif return( lout ); } |