23 #ifndef _RTEMS_SCORE_PROCESSORMASK_H 24 #define _RTEMS_SCORE_PROCESSORMASK_H 28 #include <sys/cpuset.h> 54 typedef BITSET_DEFINE( Processor_mask, CPU_MAXIMUM_PROCESSORS ) Processor_mask;
63 BIT_ZERO( CPU_MAXIMUM_PROCESSORS, mask );
76 return BIT_EMPTY( CPU_MAXIMUM_PROCESSORS, mask );
86 BIT_FILL( CPU_MAXIMUM_PROCESSORS, mask );
96 Processor_mask *dst,
const Processor_mask *src
99 BIT_COPY( CPU_MAXIMUM_PROCESSORS, src, dst );
109 Processor_mask *mask,
113 BIT_SET( CPU_MAXIMUM_PROCESSORS, index, mask );
123 Processor_mask *mask,
127 BIT_CLR( CPU_MAXIMUM_PROCESSORS, index, mask );
140 const Processor_mask *mask,
144 return BIT_ISSET( CPU_MAXIMUM_PROCESSORS, index, mask );
157 const Processor_mask *a,
158 const Processor_mask *b
161 return !BIT_CMP( CPU_MAXIMUM_PROCESSORS, a, b );
175 const Processor_mask *a,
176 const Processor_mask *b
179 return BIT_OVERLAP( CPU_MAXIMUM_PROCESSORS, a, b );
193 const Processor_mask *big,
194 const Processor_mask *small
197 return BIT_SUBSET( CPU_MAXIMUM_PROCESSORS, big, small );
209 const Processor_mask *b,
210 const Processor_mask *c
213 BIT_AND2( CPU_MAXIMUM_PROCESSORS, a, b, c );
225 const Processor_mask *b,
226 const Processor_mask *c
229 BIT_NAND2( CPU_MAXIMUM_PROCESSORS, a, b, c );
241 const Processor_mask *b,
242 const Processor_mask *c
245 BIT_OR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
257 const Processor_mask *b,
258 const Processor_mask *c
261 BIT_XOR2( CPU_MAXIMUM_PROCESSORS, a, b, c );
273 return (uint32_t) BIT_COUNT( CPU_MAXIMUM_PROCESSORS, a );
285 return (uint32_t) BIT_FLS( CPU_MAXIMUM_PROCESSORS, a );
298 const Processor_mask *mask,
302 long bits = mask->__bits[ __bitset_words( index ) ];
304 return (uint32_t) (bits >> (32 * (index % _BITSET_BITS) / 32));
316 Processor_mask *mask,
322 mask->__bits[ __bitset_words( index ) ] = ((long) bits) << (32 * (index % _BITSET_BITS) / 32);
332 Processor_mask *mask,
336 BIT_SETOF( CPU_MAXIMUM_PROCESSORS, (
int) index, mask );
340 PROCESSOR_MASK_COPY_LOSSLESS,
341 PROCESSOR_MASK_COPY_PARTIAL_LOSS,
342 PROCESSOR_MASK_COPY_COMPLETE_LOSS,
343 PROCESSOR_MASK_COPY_INVALID_SIZE
344 } Processor_mask_Copy_status;
355 Processor_mask_Copy_status status
358 return (
unsigned int) status <= PROCESSOR_MASK_COPY_PARTIAL_LOSS;
402 const Processor_mask *src,
445 extern const Processor_mask _Processor_mask_The_one_and_only;
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_at_most_partial_loss(Processor_mask_Copy_status status)
Checks if the copy status guarantees at most partial loss.
RTEMS_INLINE_ROUTINE Processor_mask_Copy_status _Processor_mask_From_cpu_set_t(Processor_mask *dst, size_t src_size, const cpu_set_t *src)
Copies one mask to another.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_zero(const Processor_mask *mask)
Checks if the mask is zero, also considers CPU_MAXIMUM_PROCESSORS.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_equal(const Processor_mask *a, const Processor_mask *b)
Checks if the processor sets a and b are equal.
RTEMS_INLINE_ROUTINE void _Processor_mask_Or(Processor_mask *a, const Processor_mask *b, const Processor_mask *c)
Performs a bitwise a = b | c.
RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_Count(const Processor_mask *a)
Gets the number of set bits in the processor mask.
RTEMS_INLINE_ROUTINE void _Processor_mask_Clear(Processor_mask *mask, uint32_t index)
Clears the specified index bit of the mask.
RTEMS_INLINE_ROUTINE Processor_mask_Copy_status _Processor_mask_To_cpu_set_t(const Processor_mask *src, size_t dst_size, cpu_set_t *dst)
Copies one mask to another.
RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_To_uint32_t(const Processor_mask *mask, uint32_t index)
Returns the subset of 32 processors containing the specified index as an unsigned 32-bit integer...
RTEMS_INLINE_ROUTINE uint32_t _Processor_mask_Find_last_set(const Processor_mask *a)
Finds the last set of the processor mask.
Processor_mask_Copy_status _Processor_mask_Copy(long *dst, size_t dst_size, const long *src, size_t src_size)
Copies one mask to another.
typedef BITSET_DEFINE(Processor_mask, CPU_MAXIMUM_PROCESSORS) Processor_mask
A bit map which is large enough to provide one bit for each processor in the system.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Has_overlap(const Processor_mask *a, const Processor_mask *b)
Checks if the intersection of the processor sets a and b is non-empty.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_set(const Processor_mask *mask, uint32_t index)
Checks if the specified index bit of the mask is set.
RTEMS_INLINE_ROUTINE void _Processor_mask_Xor(Processor_mask *a, const Processor_mask *b, const Processor_mask *c)
Performs a bitwise a = b ^ c.
RTEMS_INLINE_ROUTINE void _Processor_mask_Zero(Processor_mask *mask)
Sets the bits of the mask to zero, also considers CPU_MAXIMUM_PROCESSORS.
RTEMS_INLINE_ROUTINE void _Processor_mask_And(Processor_mask *a, const Processor_mask *b, const Processor_mask *c)
Performs a bitwise a = b & c.
RTEMS_INLINE_ROUTINE void _Processor_mask_Nand(Processor_mask *a, const Processor_mask *b, const Processor_mask *c)
Performs a bitwise a = b & ~c.
RTEMS_INLINE_ROUTINE void _Processor_mask_From_uint32_t(Processor_mask *mask, uint32_t bits, uint32_t index)
Creates a processor set from an unsigned 32-bit integer relative to the specified index...
RTEMS_INLINE_ROUTINE void _Processor_mask_From_index(Processor_mask *mask, uint32_t index)
Creates a processor set from the specified index.
SPARC CPU Department Source.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_subset(const Processor_mask *big, const Processor_mask *small)
Checks if the processor set small is a subset of processor set big.
RTEMS_INLINE_ROUTINE void _Processor_mask_Assign(Processor_mask *dst, const Processor_mask *src)
Copies the mask to another mask, also considers CPU_MAXIMUM_PROCESSORS.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
RTEMS_INLINE_ROUTINE void _Processor_mask_Fill(Processor_mask *mask)
Fills the mask, also considers CPU_MAXIMUM_PROCESSORS.
RTEMS_INLINE_ROUTINE void _Processor_mask_Set(Processor_mask *mask, uint32_t index)
Sets the specified index bit of the mask.