From d0647cde615a7eac404d44da26c6ec93789faed8 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 16 Jul 2008 15:39:40 -0700 Subject: [PATCH] cpuid.h: add __constfunc Add __constfunc to CPUID calls, so gcc knows it can CSE them. Signed-off-by: H. Peter Anvin --- com32/include/cpuid.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/com32/include/cpuid.h b/com32/include/cpuid.h index b7c7594..67c28fe 100644 --- a/com32/include/cpuid.h +++ b/com32/include/cpuid.h @@ -31,6 +31,7 @@ #include #include #include +#include #define PAGE_SIZE 4096 @@ -126,7 +127,7 @@ typedef struct { #define X86_VENDOR_NUM 9 #define X86_VENDOR_UNKNOWN 0xff -static inline bool test_bit(int nr, const uint32_t *addr) +static inline __purefunc bool test_bit(int nr, const uint32_t *addr) { return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0; } @@ -204,7 +205,7 @@ static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, : "0" (op), "c"(0)); } -static inline unsigned int cpuid_eax(unsigned int op) +static inline __constfunc unsigned int cpuid_eax(unsigned int op) { unsigned int eax; @@ -215,7 +216,7 @@ static inline unsigned int cpuid_eax(unsigned int op) return eax; } -static inline unsigned int cpuid_ecx(unsigned int op) +static inline __constfunc unsigned int cpuid_ecx(unsigned int op) { unsigned int eax, ecx; @@ -225,7 +226,7 @@ static inline unsigned int cpuid_ecx(unsigned int op) : "bx", "dx" ); return ecx; } -static inline unsigned int cpuid_edx(unsigned int op) +static inline __constfunc unsigned int cpuid_edx(unsigned int op) { unsigned int eax, edx; @@ -237,7 +238,7 @@ static inline unsigned int cpuid_edx(unsigned int op) } /* Standard macro to see if a specific flag is changeable */ -static inline bool cpu_has_eflag(uint32_t flag) +static inline __constfunc bool cpu_has_eflag(uint32_t flag) { uint32_t f1, f2; -- 2.7.4