summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/cpufunc.h
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2005-03-02 21:33:29 +0000
committerjoerg <joerg@FreeBSD.org>2005-03-02 21:33:29 +0000
commitc85a3e95f78bb183ec62ae6ef948265e7ade6b7a (patch)
tree69c98a86a28838e983d8eca9ba158f46450df8c1 /sys/amd64/include/cpufunc.h
parent2307c11d0fa1ac2133cff99d6c1a90c711b15f61 (diff)
downloadFreeBSD-src-c85a3e95f78bb183ec62ae6ef948265e7ade6b7a.zip
FreeBSD-src-c85a3e95f78bb183ec62ae6ef948265e7ade6b7a.tar.gz
netchild's mega-patch to isolate compiler dependencies into a central
place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago
Diffstat (limited to 'sys/amd64/include/cpufunc.h')
-rw-r--r--sys/amd64/include/cpufunc.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index e558858..4c596a0 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -39,6 +39,10 @@
#ifndef _MACHINE_CPUFUNC_H_
#define _MACHINE_CPUFUNC_H_
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
struct region_descriptor;
#define readb(va) (*(volatile u_int8_t *) (va))
@@ -51,7 +55,7 @@ struct region_descriptor;
#define writel(va, d) (*(volatile u_int32_t *) (va) = (d))
#define writeq(va, d) (*(volatile u_int64_t *) (va) = (d))
-#ifdef __GNUC__
+#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
static __inline void
breakpoint(void)
@@ -152,12 +156,12 @@ halt(void)
__asm __volatile("hlt");
}
-#if __GNUC__ < 2
+#if !defined(__GNUCLIKE_BUILTIN_CONSTANT_P) || __GNUCLIKE_ASM < 3
#define inb(port) inbv(port)
#define outb(port, data) outbv(port, data)
-#else /* __GNUC >= 2 */
+#else /* __GNUCLIKE_BUILTIN_CONSTANT_P && __GNUCLIKE_ASM >= 3 */
/*
* The following complications are to get around gcc not having a
@@ -204,7 +208,7 @@ outbc(u_int port, u_char data)
__asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port)));
}
-#endif /* __GNUC <= 2 */
+#endif /* __GNUCLIKE_BUILTIN_CONSTANT_P */
static __inline u_char
inbv(u_int port)
@@ -696,7 +700,7 @@ intr_restore(register_t rflags)
write_rflags(rflags);
}
-#else /* !__GNUC__ */
+#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
int breakpoint(void);
u_int bsfl(u_int mask);
@@ -761,7 +765,7 @@ void wbinvd(void);
void write_rflags(u_int rf);
void wrmsr(u_int msr, u_int64_t newval);
-#endif /* __GNUC__ */
+#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
void reset_dbregs(void);
OpenPOWER on IntegriCloud