From 18e29faf9898a4011e042daaa75bc30a7b56ffdd Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 8 Jun 2016 10:10:40 +0200 Subject: score: Delete CPU_USE_GENERIC_BITFIELD_DATA Rename __log2table into _Bitfield_Leading_zeros since it acually returns the count of leading zeros of an 8-bit integer. The value for zero is a bit odd. Provide it unconditionally. --- cpukit/score/cpu/arm/rtems/score/cpu.h | 2 -- cpukit/score/cpu/bfin/rtems/score/cpu.h | 2 -- cpukit/score/cpu/epiphany/rtems/score/cpu.h | 2 -- cpukit/score/cpu/i386/rtems/score/cpu.h | 1 - cpukit/score/cpu/lm32/rtems/score/cpu.h | 2 -- cpukit/score/cpu/m32c/rtems/score/cpu.h | 2 -- cpukit/score/cpu/m68k/rtems/score/cpu.h | 1 - cpukit/score/cpu/mips/rtems/score/cpu.h | 2 -- cpukit/score/cpu/moxie/rtems/score/cpu.h | 2 -- cpukit/score/cpu/nios2/rtems/score/cpu.h | 2 -- cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h | 8 ++++---- cpukit/score/cpu/no_cpu/rtems/score/cpu.h | 10 ---------- cpukit/score/cpu/or1k/rtems/score/cpu.h | 2 -- cpukit/score/cpu/powerpc/rtems/score/cpu.h | 2 -- cpukit/score/cpu/sh/rtems/score/cpu.h | 2 -- cpukit/score/cpu/sparc/rtems/score/cpu.h | 6 ------ cpukit/score/cpu/sparc64/rtems/score/cpu.h | 1 - cpukit/score/cpu/v850/rtems/score/cpu.h | 2 -- cpukit/score/include/rtems/score/prioritybitmapimpl.h | 8 ++------ cpukit/score/src/log2table.c | 4 +--- 20 files changed, 7 insertions(+), 56 deletions(-) diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index 43805904e0..815cd9572c 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -200,8 +200,6 @@ #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - #define CPU_PER_CPU_CONTROL_SIZE 0 #define CPU_MAXIMUM_PROCESSORS 32 diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h b/cpukit/score/cpu/bfin/rtems/score/cpu.h index 1bff479b06..19b1f03fe2 100644 --- a/cpukit/score/cpu/bfin/rtems/score/cpu.h +++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h @@ -851,8 +851,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /** diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/rtems/score/cpu.h index c59e54f9f5..e1dae21e40 100644 --- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h +++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h @@ -680,8 +680,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - typedef struct { /* There is no CPU specific per-CPU state */ } CPU_Per_CPU_control; diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h b/cpukit/score/cpu/i386/rtems/score/cpu.h index 8f92b2eebd..3f0e3369f9 100644 --- a/cpukit/score/cpu/i386/rtems/score/cpu.h +++ b/cpukit/score/cpu/i386/rtems/score/cpu.h @@ -549,7 +549,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error) */ #define CPU_USE_GENERIC_BITFIELD_CODE FALSE -#define CPU_USE_GENERIC_BITFIELD_DATA FALSE #define _CPU_Bitfield_Find_first_bit( _value, _output ) \ { \ diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h b/cpukit/score/cpu/lm32/rtems/score/cpu.h index 325a8a4dd9..fe948aebf9 100644 --- a/cpukit/score/cpu/lm32/rtems/score/cpu.h +++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h @@ -883,8 +883,6 @@ extern char _gp[]; #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /** diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h b/cpukit/score/cpu/m32c/rtems/score/cpu.h index f980abc256..f56e9d7790 100644 --- a/cpukit/score/cpu/m32c/rtems/score/cpu.h +++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h @@ -871,8 +871,6 @@ void _CPU_Context_Restart_self( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /** diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h b/cpukit/score/cpu/m68k/rtems/score/cpu.h index 470391a027..a426647580 100644 --- a/cpukit/score/cpu/m68k/rtems/score/cpu.h +++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h @@ -491,7 +491,6 @@ void *_CPU_Thread_Idle_body( uintptr_t ignored ); */ #define CPU_USE_GENERIC_BITFIELD_CODE FALSE -#define CPU_USE_GENERIC_BITFIELD_DATA FALSE #if ( M68K_HAS_BFFFO != 1 ) /* diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h b/cpukit/score/cpu/mips/rtems/score/cpu.h index 6a0c36e90e..59150aceae 100644 --- a/cpukit/score/cpu/mips/rtems/score/cpu.h +++ b/cpukit/score/cpu/mips/rtems/score/cpu.h @@ -884,8 +884,6 @@ extern void mips_break( int error ); #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /* diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h b/cpukit/score/cpu/moxie/rtems/score/cpu.h index 5ba86734d9..3211c3b526 100644 --- a/cpukit/score/cpu/moxie/rtems/score/cpu.h +++ b/cpukit/score/cpu/moxie/rtems/score/cpu.h @@ -680,8 +680,6 @@ uint32_t _CPU_ISR_Get_level( void ); #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /* diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h b/cpukit/score/cpu/nios2/rtems/score/cpu.h index 0dd7ed4fab..4c56de0a16 100644 --- a/cpukit/score/cpu/nios2/rtems/score/cpu.h +++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h @@ -105,8 +105,6 @@ extern "C" { #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - #define CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK 0 #define CPU_PER_CPU_CONTROL_SIZE 0 diff --git a/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h b/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h index 0ec259aa0c..bf2390a51f 100644 --- a/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h +++ b/cpukit/score/cpu/nios2/rtems/score/nios2-count-zeros.h @@ -37,17 +37,17 @@ static inline unsigned _Nios2_Count_leading_zeros( uint32_t p ) if ( p <= 0xffffu ) { if ( p < 0x100u ) { - bitIdx = __log2table[ p ] + 24u; + bitIdx = _Bitfield_Leading_zeros[ p ] + 24u; } else { - bitIdx = __log2table[ p >> 8u ] + 16u; + bitIdx = _Bitfield_Leading_zeros[ p >> 8u ] + 16u; } } else { p >>= 16u; if ( p < 0x100u ) { - bitIdx = __log2table[ p ] + 8u; + bitIdx = _Bitfield_Leading_zeros[ p ] + 8u; } else { - bitIdx = __log2table[ p >> 8u ]; + bitIdx = _Bitfield_Leading_zeros[ p >> 8u ]; } } diff --git a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h index a56bc173e3..944f04ab0e 100644 --- a/cpukit/score/cpu/no_cpu/rtems/score/cpu.h +++ b/cpukit/score/cpu/no_cpu/rtems/score/cpu.h @@ -1011,16 +1011,6 @@ uint32_t _CPU_ISR_Get_level( void ); */ #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -/** - * This definition is set to TRUE if the port uses the data tables provided - * by the generic bitfield manipulation implementation. - * This can occur when actually using the generic bitfield manipulation - * implementation or when implementing the same algorithm in assembly - * language for improved performance. It is unlikely that a port will use - * the data if it has a bitfield scan instruction. - */ -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /** * This routine sets @a _output to the bit number of the first bit * set in @a _value. @a _value is of CPU dependent type diff --git a/cpukit/score/cpu/or1k/rtems/score/cpu.h b/cpukit/score/cpu/or1k/rtems/score/cpu.h index 919017b18c..c75d9d8bad 100644 --- a/cpukit/score/cpu/or1k/rtems/score/cpu.h +++ b/cpukit/score/cpu/or1k/rtems/score/cpu.h @@ -675,8 +675,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - typedef struct { /* There is no CPU specific per-CPU state */ } CPU_Per_CPU_control; diff --git a/cpukit/score/cpu/powerpc/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/rtems/score/cpu.h index 287f73d0ef..beb5127d8f 100644 --- a/cpukit/score/cpu/powerpc/rtems/score/cpu.h +++ b/cpukit/score/cpu/powerpc/rtems/score/cpu.h @@ -922,8 +922,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE FALSE -#define CPU_USE_GENERIC_BITFIELD_DATA FALSE - /* * This routine sets _output to the bit number of the first bit * set in _value. _value is of CPU dependent type Priority_bit_map_Word. diff --git a/cpukit/score/cpu/sh/rtems/score/cpu.h b/cpukit/score/cpu/sh/rtems/score/cpu.h index 8a1cc7f211..53c7eb5f77 100644 --- a/cpukit/score/cpu/sh/rtems/score/cpu.h +++ b/cpukit/score/cpu/sh/rtems/score/cpu.h @@ -652,8 +652,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /* diff --git a/cpukit/score/cpu/sparc/rtems/score/cpu.h b/cpukit/score/cpu/sparc/rtems/score/cpu.h index 96b6ac5265..ea90e36752 100644 --- a/cpukit/score/cpu/sparc/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc/rtems/score/cpu.h @@ -1113,12 +1113,6 @@ extern void _CPU_Fatal_halt(uint32_t source, uint32_t error) * CPU model does not have a scan instruction. */ #define CPU_USE_GENERIC_BITFIELD_CODE TRUE - /** - * The SPARC port uses the generic C algorithm for bitfield scan if the - * CPU model does not have a scan instruction. Thus is needs the generic - * data table used by that algorithm. - */ - #define CPU_USE_GENERIC_BITFIELD_DATA TRUE #else #error "scan instruction not currently supported by RTEMS!!" #endif diff --git a/cpukit/score/cpu/sparc64/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/rtems/score/cpu.h index a669c54436..d2fc81fd45 100644 --- a/cpukit/score/cpu/sparc64/rtems/score/cpu.h +++ b/cpukit/score/cpu/sparc64/rtems/score/cpu.h @@ -891,7 +891,6 @@ void _CPU_Context_Initialize( #if ( SPARC_HAS_BITSCAN == 0 ) #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE #else #error "scan instruction not currently supported by RTEMS!!" #endif diff --git a/cpukit/score/cpu/v850/rtems/score/cpu.h b/cpukit/score/cpu/v850/rtems/score/cpu.h index ffbb51008b..de655c0f8c 100644 --- a/cpukit/score/cpu/v850/rtems/score/cpu.h +++ b/cpukit/score/cpu/v850/rtems/score/cpu.h @@ -835,8 +835,6 @@ void _CPU_Context_Initialize( #define CPU_USE_GENERIC_BITFIELD_CODE TRUE -#define CPU_USE_GENERIC_BITFIELD_DATA TRUE - /* functions */ /** diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h index de90ef77ae..492dbd398c 100644 --- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h +++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h @@ -33,16 +33,12 @@ extern "C" { */ /**@{**/ -#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE ) - /** * This table is used by the generic bitfield routines to perform * a highly optimized bit scan without the use of special CPU * instructions. */ -extern const unsigned char __log2table[256]; - -#endif +extern const unsigned char _Bitfield_Leading_zeros[256]; /** * @brief Gets the @a _bit_number of the first bit set in the specified value. @@ -70,7 +66,7 @@ extern const unsigned char __log2table[256]; #define _Bitfield_Find_first_bit( _value, _bit_number ) \ { \ register uint32_t __value = (uint32_t) (_value); \ - register const unsigned char *__p = __log2table; \ + register const unsigned char *__p = _Bitfield_Leading_zeros; \ \ if ( __value < 0x100 ) \ (_bit_number) = (Priority_bit_map_Word)( __p[ __value ] + 8 ); \ diff --git a/cpukit/score/src/log2table.c b/cpukit/score/src/log2table.c index f81f82154e..19a9c8a446 100644 --- a/cpukit/score/src/log2table.c +++ b/cpukit/score/src/log2table.c @@ -21,8 +21,7 @@ #include -#if ( CPU_USE_GENERIC_BITFIELD_DATA == TRUE ) -const unsigned char __log2table[256] = { +const unsigned char _Bitfield_Leading_zeros[256] = { 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -40,4 +39,3 @@ const unsigned char __log2table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#endif -- cgit v1.2.3