Skip to content

Commit

Permalink
x86: clean up cpu capabilities accesses
Browse files Browse the repository at this point in the history
introduce test_cpu_cap() for raw access to the real CPU
capabilities as they are present in x86_capability.

(cpu_has() will shortcut certain tests during build-time)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Apr 17, 2008
1 parent d32de19 commit 0f8d2b9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/asm-x86/cpufeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
extern const char * const x86_cap_flags[NCAPINTS*32];
extern const char * const x86_power_flags[32];

#define test_cpu_cap(c, bit) \
test_bit(bit, (unsigned long *)((c)->x86_capability))

#define cpu_has(c, bit) \
(__builtin_constant_p(bit) && \
( (((bit)>>5)==0 && (1UL<<((bit)&31) & REQUIRED_MASK0)) || \
Expand All @@ -131,7 +134,8 @@ extern const char * const x86_power_flags[32];
(((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
(((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \
? 1 : \
test_bit(bit, (unsigned long *)((c)->x86_capability)))
test_cpu_cap(c, bit))

#define boot_cpu_has(bit) cpu_has(&boot_cpu_data, bit)

#define set_cpu_cap(c, bit) set_bit(bit, (unsigned long *)((c)->x86_capability))
Expand Down

0 comments on commit 0f8d2b9

Please sign in to comment.