From e0f60887e5257844e5f4f081794c37ea68b87326 Mon Sep 17 00:00:00 2001 From: Jay Monkman Date: Thu, 15 Sep 2005 18:44:19 +0000 Subject: 2005-09-15 Jay Monkman PR 365/rtems * rtems/score/arm.h, rtems/score/cpu.h: Removed unused ARM_HAS_CLZ macro --- cpukit/score/cpu/arm/rtems/score/arm.h | 6 -- cpukit/score/cpu/arm/rtems/score/cpu.h | 101 +++------------------------------ 2 files changed, 8 insertions(+), 99 deletions(-) (limited to 'cpukit/score/cpu/arm/rtems') diff --git a/cpukit/score/cpu/arm/rtems/score/arm.h b/cpukit/score/cpu/arm/rtems/score/arm.h index ce2e9dfb51..e9a21baf7c 100644 --- a/cpukit/score/cpu/arm/rtems/score/arm.h +++ b/cpukit/score/cpu/arm/rtems/score/arm.h @@ -34,27 +34,21 @@ extern "C" { */ #if defined(__ARM_ARCH_4__) # define CPU_MODEL_NAME "ARMv4" -# define ARM_HAS_CLZ 0 #elif defined(__ARM_ARCH_4T__) # define CPU_MODEL_NAME "ARMv4T" -# define ARM_HAS_CLZ 0 #elif defined(__ARM_ARCH_5__) # define CPU_MODEL_NAME "ARMv5" -# define ARM_HAS_CLZ 1 #elif defined(__ARM_ARCH_5T__) # define CPU_MODEL_NAME "ARMv5T" -# define ARM_HAS_CLZ 1 #elif defined(__ARM_ARCH_5E__) # define CPU_MODEL_NAME "ARMv5E" -# define ARM_HAS_CLZ 1 #elif defined(__ARM_ARCH_5TE__) # define CPU_MODEL_NAME "ARMv5TE" -# define ARM_HAS_CLZ 1 #else # error "Unsupported CPU Model" diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h b/cpukit/score/cpu/arm/rtems/score/cpu.h index 5ccc1d77da..68c6b291f5 100644 --- a/cpukit/score/cpu/arm/rtems/score/cpu.h +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h @@ -685,101 +685,16 @@ void _CPU_Context_Initialize( /* end of Fatal Error manager macros */ /* Bitfield handler macros */ - -/* - * This routine sets _output to the bit number of the first bit - * set in _value. _value is of CPU dependent type Priority_Bit_map_control. - * This type may be either 16 or 32 bits wide although only the 16 - * least significant bits will be used. - * - * There are a number of variables in using a "find first bit" type - * instruction. - * - * (1) What happens when run on a value of zero? - * (2) Bits may be numbered from MSB to LSB or vice-versa. - * (3) The numbering may be zero or one based. - * (4) The "find first bit" instruction may search from MSB or LSB. - * - * RTEMS guarantees that (1) will never happen so it is not a concern. - * (2),(3), (4) are handled by the macros _CPU_Priority_mask() and - * _CPU_Priority_bits_index(). These three form a set of routines - * which must logically operate together. Bits in the _value are - * set and cleared based on masks built by _CPU_Priority_mask(). - * The basic major and minor values calculated by _Priority_Major() - * and _Priority_Minor() are "massaged" by _CPU_Priority_bits_index() - * to properly range between the values returned by the "find first bit" - * instruction. This makes it possible for _Priority_Get_highest() to - * calculate the major and directly index into the minor table. - * This mapping is necessary to ensure that 0 (a high priority major/minor) - * is the first bit found. - * - * This entire "find first bit" and mapping process depends heavily - * on the manner in which a priority is broken into a major and minor - * components with the major being the 4 MSB of a priority and minor - * the 4 LSB. Thus (0 << 4) + 0 corresponds to priority 0 -- the highest - * priority. And (15 << 4) + 14 corresponds to priority 254 -- the next - * to the lowest priority. - * - * If your CPU does not have a "find first bit" instruction, then - * there are ways to make do without it. Here are a handful of ways - * to implement this in software: +/* + * If we had a particularly fast function for finding the first + * bit set in a word, it would go here. Since we don't (*), we'll + * just use the universal macros. * - * - a series of 16 bit test instructions - * - a "binary search using if's" - * - _number = 0 - * if _value > 0x00ff - * _value >>=8 - * _number = 8; - * - * if _value > 0x0000f - * _value >=8 - * _number += 4 - * - * _number += bit_set_table[ _value ] - * - * where bit_set_table[ 16 ] has values which indicate the first - * bit set - */ -#if (ARM_HAS_CLZ == 0) -# define CPU_USE_GENERIC_BITFIELD_CODE TRUE -# define CPU_USE_GENERIC_BITFIELD_DATA TRUE -#else -# define CPU_USE_GENERIC_BITFIELD_CODE FALSE -# define CPU_USE_GENERIC_BITFIELD_DATA FALSE - -# define _CPU_Bitfield_Find_first_bit( _value, _output ) \ - { \ - (_output) = 0; /* do something to prevent warnings */ \ - } - -/* end of Bitfield handler macros */ - -/* - * This routine builds the mask which corresponds to the bit fields - * as searched by _CPU_Bitfield_Find_first_bit(). See the discussion - * for that routine. + * (*) On ARM V5 and later, there's a CLZ function which could be + * used to implement much quicker than the default macro. */ - - -# define _CPU_Priority_Mask( _bit_number ) \ - ( 1 << (_bit_number) ) - - -/* - * This routine translates the bit numbers returned by - * _CPU_Bitfield_Find_first_bit() into something suitable for use as - * a major or minor component of a priority. See the discussion - * for that routine. - */ - - -# define _CPU_Priority_bits_index( _priority ) \ - (_priority) - -# error "Implement CLZ version of priority bit functions for ARMv5" -#endif - -/* end of Priority handler macros */ +#define CPU_USE_GENERIC_BITFIELD_CODE TRUE +#define CPU_USE_GENERIC_BITFIELD_DATA TRUE /* functions */ -- cgit v1.2.3