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
This commit is contained in:
Joerg Wunsch 2005-03-02 21:33:29 +00:00
parent f685f62c98
commit a5f50ef9e4
88 changed files with 584 additions and 353 deletions

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -97,7 +101,7 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_VAALIST
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef struct {
@ -105,8 +109,9 @@ typedef struct {
int __offset;
int __pad;
} __va_list;
#endif /* post GCC 2.95 */
#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#endif /* __GNUCLIKE_BUILTIN_VAALIST */
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -29,6 +29,10 @@
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#include <machine/alpha_cpu.h>
/*
@ -50,7 +54,7 @@ static __inline void atomic_set_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %2\n\t" /* load old value */
"bis %0, %3, %0\n\t" /* calculate new value */
@ -66,7 +70,7 @@ static __inline void atomic_clear_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"bic %0, %2, %0\n\t" /* calculate new value */
@ -82,7 +86,7 @@ static __inline void atomic_add_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"addl %0, %2, %0\n\t" /* calculate new value */
@ -98,7 +102,7 @@ static __inline void atomic_subtract_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"subl %0, %2, %0\n\t" /* calculate new value */
@ -114,7 +118,7 @@ static __inline u_int32_t atomic_readandclear_32(volatile u_int32_t *addr)
{
u_int32_t result,temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldl_l %0,%2\n\t" /* load current value, asserting lock */
@ -133,7 +137,7 @@ static __inline void atomic_set_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"bis %0, %2, %0\n\t" /* calculate new value */
@ -149,7 +153,7 @@ static __inline void atomic_clear_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"bic %0, %2, %0\n\t" /* calculate new value */
@ -165,7 +169,7 @@ static __inline void atomic_add_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"addq %0, %2, %0\n\t" /* calculate new value */
@ -181,7 +185,7 @@ static __inline void atomic_subtract_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"subq %0, %2, %0\n\t" /* calculate new value */
@ -197,7 +201,7 @@ static __inline u_int64_t atomic_readandclear_64(volatile u_int64_t *addr)
{
u_int64_t result,temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldq_l %0,%2\n\t" /* load current value, asserting lock */
@ -336,7 +340,7 @@ atomic_cmpset_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval)
{
u_int32_t ret;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"cmpeq %0, %2, %0\n\t" /* compare */
@ -363,7 +367,7 @@ atomic_cmpset_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval)
{
u_int64_t ret;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"cmpeq %0, %2, %0\n\t" /* compare */

View File

@ -35,9 +35,13 @@
#include <machine/chipset.h>
#include <machine/alpha_cpu.h>
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
struct thread;
#ifdef __GNUC__
#if defined(__GNUCLIKE_ASM)
static __inline void
breakpoint(void)

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -75,12 +75,12 @@ cpu_critical_exit(struct thread *td)
intr_restore(td->td_md.md_savecrit);
}
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -64,7 +64,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM)
static __inline __uint64_t
__bswap64(__uint64_t _x)
@ -113,7 +113,7 @@ __bswap16(__uint16_t _x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */
/*
* No optimizations are available for this compiler. Fall back to
@ -122,6 +122,6 @@ __bswap16(__uint16_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -45,7 +45,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
static __inline void
in_cksum_update(struct ip *ip)

View File

@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_BT848_H_
#define _MACHINE_IOCTL_BT848_H_
#ifdef __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_bt848.h instead of this header.
#endif

View File

@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_METEOR_H_
#define _MACHINE_IOCTL_METEOR_H_
#ifdef __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_meteor.h instead of this header.
#endif

View File

@ -34,7 +34,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -47,7 +47,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -63,7 +63,7 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_STDARG */
#ifdef __lint__
#define __builtin_saveregs() (0)
@ -87,6 +87,6 @@ typedef __va_list va_list;
#define va_end(ap) ((void)0)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -44,7 +44,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#if defined(__GNUCLIKE_BUILTIN_VARARGS)
#include <sys/_types.h>
@ -61,23 +65,21 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* ! __GNUCLIKE_BUILTIN_VARARGS */
#include <machine/stdarg.h>
#if __GNUC__ == 1
#define __va_ellipsis
#else
#define __va_ellipsis ...
#endif
#ifdef __GNUCLIKE_BUILTIN_VAALIST
#define va_alist __builtin_va_alist
#define va_dcl long __builtin_va_alist; __va_ellipsis
#endif
#undef va_start
#define va_start(ap) \
((ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */

View File

@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
* Floating point support.
*/
#if defined(__GNUC__) && !defined(lint)
#if defined(__GNUCLIKE_ASM) && !defined(lint)
#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr)))
#define fnclex() __asm("fnclex")
@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
: : "n" (CR0_TS) : "ax")
#define stop_emulating() __asm("clts")
#else /* not __GNUC__ */
#else /* !__GNUCLIKE_ASM */
void fldcw(caddr_t addr);
void fnclex(void);
@ -89,7 +89,7 @@ void fxrstor(caddr_t addr);
void start_emulating(void);
void stop_emulating(void);
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_ASM */
#define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_cw)
#define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_sw)

View File

@ -69,7 +69,7 @@ static struct gmonparam saved_gmp;
#endif
#endif /* GUPROF */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
GM_STATE = 0 \n\
GMON_PROF_OFF = 3 \n\
@ -140,9 +140,9 @@ __cyg_profile_func_enter: \n\
.mcount_exit: \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#else /* !__GNUCLIKE_ASM */
#error this file needs to be ported to your compiler
#endif /* __GNUCLIKE_ASM */
#ifdef GUPROF
/*
@ -151,7 +151,7 @@ __cyg_profile_func_enter: \n\
* dependent file together with cputime(), __mcount and [.]mcount. cputime()
* can't just be put in machdep.c because it has to be compiled without -pg.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
.text \n\
# \n\
@ -194,9 +194,9 @@ __cyg_profile_func_exit: \n\
.mexitcount_exit: \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#else /* !__GNUCLIKE_ASM */
#error this file needs to be ported to your compiler
#endif /* __GNUCLIKE_ASM */
/*
* Return the time elapsed since the last call. The units are machine-
@ -379,7 +379,7 @@ stopguprof(gp)
}
#else /* !GUPROF */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
.text \n\
.p2align 4,0x90 \n\
@ -387,7 +387,7 @@ __asm(" \n\
" __XSTRING(HIDENAME(mexitcount)) ": \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#else /* !__GNUCLIKE_ASM */
#error this file needs to be ported to your compiler
#endif /* __GNUCLIKE_ASM */
#endif /* GUPROF */

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -97,12 +101,13 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if defined(__GNUC__)
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#elif defined(lint)
typedef char * __va_list; /* pretend */
#endif
#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -28,6 +28,10 @@
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Various simple arithmetic on memory which is atomic in the presence
* of interrupts and multiple processors.
@ -76,7 +80,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#else /* !KLD_MODULE */
#ifdef __GNUC__
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
/*
* For userland, assume the SMP case and use lock prefixes so that
@ -102,12 +106,12 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
} \
struct __hack
#else /* !__GNUC__ */
#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \
extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
/*
* Atomic compare and set, used by the mutex functions
@ -117,7 +121,7 @@ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
* Returns 0 on failure, non-zero on success
*/
#if defined(__GNUC__)
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
static __inline int
atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
@ -158,9 +162,9 @@ atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src)
return (res);
}
#endif /* defined(__GNUC__) */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
#if defined(__GNUC__)
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
#define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \
static __inline u_##TYPE \
@ -189,7 +193,7 @@ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
} \
struct __hack
#else /* !defined(__GNUC__) */
#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
extern int atomic_cmpset_int(volatile u_int *, u_int, u_int);
extern int atomic_cmpset_long(volatile u_long *, u_long, u_long);
@ -198,7 +202,7 @@ extern int atomic_cmpset_long(volatile u_long *, u_long, u_long);
extern u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \
extern void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#endif /* defined(__GNUC__) */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
#endif /* KLD_MODULE */
@ -371,7 +375,7 @@ ATOMIC_PTR(subtract)
#undef ATOMIC_PTR
#if defined(__GNUC__)
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
static __inline u_int
atomic_readandclear_int(volatile u_int *addr)
@ -403,12 +407,12 @@ atomic_readandclear_long(volatile u_long *addr)
return (result);
}
#else /* !defined(__GNUC__) */
#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
extern u_long atomic_readandclear_long(volatile u_long *);
extern u_int atomic_readandclear_int(volatile u_int *);
#endif /* defined(__GNUC__) */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
#endif /* !defined(WANT_FUNCTIONS) */
#endif /* ! _MACHINE_ATOMIC_H_ */

View File

@ -74,6 +74,10 @@
#include <machine/cpufunc.h>
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* To remain compatible with NetBSD's interface, default to both memio and
* pio when neither of them is defined.
@ -284,7 +288,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movb (%2),%%al \n\
@ -313,7 +317,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movw (%2),%%ax \n\
@ -342,7 +346,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movl (%2),%%eax \n\
@ -391,7 +395,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inb %w2,%%al \n\
@ -410,7 +414,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -433,7 +437,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inw %w2,%%ax \n\
@ -452,7 +456,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -475,7 +479,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inl %w2,%%eax \n\
@ -494,7 +498,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -623,7 +627,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
@ -652,7 +656,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
@ -681,7 +685,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
@ -731,7 +735,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
@ -750,7 +754,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -773,7 +777,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
@ -792,7 +796,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -815,7 +819,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
@ -834,7 +838,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
bus_space_handle_t _port_ = bsh + offset;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -1213,7 +1217,7 @@ static __inline void
bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused,
bus_size_t offset __unused, bus_size_t len __unused, int flags)
{
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
if (flags & BUS_SPACE_BARRIER_READ)
__asm __volatile("lock; addl $0,0(%%rsp)" : : : "memory");
else

View File

@ -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);

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -74,12 +74,12 @@ cpu_critical_exit(struct thread *td)
intr_restore(td->td_md.md_savecrit);
}
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -63,7 +63,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
#define __word_swap_int_var(x) \
__extension__ ({ register __uint32_t __X = (x); \
@ -177,7 +177,7 @@ __bswap16(__uint16_t _x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
/*
* No optimizations are available for this compiler. Fall back to
@ -186,6 +186,6 @@ __bswap16(__uint16_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -42,6 +42,10 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* FP rounding modes
*/
@ -117,7 +121,8 @@ typedef enum {
#define SSE_RND_OFF 13 /* rounding control offset */
#define SSE_FZ_OFF 15 /* flush to zero offset */
#if defined(__GNUC__) && !defined(__cplusplus)
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) \
&& !defined(__cplusplus)
#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
@ -263,9 +268,10 @@ __fpsetsticky(fp_except_t _m)
return (_p);
}
#endif /* __GNUC__ && !__cplusplus */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE__ && !__cplusplus */
#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) && defined(__GNUC__)
#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) \
&& defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__)
#define fpgetround() __fpgetround()
#define fpsetround(_m) __fpsetround(_m)
@ -279,7 +285,8 @@ __fpsetsticky(fp_except_t _m)
/* Suppress prototypes in the MI header. */
#define _IEEEFP_INLINED_ 1
#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */
#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
&& __CC_SUPPORTS___INLINE__ */
/* Augment the userland declarations */
__BEGIN_DECLS
@ -287,6 +294,7 @@ extern fp_prec_t fpgetprec(void);
extern fp_prec_t fpsetprec(fp_prec_t);
__END_DECLS
#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */
#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM
&& __CC_SUPPORTS___INLINE__ */
#endif /* !_MACHINE_IEEEFP_H_ */

View File

@ -45,7 +45,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
static __inline void
in_cksum_update(struct ip *ip)

View File

@ -33,7 +33,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -29,6 +29,10 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef _KERNEL
/*
@ -55,7 +59,8 @@ extern struct pcpu *pcpup;
#define PCPU_PTR(member) (&pcpup->pc_ ## member)
#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
#elif defined(__GNUC__)
#elif defined(__GNUCLIKE___TYPEOF) && defined(__GNUCLIKE___OFFSETOF) \
&& defined(__GNUCLIKE_ASM)
/*
* Evaluates to the byte offset of the per-cpu variable name.
@ -170,7 +175,7 @@ __curthread(void)
#define curthread (__curthread())
#else
#error gcc or lint is required to use this file
#error this file needs to be ported to your compiler
#endif
#endif /* _KERNEL */

View File

@ -33,6 +33,10 @@
#ifndef _MACHINE_PROFILE_H_
#define _MACHINE_PROFILE_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef _KERNEL
/*
@ -53,7 +57,7 @@
#define MCOUNT_DECL(s)
#define MCOUNT_ENTER(s)
#define MCOUNT_EXIT(s)
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
#define MCOUNT_OVERHEAD(label) \
__asm __volatile("pushq %0; call __mcount; popq %%rcx" \
: \
@ -70,8 +74,8 @@
#define MEXITCOUNT_OVERHEAD()
#define MEXITCOUNT_OVERHEAD_GETLABEL()
#else
#error
#endif /* __GNUC */
#error this file needs to be ported to your compiler
#endif /* __GNUCLIKE_ASM */
#else /* !GUPROF */
#define MCOUNT_DECL(s) u_long s;
#ifdef SMP
@ -108,7 +112,7 @@ void user(void);
static void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \
static void _mcount
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
#define MCOUNT __asm(" \n\
.globl .mcount \n\
.type .mcount @function \n\
@ -166,13 +170,13 @@ mcount() \
_mcount(frompc, selfpc); \
}
#endif
#else /* !__GNUC__ */
#else /* !__GNUCLIKE_ASM */
#define MCOUNT \
void \
mcount() \
{ \
}
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_ASM */
typedef u_long uintfptr_t;
@ -193,7 +197,7 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc);
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
void mcount(void) __asm(".mcount");
#endif
__END_DECLS

View File

@ -39,7 +39,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__)
#if defined(__GNUCLIKE_BUILTIN_STDARG)
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -67,6 +67,8 @@ typedef __va_list va_list;
(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
#define va_end(ap)
#else
#error this file needs to be ported to your compiler
#endif
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -43,7 +43,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __GNUCLIKE_BUILTIN_VARARGS
#include <sys/_types.h>
@ -60,21 +64,17 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_VARARGS */
typedef char *va_list;
#define __va_size(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#ifdef __GNUC__
#ifdef __GNUCLIKE_BUILTIN_VAALIST
#define va_alist __builtin_va_alist
#endif
#if __GNUC__ > 1
#define va_dcl int va_alist; ...
#else
#define va_dcl int va_alist;
#endif
#define va_start(ap) \
((ap) = (va_list)&va_alist)
@ -84,6 +84,6 @@ typedef char *va_list;
#define va_end(ap)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */

View File

@ -532,7 +532,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
{
vm_offset_t lastaddr = 0;
int error, nsegs = -1;
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
@ -564,7 +564,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0,
bus_dmamap_callback2_t *callback, void *callback_arg,
int flags)
{
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
@ -650,7 +650,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, struct uio *uio,
int flags)
{
vm_offset_t lastaddr;
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -49,7 +53,7 @@ typedef unsigned short __uint16_t;
typedef int __int32_t;
typedef unsigned int __uint32_t;
#if defined(__GNUC__)
#ifdef __GNUCLIKE_ATTRIBUTE_MODE_DI
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
@ -105,12 +109,13 @@ typedef __uint32_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef char * __va_list;
#endif /* post GCC 2.95 */
#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -33,7 +33,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -42,7 +42,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -58,24 +58,24 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_STDARG */
#define __va_size(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#ifdef __GNUC__
#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG
#define va_start(ap, last) \
((ap) = (va_list)__builtin_next_arg(last))
#else /* non-GNU compiler */
#else /* !__GNUCLIKE_BUILTIN_NEXT_ARG */
#define va_start(ap, last) \
((ap) = (va_list)&(last) + __va_size(last))
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_BUILTIN_NEXT_ARG */
#define va_arg(ap, type) \
(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
#define va_end(ap)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -27,7 +27,14 @@
*
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef _ARCFUNCS_H
#define _ARCFUNCS_H
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __CC_SUPPORTS_INLINE
#define INLINE inline
#else
#define INLINE /**/
@ -197,3 +204,6 @@ VND_FN(3, u_int32_t, Print,
VND_FN(4, void, ReturnExtendedSystemInformation,
(EXTENDED_SYSTEM_INFORMATION *SystemInfo),
(SystemInfo))
#endif /* _ARGFUNCS_H */

View File

@ -18,8 +18,6 @@ Revision History
--*/
#pragma pack()
#include <sys/stdint.h>
/* Basic EFI types of various widths. */
@ -142,7 +140,7 @@ void __mf (void);
#ifdef NO_INTERFACE_DECL
#define INTERFACE_DECL(x)
#else
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_FORWARD_REFERENCE_CONSTRUCT
#define INTERFACE_DECL(x) struct x
#else
#define INTERFACE_DECL(x) typedef struct x

View File

@ -75,6 +75,10 @@
# include <sys/systm.h>
# define memset(a,b,c) bzero (a,c)
# define port_t int
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#endif
#endif
@ -82,7 +86,7 @@
#endif
#ifndef inline
# if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
# ifdef __CC_SUPPORTS___INLINE__
# define inline __inline__
# else
# define inline /**/

View File

@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$");
* Enable debugging by defining ICHSMB_DEBUG to a non-zero value.
*/
#define ICHSMB_DEBUG 0
#if ICHSMB_DEBUG != 0 && (defined(__GNUC__) || defined(__INTEL_COMPILER))
#if ICHSMB_DEBUG != 0 && defined(__CC_SUPPORTS___FUNC__)
#define DBG(fmt, args...) \
do { log(LOG_DEBUG, "%s: " fmt, __func__ , ## args); } while (0)
#else

View File

@ -47,6 +47,10 @@
#ifndef _IIR_H
#define _IIR_H
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#define IIR_DRIVER_VERSION 1
#define IIR_DRIVER_SUBVERSION 5
@ -699,7 +703,7 @@ void iir_free(struct gdt_softc *);
void iir_attach(struct gdt_softc *);
void iir_intr(void *arg);
#if defined( __GNUC__) || defined(__INTEL_COMPILER)
#ifdef __CC_SUPPORTS___INLINE__
/* These all require correctly aligned buffers */
static __inline__ void gdt_enc16(u_int8_t *, u_int16_t);
static __inline__ void gdt_enc32(u_int8_t *, u_int32_t);

View File

@ -44,6 +44,9 @@
#include <dev/isp/isp_target.h>
#include <dev/isp/isp_tpublic.h>
#endif
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#endif
#ifdef __linux__
#include "ispmbox.h"
@ -760,7 +763,7 @@ int isp_async(struct ispsoftc *, ispasync_t, void *);
/*
* Platform Dependent Error and Debug Printout
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ATTRIBUTE_PRINTF
void isp_prt(struct ispsoftc *, int level, const char *, ...)
__attribute__((__format__(__printf__,3,4)));
#else

View File

@ -47,12 +47,6 @@
#ifndef MCD_H
#define MCD_H
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#pragma pack(1)
#endif
#endif
/* toc */
#define MCD_MAXTOCS 104 /* from the Linux driver */
#define MCD_LASTPLUS1 170 /* special toc entry */
@ -172,14 +166,14 @@ struct mcd_dma_mode {
u_char dma_mode;
u_char data0; /* If dma_mode & 0x10: Use IRQ settings */
u_char data1; /* Used if dma_mode & 0x01 */
};
} __packed;
struct mcd_volinfo {
bcd_t trk_low;
bcd_t trk_high;
bcd_t vol_msf[3];
bcd_t trk1_msf[3];
};
} __packed;
struct mcd_qchninfo {
u_char addr_type:4;
@ -189,29 +183,29 @@ struct mcd_qchninfo {
bcd_t trk_size_msf[3];
u_char :8;
bcd_t hd_pos_msf[3];
};
} __packed;
struct mcd_volume {
u_char v0l;
u_char v0rs;
u_char v0r;
u_char v0ls;
};
} __packed;
struct mcd_holdtime {
u_char units_of_ten_seconds;
/* If this is 0, the default (12) is used */
};
} __packed;
struct mcd_read1 {
bcd_t start_msf[3];
u_char nsec[3];
};
} __packed;
struct mcd_read2 {
bcd_t start_msf[3];
bcd_t end_msf[3];
};
} __packed;
struct mcd_rawsector {
u_char sync1[12];
@ -220,11 +214,6 @@ struct mcd_rawsector {
u_char subheader2[4];
u_char data[MCDBLK];
u_char ecc_bits[280];
};
} __packed;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#pragma pack(4)
#endif
#endif
#endif /* MCD_H */

View File

@ -46,6 +46,9 @@
#ifndef MPI_TYPE_H
#define MPI_TYPE_H
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*******************************************************************************
* Define MPI_POINTER if it hasn't already been defined. By default MPI_POINTER
@ -68,7 +71,8 @@ typedef unsigned char U8;
typedef signed short S16;
typedef unsigned short U16;
#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__GNUC__) || defined(__INTEL_COMPILER)
#if defined(unix) || defined(__arm) || defined(ALPHA) \
|| defined(__CC_INT_IS_32BIT)
typedef signed int S32;
typedef unsigned int U32;

View File

@ -85,7 +85,7 @@ static union VIA_ACE_CW acw __aligned(16);
static __inline size_t
VIA_RNG_store(void *buf)
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
uint32_t retval = 0;
uint32_t rate = 0;
@ -107,7 +107,7 @@ VIA_RNG_store(void *buf)
static __inline void
VIA_ACE_cbc(void *in, void *out, size_t count, void *key, union VIA_ACE_CW *cw, void *iv)
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
/* The .byte line is really VIA C3 "xcrypt-cbc" instruction */
__asm __volatile(
"pushf \n\t"

View File

@ -32,12 +32,6 @@
#ifndef SCD_H
#define SCD_H
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
#pragma pack(1)
#endif
#endif
typedef unsigned char bcd_t;
#define M_msf(msf) msf[0]
#define S_msf(msf) msf[1]
@ -94,7 +88,7 @@ struct sony_drive_configuration {
char product[16];
char revision[8];
u_short config;
};
} __packed;
/* Almost same as cd_sub_channel_position_data */
struct sony_subchannel_position_data {
@ -105,14 +99,14 @@ struct sony_subchannel_position_data {
u_char rel_msf[3];
u_char dummy;
u_char abs_msf[3];
};
} __packed;
struct sony_tracklist {
u_char adr :4; /* xcdplayer needs these two values */
u_char ctl :4;
u_char track;
u_char start_msf[3];
};
} __packed;
#define MAX_TRACKS 100
@ -140,6 +134,6 @@ struct sony_toc {
/* The rest is just to take space in case all data is returned */
u_char dummy[6*9];
};
} __packed;
#endif /* SCD_H */

View File

@ -52,6 +52,10 @@ __FBSDID("$FreeBSD$");
#include "acpi_wakecode.h"
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
extern uint32_t acpi_reset_video;
extern void initializecpu(void);
@ -73,7 +77,7 @@ static void acpi_alloc_wakeup_handler(void);
extern int acpi_savecpu(void);
extern int acpi_restorecpu(void);
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm__(" \n\
.text \n\
.p2align 2, 0x90 \n\
@ -140,7 +144,7 @@ acpi_savecpu: \n\
movl $1,%eax \n\
ret \n\
");
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
static void
acpi_printcpu(void)

View File

@ -776,7 +776,7 @@ static volatile u_int trap_by_rdmsr;
* be advanced.
*/
inthand_t bluetrap6;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm
(" \n\
.text \n\
@ -795,7 +795,7 @@ __asm
* Accessing non-existent MSR generates general protection fault.
*/
inthand_t bluetrap13;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm
(" \n\
.text \n\

View File

@ -57,7 +57,11 @@ __FBSDID("$FreeBSD$");
#undef ADDCARRY
#define ADDCARRY(x) if ((x) > 0xffff) (x) -= 0xffff
#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
/*
* icc needs to be special cased here, as the asm code below results
* in broken code if compiled with icc.
*/
#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER)
/* non gcc parts stolen from sys/alpha/alpha/in_cksum.c */
#define REDUCE32 \
{ \
@ -74,7 +78,7 @@ __FBSDID("$FreeBSD$");
#endif
#define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);}
#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER)
static const u_int32_t in_masks[] = {
/*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/
0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -54,7 +58,7 @@ typedef unsigned int __uint32_t;
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI)
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
@ -114,12 +118,13 @@ typedef __uint32_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER))
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef char * __va_list;
#endif /* ! (__GNUC__ post 2.95 || __INTEL_COMPILER) */
#if defined(__GNUC__) && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -28,6 +28,10 @@
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Various simple arithmetic on memory which is atomic in the presence
* of interrupts and multiple processors.
@ -75,7 +79,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#else /* !KLD_MODULE */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
/*
* For userland, assume the SMP case and use lock prefixes so that
@ -101,12 +105,12 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\
} \
struct __hack
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !__GNUCLIKE_ASM */
#define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \
extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
/*
* Atomic compare and set, used by the mutex functions
@ -116,7 +120,7 @@ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
* Returns 0 on failure, non-zero on success
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
#if defined(CPU_DISABLE_CMPXCHG)
@ -168,9 +172,9 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src)
#endif /* defined(CPU_DISABLE_CMPXCHG) */
#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
#endif /* __GNUCLIKE_ASM */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
#if defined(_KERNEL) && !defined(SMP)
@ -226,7 +230,7 @@ struct __hack
#endif /* !defined(SMP) */
#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */
#else /* !__GNUCLIKE_ASM */
extern int atomic_cmpset_int(volatile u_int *, u_int, u_int);
@ -234,7 +238,7 @@ extern int atomic_cmpset_int(volatile u_int *, u_int, u_int);
extern u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \
extern void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)
#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
#endif /* __GNUCLIKE_ASM */
#endif /* KLD_MODULE */
@ -410,7 +414,7 @@ ATOMIC_PTR(subtract)
#undef ATOMIC_PTR
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
static __inline u_int
atomic_readandclear_int(volatile u_int *addr)
@ -442,12 +446,12 @@ atomic_readandclear_long(volatile u_long *addr)
return (result);
}
#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */
#else /* !__GNUCLIKE_ASM */
extern u_long atomic_readandclear_long(volatile u_long *);
extern u_int atomic_readandclear_int(volatile u_int *);
#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */
#endif /* __GNUCLIKE_ASM */
#endif /* !defined(WANT_FUNCTIONS) */
#endif /* ! _MACHINE_ATOMIC_H_ */

View File

@ -72,6 +72,10 @@
#ifndef _I386_BUS_AT386_H_
#define _I386_BUS_AT386_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#include <machine/cpufunc.h>
/*
@ -292,7 +296,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movb (%2),%%al \n\
@ -325,7 +329,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movw (%2),%%ax \n\
@ -358,7 +362,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: movl (%2),%%eax \n\
@ -411,7 +415,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inb %w2,%%al \n\
@ -434,7 +438,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -461,7 +465,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inw %w2,%%ax \n\
@ -484,7 +488,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -511,7 +515,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: inl %w2,%%eax \n\
@ -534,7 +538,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -667,7 +671,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
@ -700,7 +704,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
@ -733,7 +737,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh,
else
#endif
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
@ -787,7 +791,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsb \n\
@ -810,7 +814,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -837,7 +841,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsw \n\
@ -860,7 +864,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -887,7 +891,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
1: lodsl \n\
@ -910,7 +914,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh,
#endif
{
int _port_ = bsh + offset;
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm __volatile(" \n\
cld \n\
repne \n\
@ -1293,7 +1297,7 @@ static __inline void
bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused,
bus_size_t offset __unused, bus_size_t len __unused, int flags)
{
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
if (flags & BUS_SPACE_BARRIER_READ)
__asm __volatile("lock; addl $0,0(%%esp)" : : : "memory");
else

View File

@ -38,6 +38,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))
@ -48,7 +52,7 @@ struct region_descriptor;
#define writew(va, d) (*(volatile u_int16_t *) (va) = (d))
#define writel(va, d) (*(volatile u_int32_t *) (va) = (d))
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE)
static __inline void
breakpoint(void)
@ -126,12 +130,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
@ -178,7 +182,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 && __GNUCLIKE_ASM >= 3*/
static __inline u_char
inbv(u_int port)
@ -618,7 +622,7 @@ intr_restore(register_t eflags)
write_eflags(eflags);
}
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
int breakpoint(void);
u_int bsfl(u_int mask);
@ -683,7 +687,7 @@ void wbinvd(void);
void write_eflags(u_int ef);
void wrmsr(u_int msr, u_int64_t newval);
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */
void reset_dbregs(void);

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -81,12 +81,12 @@ cpu_critical_exit(struct thread *td)
intr_restore(td->td_md.md_savecrit);
}
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -67,17 +67,7 @@ extern "C" {
#define BYTE_ORDER _BYTE_ORDER
#endif
#if defined(__INTEL_COMPILER)
#if defined(__cplusplus)
#if __INTEL_COMPILER >= 800
#define __INTEL_COMPILER_with_FreeBSD_endian 1
#endif
#else
#define __INTEL_COMPILER_with_FreeBSD_endian 1
#endif
#endif
#if defined(__GNUC__) || defined(__INTEL_COMPILER_with_FreeBSD_endian)
#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P)
#define __word_swap_int_var(x) \
__extension__ ({ register __uint32_t __X = (x); \
@ -168,7 +158,7 @@ __bswap16(__uint16_t _x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !(__GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian) */
#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */
/*
* No optimizations are available for this compiler. Fall back to
@ -177,7 +167,7 @@ __bswap16(__uint16_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian */
#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */
#ifdef __cplusplus
}

View File

@ -41,6 +41,10 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* FP rounding modes
*/
@ -98,7 +102,7 @@ typedef enum {
#define FP_RND_OFF 10 /* round control offset */
#define FP_STKY_OFF 0 /* sticky flags offset */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
@ -151,7 +155,7 @@ __fpsetreg(int _m, int _reg, int _fld, int _off)
return _p;
}
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
/*
* SysV/386 FP control interface

View File

@ -35,6 +35,10 @@
#ifndef _MACHINE_IN_CKSUM_H_
#define _MACHINE_IN_CKSUM_H_ 1
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* MP safe (alfred)
*/
@ -49,7 +53,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#if defined(__GNUCLIKE_ASM) && !defined(__INTEL_COMPILER)
static __inline u_int
in_cksum_hdr(const struct ip *ip)
{
@ -119,7 +123,7 @@ in_pseudo(u_int sum, u_int b, u_int c)
#endif
#ifdef _KERNEL
#if !defined(__GNUC__) || defined(__INTEL_COMPILER)
#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER)
u_int in_cksum_hdr(const struct ip *ip);
u_short in_addword(u_short sum, u_short b);
u_short in_pseudo(u_int sum, u_int b, u_int c);

View File

@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_BT848_H_
#define _MACHINE_IOCTL_BT848_H_
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_bt848.h instead of this header.
#endif

View File

@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_METEOR_H_
#define _MACHINE_IOCTL_METEOR_H_
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_meteor.h instead of this header.
#endif

View File

@ -33,7 +33,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -29,6 +29,10 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef _KERNEL
#include <machine/segments.h>
@ -59,7 +63,8 @@ extern struct pcpu *pcpup;
#define PCPU_PTR(member) (&pcpup->pc_ ## member)
#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
#elif defined(__GNUC__) || defined (__INTEL_COMPILER)
#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) \
&& defined(__GNUCLIKE___OFFSETOF)
/*
* Evaluates to the byte offset of the per-cpu variable name.
@ -162,7 +167,7 @@ __curthread(void)
#define curthread (__curthread())
#else
#error gcc or lint is required to use this file
#error this file needs to be ported to your compiler
#endif
#endif /* _KERNEL */

View File

@ -33,6 +33,10 @@
#ifndef _MACHINE_PROFILE_H_
#define _MACHINE_PROFILE_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef _KERNEL
/*
@ -53,7 +57,7 @@
#define MCOUNT_DECL(s)
#define MCOUNT_ENTER(s)
#define MCOUNT_EXIT(s)
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
#define MCOUNT_OVERHEAD(label) \
__asm __volatile("pushl %0; call __mcount; popl %%ecx" \
: \
@ -71,7 +75,7 @@
#define MEXITCOUNT_OVERHEAD_GETLABEL()
#else
#error
#endif /* !(__GNUC__ || __INTEL_COMPILER) */
#endif /* !__GNUCLIKE_ASM */
#else /* !GUPROF */
#define MCOUNT_DECL(s) u_long s;
#ifdef SMP
@ -106,7 +110,7 @@ void user(void);
#define _MCOUNT_DECL static __inline void _mcount
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
#define MCOUNT \
void \
mcount() \
@ -129,13 +133,13 @@ mcount() \
frompc = ((uintfptr_t *)frompc)[1]; \
_mcount(frompc, selfpc); \
}
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !__GNUCLIKE_ASM */
void \
#define MCOUNT \
mcount() \
{ \
}
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
typedef u_int uintfptr_t;
@ -156,7 +160,7 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc);
#include <sys/cdefs.h>
__BEGIN_DECLS
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
void mcount(void) __asm(".mcount");
#endif
__END_DECLS

View File

@ -46,7 +46,7 @@
typedef __va_list va_list;
#endif
#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER))
#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -62,18 +62,18 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! (__GNUC__ post GCC 2.95 || __INTEL_COMPILER) */
#else /* !__GNUCLIKE_BUILTIN_STDARG */
#define __va_size(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG
#define va_start(ap, last) \
((ap) = (va_list)__builtin_next_arg(last))
#else /* non-GNU compiler */
#else /* !__GNUCLIKE_BUILTIN_NEXT_ARG */
#define va_start(ap, last) \
((ap) = (va_list)&(last) + __va_size(last))
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_BUILTIN_NEXT_ARG */
#define va_arg(ap, type) \
(*(type *)((ap) += __va_size(type), (ap) - __va_size(type)))
@ -85,6 +85,6 @@ typedef __va_list va_list;
#define va_end(ap)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -39,7 +39,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __GNUCLIKE_BUILTIN_VARARGS
#include <sys/_types.h>
@ -56,17 +60,17 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_VARARGS */
typedef char *va_list;
#define __va_size(type) \
(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
#ifdef __GNUC__
#if defined(__GNUCLIKE_BUILTIN_VAALIST)
#define va_alist __builtin_va_alist
#endif
#if __GNUC__ > 1
#ifdef __CC_SUPPORTS_VARADIC_XXX
#define va_dcl int va_alist; ...
#else
#define va_dcl int va_alist;
@ -80,6 +84,6 @@ typedef char *va_list;
#define va_end(ap)
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */

View File

@ -95,7 +95,7 @@ __FBSDID("$FreeBSD$");
#define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1)
#define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2)
#if (defined(__GNUC__) && !defined(lint)) || defined(__INTEL_COMPILER)
#if defined(__GNUCLIKE_ASM) && !defined(lint)
#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr)))
#define fnclex() __asm("fnclex")
@ -113,7 +113,7 @@ __FBSDID("$FreeBSD$");
: : "n" (CR0_TS) : "ax")
#define stop_emulating() __asm("clts")
#else /* !((__GNUC__ && !lint ) || __INTEL_COMPILER) */
#else /* !(__GNUCLIKE_ASM && !lint) */
void fldcw(caddr_t addr);
void fnclex(void);
@ -130,7 +130,7 @@ void fxrstor(caddr_t addr);
void start_emulating(void);
void stop_emulating(void);
#endif /* (__GNUC__ && !lint ) || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM && !lint */
#ifdef CPU_ENABLE_SSE
#define GET_FPU_CW(thread) \

View File

@ -69,7 +69,7 @@ static struct gmonparam saved_gmp;
#endif
#endif /* GUPROF */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
GM_STATE = 0 \n\
GMON_PROF_OFF = 3 \n\
@ -122,9 +122,9 @@ __cyg_profile_func_enter: \n\
.mcount_exit: \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#else /* !__GNUCLIKE_ASM */
#error this file needs to be ported to your compiler
#endif /* __GNUCLIKE_ASM */
#ifdef GUPROF
/*
@ -133,7 +133,7 @@ __cyg_profile_func_enter: \n\
* dependent file together with cputime(), __mcount and [.]mcount. cputime()
* can't just be put in machdep.c because it has to be compiled without -pg.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
.text \n\
# \n\
@ -168,9 +168,7 @@ __cyg_profile_func_exit: \n\
.mexitcount_exit: \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
/*
* Return the time elapsed since the last call. The units are machine-
@ -353,7 +351,7 @@ stopguprof(gp)
}
#else /* !GUPROF */
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE_ASM
__asm(" \n\
.text \n\
.p2align 4,0x90 \n\
@ -361,7 +359,5 @@ __asm(" \n\
" __XSTRING(HIDENAME(mexitcount)) ": \n\
ret \n\
");
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#error
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE_ASM */
#endif /* GUPROF */

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -97,9 +101,10 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
#ifdef __GNUC__
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#if !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compat. with GNU headers */
#endif
@ -109,6 +114,6 @@ typedef char * __va_list; /* non-functional */
#else
#error Must add va_list support for this non-GCC compiler.
#endif /* lint */
#endif /* __GNUC__ */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE__TYPES_H_ */

View File

@ -35,11 +35,15 @@
#include <machine/ia64_cpu.h>
#include <machine/vmparam.h>
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
struct thread;
#define IA64_FIXED_BREAK 0x84B5D
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
static __inline void
breakpoint(void)
@ -50,8 +54,6 @@ breakpoint(void)
#define HAVE_INLINE_FFS
#define ffs(x) __builtin_ffs(x)
#endif
extern uint64_t ia64_port_base;
#define __MEMIO_ADDR(x) (__volatile void*)(IA64_PHYS_TO_RR6(x))
#define __PIO_ADDR(x) (__volatile void*)(ia64_port_base | \
@ -208,6 +210,8 @@ intr_restore(register_t ie)
enable_intr();
}
#endif /* __GNUCLIKE_ASM */
#endif /* _KERNEL */
#endif /* !_MACHINE_CPUFUNC_H_ */

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -76,12 +76,12 @@ cpu_critical_exit(struct thread *td)
}
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td)
void cpu_critical_exit(struct thread *td)
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -64,7 +64,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM)
static __inline __uint64_t
__bswap64(__uint64_t _x)
@ -95,7 +95,7 @@ __bswap16(__uint16_t _x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#else /* !__GNUC__ */
#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */
/*
* No optimizations are available for this compiler. Fall back to
@ -104,6 +104,6 @@ __bswap16(__uint16_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -45,7 +45,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
static __inline void
in_cksum_update(struct ip *ip)

View File

@ -35,7 +35,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -46,7 +46,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#if defined(__GNUCLIKE_BUILTIN_STDARG)
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))

View File

@ -543,8 +543,8 @@ addupc_task(struct thread *td, uintptr_t pc, u_int ticks)
PROC_UNLOCK(p);
}
#if (defined(__amd64__) || defined(__i386__)) && __GNUC__ >= 2 && \
!defined(__INTEL_COMPILER)
#if (defined(__amd64__) || defined(__i386__)) && \
defined(__GNUCLIKE_CTOR_SECTION_HANDLING)
/*
* Support for "--test-coverage --profile-arcs" in GCC.
*

View File

@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -54,7 +58,7 @@ typedef unsigned int __uint32_t;
typedef long long __int64_t;
/* LONGLONG */
typedef unsigned long long __uint64_t;
#elif defined(__GNUC__)
#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI)
typedef int __attribute__((__mode__(__DI__))) __int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t;
#else
@ -110,7 +114,7 @@ typedef __uint32_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#if defined(__GNUCLIKE_BUILTIN_VARARGS)
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef struct {
@ -121,7 +125,8 @@ typedef struct {
char *__base;
} __va_list;
#endif /* post GCC 2.95 */
#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -33,6 +33,10 @@
#include <machine/cpufunc.h>
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Various simple arithmetic on memory which is atomic in the presence
* of interrupts and SMP safe.
@ -53,7 +57,7 @@ atomic_set_32(volatile uint32_t *p, uint32_t v)
{
uint32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"or %0, %3, %0\n\t" /* calculate new value */
@ -70,7 +74,7 @@ atomic_clear_32(volatile uint32_t *p, uint32_t v)
{
uint32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"andc %0, %0, %3\n\t" /* calculate new value */
@ -87,7 +91,7 @@ atomic_add_32(volatile uint32_t *p, uint32_t v)
{
uint32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"add %0, %3, %0\n\t" /* calculate new value */
@ -104,7 +108,7 @@ atomic_subtract_32(volatile uint32_t *p, uint32_t v)
{
uint32_t temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"subf %0, %3, %0\n\t" /* calculate new value */
@ -121,7 +125,7 @@ atomic_readandclear_32(volatile uint32_t *addr)
{
uint32_t result,temp;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"\tsync\n" /* drain writes */
"1:\tlwarx %0, 0, %3\n\t" /* load old value */
@ -348,7 +352,7 @@ atomic_cmpset_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval)
{
uint32_t ret;
#ifdef __GNUC__
#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tlwarx %0, 0, %2\n\t" /* load old value */
"cmplw %3, %0\n\t" /* compare */

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -77,12 +77,12 @@ cpu_critical_exit(struct thread *td)
}
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -65,7 +65,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
static __inline __uint16_t
__bswap16(__uint16_t _x)
@ -97,7 +97,7 @@ __bswap64(__uint64_t _x)
#define __ntohl(x) ((__uint32_t)(x))
#define __ntohs(x) ((__uint16_t)(x))
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
/*
* No optimizations are available for this compiler. Fall back to
@ -106,6 +106,6 @@ __bswap64(__uint64_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
#endif /* !_MACHINE_ENDIAN_H_ */

View File

@ -45,7 +45,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
static __inline void
in_cksum_update(struct ip *ip)

View File

@ -33,7 +33,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
#if __GNUC__
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif

View File

@ -39,7 +39,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#if defined(__GNUCLIKE_BUILTIN_STDARG)
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -58,7 +58,7 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_STDARG */
#ifdef __lint__
@ -67,7 +67,7 @@ typedef __va_list va_list;
#else
#if defined(__GNUC__) && (__GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#if defined(__GNUC_VA_LIST_COMPATIBILITY)
#define va_start(ap, last) \
(__builtin_next_arg(last), \
__builtin_memcpy((void *)&(ap), __builtin_saveregs (), \
@ -145,6 +145,6 @@ typedef __va_list va_list;
#endif
#endif
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* _MACHINE_STDARG_H_ */

View File

@ -31,7 +31,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#if defined(__GNUCLIKE_BUILTIN_VARARGS)
#include <sys/_types.h>
@ -48,12 +52,16 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* ! __GNUCLIKE_BUILTIN_VARARGS */
#include <machine/stdarg.h>
#ifdef __GNUCLIKE_BUILTIN_VAALIST
#define va_alist __builtin_va_alist
#define va_dcl int __builtin_va_alist; ...
#else
#error this file needs to be ported to your compiler
#endif
#undef va_start
@ -67,6 +75,6 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
(ap).__fpr = __va_first_fpr)
#endif
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* _MACHINE_VARARGS_H_ */

View File

@ -309,7 +309,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
{
vm_offset_t vaddr;
vm_offset_t paddr;
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
@ -462,7 +462,7 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0,
bus_dmamap_callback2_t *callback, void *callback_arg,
int flags)
{
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
@ -538,7 +538,7 @@ bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, struct uio *uio,
int flags)
{
vm_offset_t lastaddr;
#ifdef __GNUC__
#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
bus_dma_segment_t dm_segments[dmat->nsegments];
#else
bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];

View File

@ -35,6 +35,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* Basic types upon which most other types are built.
*/
@ -93,12 +97,13 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef char * __va_list;
#endif /* post GCC 2.95 */
#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \
&& !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif

View File

@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
#ifdef __GNUC__
#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@ -79,12 +79,12 @@ cpu_critical_exit(struct thread *td)
wrpr(pil, td->td_md.md_savecrit, 0);
}
#else /* !__GNUC__ */
#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
#endif /* __GNUC__ */
#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS

View File

@ -63,7 +63,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
#if defined(__GNUC__) && defined(__OPTIMIZE__)
#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
#define __is_constant(x) __builtin_constant_p(x)
#else
#define __is_constant(x) 0

View File

@ -49,7 +49,7 @@
typedef __va_list va_list;
#endif
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@ -65,7 +65,11 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* ! __GNUCLIKE_BUILTIN_STDARG */
#if !defined(__GNUCLIKE_BUILTIN_NEXT_ARG) && !defined(lint)
#error no support for your compiler
#endif
#define va_start(ap, last) \
(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
@ -92,6 +96,6 @@ typedef __va_list va_list;
(sizeof(type) <= 16 ? __va_arg16(ap, type) : \
*__va_arg8(ap, type *)))))
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */

View File

@ -52,7 +52,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __GNUCLIKE_BUILTIN_VARARGS
#include <sys/_types.h>
@ -69,15 +73,11 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
#else /* ! __GNUC__ post GCC 2.95 */
#else /* !__GNUCLIKE_BUILTIN_VARARGS */
#include <machine/stdarg.h>
#if __GNUC__ == 1
#define __va_ellipsis
#else
#define __va_ellipsis ...
#endif
#define va_alist __builtin_va_alist
#define va_dcl long __builtin_va_alist; __va_ellipsis
@ -86,6 +86,6 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_start(ap) \
((ap) = (va_list)__builtin_saveregs())
#endif /* __GNUC__ post GCC 2.95 */
#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */

View File

@ -44,6 +44,76 @@
#define __END_DECLS
#endif
/*
* This code has been put in place to help reduce the addition of
* compiler specific defines in FreeBSD code. It helps to aid in
* having a compiler-agnostic source tree.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
#define __GNUCLIKE_ASM 3
#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
#else
#define __GNUCLIKE_ASM 2
#endif
#define __GNUCLIKE___TYPEOF 1
#define __GNUCLIKE___OFFSETOF 1
#define __GNUCLIKE___SECTION 1
#define __GNUCLIKE_ATTRIBUTE_PRINTF 1
#define __GNUCLIKE_ATTRIBUTE_MODE_DI 1
#ifndef __INTEL_COMPILER
# define __GNUCLIKE_CTOR_SECTION_HANDLING 1
#endif
#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
# if defined(__INTEL_COMPILER) && defined(__cplusplus) \
&& __INTEL_COMPILER < 800
# undef __GNUCLIKE_BUILTIN_CONSTANT_P
# endif
#if __GNUC_MINOR__ > 95 || __GNUC__ >= 3 || defined(__INTEL_COMPILER)
# define __GNUCLIKE_BUILTIN_VARARGS 1
#endif
#define __GNUCLIKE_BUILTIN_VAALIST 1
#if defined(__GNUC__)
# define __GNUC_VA_LIST_COMPATIBILITY 1
#endif
#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
# define __GNUCLIKE_BUILTIN_STDARG 1
#endif
#ifndef __INTEL_COMPILER
# define __GNUCLIKE_BUILTIN_NEXT_ARG 1
# define __GNUCLIKE_MATH_BUILTIN_RELOPS
#endif
#define __GNUCLIKE_BUILTIN_MEMCPY 1
/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
#define __CC_SUPPORTS_INLINE 1
#define __CC_SUPPORTS___INLINE 1
#define __CC_SUPPORTS___INLINE__ 1
#define __CC_SUPPORTS___FUNC__ 1
#define __CC_SUPPORTS_WARNING 1
#define __CC_SUPPORTS_FORWARD_REFERENCE_CONSTRUCT 1
#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
/* XXX: sys/dev/mpt/mpilib/mpi_type.h uses it, someone should review it */
#define __CC_INT_IS_32BIT 1
#endif /* __GNUC__ || __INTEL_COMPILER */
/*
* Macro to test if we're using a specific version of gcc or later.
*/
@ -79,9 +149,9 @@
#if defined(__cplusplus)
#define __inline inline /* convert to C++ keyword */
#else
#if !(defined(__GNUC__) || defined(__INTEL_COMPILER))
#if !(defined(__CC_SUPPORTS___INLINE))
#define __inline /* delete GCC keyword */
#endif /* !(__GNUC__ || __INTEL_COMPILER) */
#endif /* ! __CC_SUPPORTS___INLINE */
#endif /* !__cplusplus */
#else /* !(__STDC__ || __cplusplus) */
@ -89,7 +159,7 @@
#define __CONCAT(x,y) x/**/y
#define __STRING(x) "x"
#if !(defined(__GNUC__) || defined(__INTEL_COMPILER))
#if !defined(__CC_SUPPORTS___INLINE)
#define __const /* delete pseudo-ANSI C keywords */
#define __inline
#define __signed
@ -108,7 +178,7 @@
#define signed
#define volatile
#endif /* !NO_ANSI_KEYWORDS */
#endif /* !(__GNUC__ || __INTEL_COMPILER) */
#endif /* !__CC_SUPPORTS___INLINE */
#endif /* !(__STDC__ || __cplusplus) */
/*

View File

@ -33,7 +33,9 @@
#ifndef _SYS_DIR_H_
#define _SYS_DIR_H_
#if defined(__GNUC__) || defined (__INTEL_COMPILER)
#include <sys/cdefs.h>
#ifdef __CC_SUPPORTS_WARNING
#warning "The information in this file should be obtained from <dirent.h>"
#warning "and is provided solely (and temporarily) for backward compatibility."
#endif

View File

@ -39,10 +39,13 @@
#define _SYS_IOCTL_H_
#ifdef _KERNEL
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __CC_SUPPORTS_WARNING
#warning "Don't #include ioctl.h in the kernel. Include xxxio.h instead."
#endif
#endif
#endif /* _KERNEL */
#include <sys/ttycom.h>

View File

@ -30,6 +30,10 @@
#ifndef _SYS_LINKER_SET_H_
#define _SYS_LINKER_SET_H_
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
/*
* The following macros are used to declare global sets of objects, which
* are collected by the linker into a `linker_set' as defined below.
@ -39,16 +43,16 @@
/*
* Private macros, not to be used outside this header file.
*/
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __GNUCLIKE___SECTION
#define __MAKE_SET(set, sym) \
static void const * const __set_##set##_sym_##sym \
__section("set_" #set) __used = &sym
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !__GNUCLIKE___SECTION */
#ifndef lint
#error "This file needs to be compiled by GCC, an Intel compiler or lint"
#error this file needs to be ported to your compiler
#endif /* lint */
#define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym)
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __GNUCLIKE___SECTION */
/*
* Public macros.

View File

@ -517,7 +517,7 @@ struct quehead {
struct quehead *qh_rlink;
};
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifdef __CC_SUPPORTS___INLINE
static __inline void
insque(void *a, void *b)
@ -541,12 +541,12 @@ remque(void *a)
element->qh_rlink = 0;
}
#else /* !(__GNUC__ || __INTEL_COMPILER) */
#else /* !__CC_SUPPORTS___INLINE */
void insque(void *a, void *b);
void remque(void *a);
#endif /* __GNUC__ || __INTEL_COMPILER */
#endif /* __CC_SUPPORTS___INLINE */
#endif /* _KERNEL */

View File

@ -34,7 +34,10 @@
#define _SYS_SYSLIMITS_H_
#if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_)
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef _SYS_CDEFS_H_
#error this file needs sys/cdefs.h as a prerequisite
#endif
#ifdef __CC_SUPPORTS_WARNING
#warning "No user-serviceable parts inside."
#endif
#endif