summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-07-16 15:39:40 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-07-16 15:39:40 -0700
commitd0647cde615a7eac404d44da26c6ec93789faed8 (patch)
tree73f25d13d753d54f2180853f0829bfa95827374e
parentbafccbbaaa9475c11713f6d94c8c35eaf280b06a (diff)
downloadsyslinux-d0647cde615a7eac404d44da26c6ec93789faed8.tar.gz
cpuid.h: add __constfunc
Add __constfunc to CPUID calls, so gcc knows it can CSE them. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/include/cpuid.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/com32/include/cpuid.h b/com32/include/cpuid.h
index b7c75941..67c28fea 100644
--- a/com32/include/cpuid.h
+++ b/com32/include/cpuid.h
@@ -31,6 +31,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <cpufeature.h>
+#include <klibc/compiler.h>
#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;