diff --git a/sys/amd64/amd64/prof_machdep.c b/sys/amd64/amd64/prof_machdep.c index 4c3a21e2135e..31b1c2a16059 100644 --- a/sys/amd64/amd64/prof_machdep.c +++ b/sys/amd64/amd64/prof_machdep.c @@ -69,7 +69,7 @@ static struct gmonparam saved_gmp; #endif #endif /* GUPROF */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __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__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ #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. */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm(" \n\ .text \n\ # \n\ @@ -168,9 +168,9 @@ __cyg_profile_func_exit: \n\ .mexitcount_exit: \n\ ret \n\ "); -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ /* * Return the time elapsed since the last call. The units are machine- @@ -346,7 +346,7 @@ stopguprof(gp) } #else /* !GUPROF */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm(" \n\ .text \n\ .p2align 4,0x90 \n\ @@ -354,7 +354,7 @@ __asm(" \n\ " __XSTRING(HIDENAME(mexitcount)) ": \n\ ret \n\ "); -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ #endif /* GUPROF */ diff --git a/sys/boot/arc/include/arcfuncs.h b/sys/boot/arc/include/arcfuncs.h index 25c74465b3fa..e88ff03a1c10 100644 --- a/sys/boot/arc/include/arcfuncs.h +++ b/sys/boot/arc/include/arcfuncs.h @@ -27,7 +27,7 @@ * */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define INLINE inline #else #define INLINE /**/ diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index bb583530ed1a..9c81d922a023 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -139,7 +139,17 @@ static int xputc(int); static int xgetc(int); static int getc(int); +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define memcpy __builtin_memcpy +#else +static void memcpy(char *, const char *, int); +static void +memcpy(char *dst, const char *src, int len) +{ + while (len--) + *dst++ = *src++; +} +#endif static inline int strcmp(const char *s1, const char *s2) diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index bb583530ed1a..9c81d922a023 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -139,7 +139,17 @@ static int xputc(int); static int xgetc(int); static int getc(int); +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define memcpy __builtin_memcpy +#else +static void memcpy(char *, const char *, int); +static void +memcpy(char *dst, const char *src, int len) +{ + while (len--) + *dst++ = *src++; +} +#endif static inline int strcmp(const char *s1, const char *s2) diff --git a/sys/dev/aic7xxx/aicasm/aicasm.c b/sys/dev/aic7xxx/aicasm/aicasm.c index cdf84e9ca244..0c780f9065be 100644 --- a/sys/dev/aic7xxx/aicasm/aicasm.c +++ b/sys/dev/aic7xxx/aicasm/aicasm.c @@ -143,7 +143,7 @@ main(int argc, char *argv[]) yydebug = 0; mmdebug = 0; #endif - while ((ch = getopt(argc, argv, "d:i:l:n:o:p:r:I:")) != -1) { + while ((ch = getopt(argc, argv, "d:i:l:n:o:p:r:I:X")) != -1) { switch(ch) { case 'd': #if DEBUG @@ -244,6 +244,9 @@ main(int argc, char *argv[]) } break; } + case 'X': + /* icc version of -nostdinc */ + break; case '?': default: usage(); @@ -309,7 +312,7 @@ usage() { (void)fprintf(stderr, -"usage: %-16s [-nostdinc] [-I-] [-I directory] [-o output_file]\n" +"usage: %-16s [-nostdinc|-X] [-I-] [-I directory] [-o output_file]\n" " [-r register_output_file [-p register_diag_file -i includefile]]\n" " [-l program_list_file]\n" " input_file\n", appname); diff --git a/sys/dev/cx/machdep.h b/sys/dev/cx/machdep.h index b88e9002e539..23469259bd15 100644 --- a/sys/dev/cx/machdep.h +++ b/sys/dev/cx/machdep.h @@ -84,7 +84,7 @@ #endif #ifndef inline -# if __GNUC__ >= 2 +# if __GNUC__ >= 2 || defined(__INTEL_COMPILER) # define inline __inline__ # else # define inline /**/ diff --git a/sys/dev/ichsmb/ichsmb.c b/sys/dev/ichsmb/ichsmb.c index d92e23ea7d93..0d8dd59b07a3 100644 --- a/sys/dev/ichsmb/ichsmb.c +++ b/sys/dev/ichsmb/ichsmb.c @@ -69,7 +69,7 @@ __FBSDID("$FreeBSD$"); * Enable debugging by defining ICHSMB_DEBUG to a non-zero value. */ #define ICHSMB_DEBUG 0 -#if ICHSMB_DEBUG != 0 && defined(__GNUC__) +#if ICHSMB_DEBUG != 0 && (defined(__GNUC__) || defined(__INTEL_COMPILER)) #define DBG(fmt, args...) \ do { log(LOG_DEBUG, "%s: " fmt, __func__ , ## args); } while (0) #else diff --git a/sys/dev/iir/iir.h b/sys/dev/iir/iir.h index 5ce705d10a3d..38c29bfd8b9c 100644 --- a/sys/dev/iir/iir.h +++ b/sys/dev/iir/iir.h @@ -697,7 +697,7 @@ void iir_free(struct gdt_softc *); void iir_attach(struct gdt_softc *); void iir_intr(void *arg); -#ifdef __GNUC__ +#if defined( __GNUC__) || defined(__INTEL_COMPILER) /* 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); diff --git a/sys/dev/isp/ispvar.h b/sys/dev/isp/ispvar.h index f44c24abe0ee..6cd11a707c7e 100644 --- a/sys/dev/isp/ispvar.h +++ b/sys/dev/isp/ispvar.h @@ -753,7 +753,7 @@ int isp_async(struct ispsoftc *, ispasync_t, void *); /* * Platform Dependent Error and Debug Printout */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) void isp_prt(struct ispsoftc *, int level, const char *, ...) __attribute__((__format__(__printf__,3,4))); #else diff --git a/sys/dev/mcd/mcdreg.h b/sys/dev/mcd/mcdreg.h index 6d542af6a13c..cc8a3ab7163a 100644 --- a/sys/dev/mcd/mcdreg.h +++ b/sys/dev/mcd/mcdreg.h @@ -47,8 +47,8 @@ #ifndef MCD_H #define MCD_H -#ifdef __GNUC__ -#if __GNUC__ >= 2 +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #pragma pack(1) #endif #endif @@ -222,8 +222,8 @@ struct mcd_rawsector { u_char ecc_bits[280]; }; -#ifdef __GNUC__ -#if __GNUC__ >= 2 +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #pragma pack(4) #endif #endif diff --git a/sys/dev/mpt/mpilib/mpi_type.h b/sys/dev/mpt/mpilib/mpi_type.h index 040cf96b711d..becf1a0747c4 100644 --- a/sys/dev/mpt/mpilib/mpi_type.h +++ b/sys/dev/mpt/mpilib/mpi_type.h @@ -68,7 +68,7 @@ typedef unsigned char U8; typedef signed short S16; typedef unsigned short U16; -#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__GNUC__) +#if defined(unix) || defined(__arm) || defined(ALPHA) || defined(__GNUC__) || defined(__INTEL_COMPILER) typedef signed int S32; typedef unsigned int U32; diff --git a/sys/dev/scd/scdreg.h b/sys/dev/scd/scdreg.h index bbfeefd7fce9..38e2293bc7d8 100644 --- a/sys/dev/scd/scdreg.h +++ b/sys/dev/scd/scdreg.h @@ -32,8 +32,8 @@ #ifndef SCD_H #define SCD_H -#ifdef __GNUC__ -#if __GNUC__ >= 2 +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #pragma pack(1) #endif #endif diff --git a/sys/i386/acpica/acpi_wakeup.c b/sys/i386/acpica/acpi_wakeup.c index 83e7c0106ee2..ae2bc0999c1d 100644 --- a/sys/i386/acpica/acpi_wakeup.c +++ b/sys/i386/acpica/acpi_wakeup.c @@ -81,7 +81,7 @@ static void acpi_alloc_wakeup_handler(void); extern int acpi_savecpu(void); extern int acpi_restorecpu(void); -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm__(" \n\ .text \n\ .p2align 2, 0x90 \n\ @@ -148,7 +148,7 @@ acpi_savecpu: \n\ movl $1,%eax \n\ ret \n\ "); -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ static void acpi_printcpu(void) diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 79173c77428c..03d5453f0323 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -64,9 +64,10 @@ static __inline u_short rss(void) { u_short ss; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile("mov %%ss,%0" : "=r" (ss)); #else +#error Function rss() needs to get ported to this compiler. ss = 0; /* XXXX Fix for other compilers. */ #endif return ss; diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index b5b1e9d88f25..23bb42bb06b7 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -768,7 +768,7 @@ static volatile u_int trap_by_rdmsr; * be advanced. */ inthand_t bluetrap6; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm (" \n\ .text \n\ @@ -787,7 +787,7 @@ __asm * Accessing non-existent MSR generates general protection fault. */ inthand_t bluetrap13; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm (" \n\ .text \n\ diff --git a/sys/i386/i386/in_cksum.c b/sys/i386/i386/in_cksum.c index 781c4f8b093b..a1b8e5f9b8b7 100644 --- a/sys/i386/i386/in_cksum.c +++ b/sys/i386/i386/in_cksum.c @@ -61,8 +61,195 @@ __FBSDID("$FreeBSD$"); #undef ADDCARRY #define ADDCARRY(x) if ((x) > 0xffff) (x) -= 0xffff +#if !defined(__GNUC__) || defined(__INTEL_COMPILER) +/* non gcc parts stolen from sys/alpha/alpha/in_cksum.c */ +#define REDUCE32 \ + { \ + q_util.q = sum; \ + sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ + } +#define REDUCE16 \ + { \ + q_util.q = sum; \ + l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ + sum = l_util.s[0] + l_util.s[1]; \ + ADDCARRY(sum); \ + } +#endif #define REDUCE {sum = (sum & 0xffff) + (sum >> 16); ADDCARRY(sum);} +#if !defined(__GNUC__) || defined(__INTEL_COMPILER) +static const u_int32_t in_masks[] = { + /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ + 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ + 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ + 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ + 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ +}; + +union l_util { + u_int16_t s[2]; + u_int32_t l; +}; +union q_util { + u_int16_t s[4]; + u_int32_t l[2]; + u_int64_t q; +}; + +static u_int64_t +in_cksumdata(const u_int32_t *lw, int len) +{ + u_int64_t sum = 0; + u_int64_t prefilled; + int offset; + union q_util q_util; + + if ((3 & (long) lw) == 0 && len == 20) { + sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4]; + REDUCE32; + return sum; + } + + if ((offset = 3 & (long) lw) != 0) { + const u_int32_t *masks = in_masks + (offset << 2); + lw = (u_int32_t *) (((long) lw) - offset); + sum = *lw++ & masks[len >= 3 ? 3 : len]; + len -= 4 - offset; + if (len <= 0) { + REDUCE32; + return sum; + } + } +#if 0 + /* + * Force to cache line boundary. + */ + offset = 32 - (0x1f & (long) lw); + if (offset < 32 && len > offset) { + len -= offset; + if (4 & offset) { + sum += (u_int64_t) lw[0]; + lw += 1; + } + if (8 & offset) { + sum += (u_int64_t) lw[0] + lw[1]; + lw += 2; + } + if (16 & offset) { + sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; + lw += 4; + } + } +#endif + /* + * access prefilling to start load of next cache line. + * then add current cache line + * save result of prefilling for loop iteration. + */ + prefilled = lw[0]; + while ((len -= 32) >= 4) { + u_int64_t prefilling = lw[8]; + sum += prefilled + lw[1] + lw[2] + lw[3] + + lw[4] + lw[5] + lw[6] + lw[7]; + lw += 8; + prefilled = prefilling; + } + if (len >= 0) { + sum += prefilled + lw[1] + lw[2] + lw[3] + + lw[4] + lw[5] + lw[6] + lw[7]; + lw += 8; + } else { + len += 32; + } + while ((len -= 16) >= 0) { + sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; + lw += 4; + } + len += 16; + while ((len -= 4) >= 0) { + sum += (u_int64_t) *lw++; + } + len += 4; + if (len > 0) + sum += (u_int64_t) (in_masks[len] & *lw); + REDUCE32; + return sum; +} + +u_short +in_addword(u_short a, u_short b) +{ + u_int64_t sum = a + b; + + ADDCARRY(sum); + return (sum); +} + +u_short +in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c) +{ + u_int64_t sum; + union q_util q_util; + union l_util l_util; + + sum = (u_int64_t) a + b + c; + REDUCE16; + return (sum); +} + +u_short +in_cksum_skip(struct mbuf *m, int len, int skip) +{ + u_int64_t sum = 0; + int mlen = 0; + int clen = 0; + caddr_t addr; + union q_util q_util; + union l_util l_util; + + len -= skip; + for (; skip && m; m = m->m_next) { + if (m->m_len > skip) { + mlen = m->m_len - skip; + addr = mtod(m, caddr_t) + skip; + goto skip_start; + } else { + skip -= m->m_len; + } + } + + for (; m && len; m = m->m_next) { + if (m->m_len == 0) + continue; + mlen = m->m_len; + addr = mtod(m, caddr_t); +skip_start: + if (len < mlen) + mlen = len; + if ((clen ^ (long) addr) & 1) + sum += in_cksumdata((const u_int32_t *)addr, mlen) << 8; + else + sum += in_cksumdata((const u_int32_t *)addr, mlen); + + clen += mlen; + len -= mlen; + } + REDUCE16; + return (~sum & 0xffff); +} + +u_int in_cksum_hdr(const struct ip *ip) +{ + u_int64_t sum = in_cksumdata((const u_int32_t *)ip, sizeof(struct ip)); + union q_util q_util; + union l_util l_util; + + REDUCE16; + return (~sum & 0xffff); +} +#else + /* * These asm statements require __volatile because they pass information * via the condition codes. GCC does not currently provide a way to specify @@ -270,3 +457,4 @@ in_cksum_skip(m, len, skip) REDUCE; return (~sum & 0xffff); } +#endif diff --git a/sys/i386/include/_types.h b/sys/i386/include/_types.h index 93c2a36cc822..69f439d891c9 100644 --- a/sys/i386/include/_types.h +++ b/sys/i386/include/_types.h @@ -54,7 +54,7 @@ typedef unsigned int __uint32_t; typedef long long __int64_t; /* LONGLONG */ typedef unsigned long long __uint64_t; -#elif defined(__GNUC__) +#elif defined(__GNUC__) || defined(__INTEL_COMPILER) typedef int __attribute__((__mode__(__DI__))) __int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; #else @@ -113,12 +113,12 @@ typedef __uint32_t __vm_size_t; /* * Unusual type definitions. */ -#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) +#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)) 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 /* ! (__GNUC__ post 2.95 || __INTEL_COMPILER) */ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) #define __GNUC_VA_LIST typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ #endif diff --git a/sys/i386/include/atomic.h b/sys/i386/include/atomic.h index c05befafad35..feba60695a4e 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -75,7 +75,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) /* * For userland, assume the SMP case and use lock prefixes so that @@ -101,12 +101,12 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ } \ struct __hack -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ /* * Atomic compare and set, used by the mutex functions @@ -116,7 +116,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(__GNUC__) || defined(__INTEL_COMPILER) #if defined(I386_CPU) || defined(CPU_DISABLE_CMPXCHG) @@ -168,9 +168,9 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) #endif /* defined(I386_CPU) */ -#endif /* defined(__GNUC__) */ +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #if defined(I386_CPU) @@ -226,7 +226,7 @@ struct __hack #endif /* defined(I386_CPU) */ -#else /* !defined(__GNUC__) */ +#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */ extern int atomic_cmpset_int(volatile u_int *, u_int, u_int); @@ -234,7 +234,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__) */ +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ #endif /* KLD_MODULE */ @@ -410,7 +410,7 @@ ATOMIC_PTR(subtract) #undef ATOMIC_PTR -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__INTEL_COMPILER) static __inline u_int atomic_readandclear_int(volatile u_int *addr) @@ -442,12 +442,12 @@ atomic_readandclear_long(volatile u_long *addr) return (result); } -#else /* !defined(__GNUC__) */ +#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */ extern u_long atomic_readandclear_long(volatile u_long *); extern u_int atomic_readandclear_int(volatile u_int *); -#endif /* defined(__GNUC__) */ +#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ diff --git a/sys/i386/include/bus_at386.h b/sys/i386/include/bus_at386.h index 277badd0400b..38c71bac3968 100644 --- a/sys/i386/include/bus_at386.h +++ b/sys/i386/include/bus_at386.h @@ -292,7 +292,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: movb (%2),%%al \n\ @@ -301,6 +301,10 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -321,7 +325,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: movw (%2),%%ax \n\ @@ -330,6 +334,10 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -350,7 +358,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: movl (%2),%%eax \n\ @@ -359,6 +367,10 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -399,7 +411,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: inb %w2,%%al \n\ @@ -409,6 +421,10 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -418,7 +434,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -426,6 +442,10 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -441,7 +461,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: inw %w2,%%ax \n\ @@ -451,6 +471,10 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -460,7 +484,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -468,6 +492,10 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -483,7 +511,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: inl %w2,%%eax \n\ @@ -493,6 +521,10 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=d" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -502,7 +534,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -510,6 +542,10 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (addr), "=c" (count), "=S" (_port_) : "0" (addr), "1" (count), "2" (_port_) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -631,7 +667,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -640,6 +676,10 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -660,7 +700,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -669,6 +709,10 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -689,7 +733,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -698,6 +742,10 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=S" (addr), "=c" (count) : "r" (bsh + offset), "0" (addr), "1" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -739,7 +787,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -749,6 +797,10 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -758,7 +810,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -766,6 +818,10 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -781,7 +837,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -791,6 +847,10 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -800,7 +860,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -808,6 +868,10 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -823,7 +887,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -833,6 +897,10 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=d" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "%eax", "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -842,7 +910,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm __volatile(" \n\ cld \n\ repne \n\ @@ -850,6 +918,10 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, "=D" (_port_), "=S" (addr), "=c" (count) : "0" (_port_), "1" (addr), "2" (count) : "memory", "cc"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } #endif @@ -1221,11 +1293,15 @@ 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__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else __asm __volatile("" : : : "memory"); +#else +# ifndef lint +# error "no assembler code for your compiler" +# endif #endif } diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 6d00fff30409..5b092f01d5af 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -52,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)) -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) static __inline void breakpoint(void) @@ -614,7 +614,7 @@ intr_restore(register_t eflags) write_eflags(eflags); } -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ int breakpoint(void); u_int bsfl(u_int mask); @@ -679,7 +679,7 @@ void wbinvd(void); void write_eflags(u_int ef); void wrmsr(u_int msr, u_int64_t newval); -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ void reset_dbregs(void); diff --git a/sys/i386/include/critical.h b/sys/i386/include/critical.h index 17f75ebd9c58..8ddc7ef1576d 100644 --- a/sys/i386/include/critical.h +++ b/sys/i386/include/critical.h @@ -46,7 +46,7 @@ __BEGIN_DECLS */ void cpu_critical_fork_exit(void); -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) /* * cpu_critical_enter: @@ -81,12 +81,12 @@ cpu_critical_exit(void) intr_restore(curthread->td_md.md_savecrit); } -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ void cpu_critical_enter(void); void cpu_critical_exit(void); -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ __END_DECLS diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h index dc924b1d3046..1bdea69d8a84 100644 --- a/sys/i386/include/endian.h +++ b/sys/i386/include/endian.h @@ -40,6 +40,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * Define the order of 32-bit words in 64-bit words. */ @@ -67,7 +71,17 @@ #define BYTE_ORDER _BYTE_ORDER #endif -#ifdef __GNUC__ +#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) #define __word_swap_int_var(x) \ __extension__ ({ register __uint32_t __X = (x); \ @@ -168,7 +182,7 @@ __bswap16(__uint16_t _x) #define __ntohl(x) __bswap32(x) #define __ntohs(x) __bswap16(x) -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian) */ /* * No optimizations are available for this compiler. Fall back to @@ -177,6 +191,10 @@ __bswap16(__uint16_t _x) */ #define _BYTEORDER_FUNC_DEFINED -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian */ + +#ifdef __cplusplus +} +#endif #endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/sys/i386/include/ieeefp.h b/sys/i386/include/ieeefp.h index ac67be183eb1..48011f71aea1 100644 --- a/sys/i386/include/ieeefp.h +++ b/sys/i386/include/ieeefp.h @@ -98,7 +98,7 @@ typedef enum { #define FP_RND_OFF 10 /* round control offset */ #define FP_STKY_OFF 0 /* sticky flags offset */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) #define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) @@ -151,7 +151,7 @@ __fpsetreg(int _m, int _reg, int _fld, int _off) return _p; } -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ /* * SysV/386 FP control interface diff --git a/sys/i386/include/in_cksum.h b/sys/i386/include/in_cksum.h index b1cb3f8d98a4..69eb509967ec 100644 --- a/sys/i386/include/in_cksum.h +++ b/sys/i386/include/in_cksum.h @@ -53,7 +53,7 @@ * in the normal case (where there are no options and the header length is * therefore always exactly five 32-bit words. */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) static __inline u_int in_cksum_hdr(const struct ip *ip) { @@ -115,7 +115,6 @@ in_pseudo(u_int sum, u_int b, u_int c) } #else -u_int in_cksum_hdr(const struct ip *); #define in_cksum_update(ip) \ do { \ int __tmpsum; \ @@ -126,7 +125,12 @@ u_int in_cksum_hdr(const struct ip *); #endif #ifdef _KERNEL -u_short in_cksum_skip(struct mbuf *m, int len, int skip); +#if !defined(__GNUC__) || 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); +#endif +u_short in_cksum_skip(struct mbuf *m, int len, int skip); #endif /* _KERNEL */ #endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/sys/i386/include/ioctl_bt848.h b/sys/i386/include/ioctl_bt848.h index 7ef237b00e2f..c87c4b9320a4 100644 --- a/sys/i386/include/ioctl_bt848.h +++ b/sys/i386/include/ioctl_bt848.h @@ -29,7 +29,7 @@ #ifndef _MACHINE_IOCTL_BT848_H_ #define _MACHINE_IOCTL_BT848_H_ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #warning Include dev/bktr/ioctl_bt848.h instead of this header. #endif diff --git a/sys/i386/include/ioctl_meteor.h b/sys/i386/include/ioctl_meteor.h index 69d033e6573e..c9595ded5bb1 100644 --- a/sys/i386/include/ioctl_meteor.h +++ b/sys/i386/include/ioctl_meteor.h @@ -29,7 +29,7 @@ #ifndef _MACHINE_IOCTL_METEOR_H_ #define _MACHINE_IOCTL_METEOR_H_ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #warning Include dev/bktr/ioctl_meteor.h instead of this header. #endif diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 357f52e4e600..6552ea9fa449 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -59,7 +59,7 @@ 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(__GNUC__) || defined (__INTEL_COMPILER) /* * Evaluates to the byte offset of the per-cpu variable name. diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index 4af818429894..ecad115f012d 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -82,7 +82,7 @@ extern int mcount_lock; #define _MCOUNT_DECL static __inline void _mcount -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define MCOUNT \ void \ mcount() \ @@ -105,13 +105,13 @@ mcount() \ frompc = ((uintfptr_t *)frompc)[1]; \ _mcount(frompc, selfpc); \ } -#else /* __GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #define MCOUNT \ void \ mcount() \ { \ } -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ typedef unsigned int uintfptr_t; @@ -145,7 +145,7 @@ void stopguprof(struct gmonparam *p); #include __BEGIN_DECLS -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) void mcount(void) __asm(".mcount"); #endif __END_DECLS diff --git a/sys/i386/include/stdarg.h b/sys/i386/include/stdarg.h index 128fb33e5c79..ce59c7f4813a 100644 --- a/sys/i386/include/stdarg.h +++ b/sys/i386/include/stdarg.h @@ -46,7 +46,7 @@ typedef __va_list va_list; #endif -#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) +#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)) #define va_start(ap, last) \ __builtin_stdarg_start((ap), (last)) @@ -62,12 +62,12 @@ typedef __va_list va_list; #define va_end(ap) \ __builtin_va_end(ap) -#else /* ! __GNUC__ post GCC 2.95 */ +#else /* ! (__GNUC__ post GCC 2.95 || __INTEL_COMPILER) */ #define __va_size(type) \ (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) #define va_start(ap, last) \ ((ap) = (va_list)__builtin_next_arg(last)) #else /* non-GNU compiler */ @@ -78,6 +78,11 @@ typedef __va_list va_list; #define va_arg(ap, type) \ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) +#if __ISO_C_VISIBLE >= 1999 +#define va_copy(dest, src) \ + ((dest) = (src)) +#endif + #define va_end(ap) #endif /* __GNUC__ post GCC 2.95 */ diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 76919fe94870..731733acaec6 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -101,7 +101,7 @@ __FBSDID("$FreeBSD$"); #define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1) #define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2) -#if defined(__GNUC__) && !defined(lint) +#if (defined(__GNUC__) && !defined(lint)) || defined(__INTEL_COMPILER) #define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) #define fnclex() __asm("fnclex") @@ -119,7 +119,7 @@ __FBSDID("$FreeBSD$"); : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm("clts") -#else /* not __GNUC__ */ +#else /* !((__GNUC__ && !lint ) || __INTEL_COMPILER) */ void fldcw(caddr_t addr); void fnclex(void); @@ -136,7 +136,7 @@ void fxrstor(caddr_t addr); void start_emulating(void); void stop_emulating(void); -#endif /* __GNUC__ */ +#endif /* (__GNUC__ && !lint ) || __INTEL_COMPILER */ #ifdef CPU_ENABLE_SSE #define GET_FPU_CW(thread) \ diff --git a/sys/i386/isa/prof_machdep.c b/sys/i386/isa/prof_machdep.c index 4c3a21e2135e..31b1c2a16059 100644 --- a/sys/i386/isa/prof_machdep.c +++ b/sys/i386/isa/prof_machdep.c @@ -69,7 +69,7 @@ static struct gmonparam saved_gmp; #endif #endif /* GUPROF */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __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__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ #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. */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm(" \n\ .text \n\ # \n\ @@ -168,9 +168,9 @@ __cyg_profile_func_exit: \n\ .mexitcount_exit: \n\ ret \n\ "); -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ /* * Return the time elapsed since the last call. The units are machine- @@ -346,7 +346,7 @@ stopguprof(gp) } #else /* !GUPROF */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) __asm(" \n\ .text \n\ .p2align 4,0x90 \n\ @@ -354,7 +354,7 @@ __asm(" \n\ " __XSTRING(HIDENAME(mexitcount)) ": \n\ ret \n\ "); -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #error -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ #endif /* GUPROF */ diff --git a/sys/kern/subr_prof.c b/sys/kern/subr_prof.c index b31e516bcc86..7fed7e9b71d6 100644 --- a/sys/kern/subr_prof.c +++ b/sys/kern/subr_prof.c @@ -225,7 +225,7 @@ kmstartup(dummy) startguprof(p); for (i = 0; i < CALIB_SCALE; i++) -#if defined(__i386__) && __GNUC__ >= 2 +#if defined(__i386__) && (__GNUC__ >= 2 || defined(__INTEL_COMPILER)) __asm("pushl %0; call __mcount; popl %%ecx" : : "i" (profil) @@ -238,7 +238,7 @@ kmstartup(dummy) startguprof(p); for (i = 0; i < CALIB_SCALE; i++) -#if defined(__i386__) && __GNUC__ >= 2 +#if defined(__i386__) && (__GNUC__ >= 2 || defined(__INTEL_COMPILER)) __asm("call " __XSTRING(HIDENAME(mexitcount)) "; 1:" : : : "ax", "bx", "cx", "dx", "memory"); __asm("movl $1b,%0" : "=rm" (tmp_addr)); @@ -550,7 +550,7 @@ addupc_task(struct thread *td, uintptr_t pc, u_int ticks) PROC_UNLOCK(p); } -#if defined(__i386__) && __GNUC__ >= 2 +#if defined(__i386__) && __GNUC__ >= 2 && !defined(__INTEL_COMPILER) /* * Support for "--test-coverage --profile-arcs" in GCC. * diff --git a/sys/libkern/quad.h b/sys/libkern/quad.h index 0e48e1232db8..6f636a57310d 100644 --- a/sys/libkern/quad.h +++ b/sys/libkern/quad.h @@ -108,15 +108,5 @@ u_quad_t __udivdi3(u_quad_t a, u_quad_t b); u_quad_t __umoddi3(u_quad_t a, u_quad_t b); int __ucmpdi2(u_quad_t a, u_quad_t b); -/* - * XXX - * Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument - * as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use - * both compilers. - */ -#if __GNUC__ >= 2 typedef unsigned int qshift_t; -#else -typedef u_quad_t qshift_t; -#endif #endif /* _LIBKERN_QUAD_H */ diff --git a/sys/netatm/atm_ioctl.h b/sys/netatm/atm_ioctl.h index 43bc86f39e5d..1dc14b52c544 100644 --- a/sys/netatm/atm_ioctl.h +++ b/sys/netatm/atm_ioctl.h @@ -421,7 +421,7 @@ struct air_phy_stat_rsp { /* * PF_ATM ioctls */ -#if !defined(__GNUC__) +#if !(defined(__GNUC__) || defined(__INTEL_COMPILER)) #define AIOCCFG _IOW(A, 128, struct atmcfgreq) /* Configure i/f */ #define AIOCADD _IOW(A, 129, struct atmaddreq) /* Add (e.g. PVC) */ #define AIOCDEL _IOW(A, 130, struct atmdelreq) /* Delete */ diff --git a/sys/sys/assym.h b/sys/sys/assym.h index d3c8291e2d2b..9316a4e4996c 100644 --- a/sys/sys/assym.h +++ b/sys/sys/assym.h @@ -31,13 +31,14 @@ #ifndef _SYS_ASSYM_H_ #define _SYS_ASSYM_H_ +#define ASSYM_BIAS 0x10000 /* avoid zero-length arrays */ #define ASSYM_ABS(value) ((value) < 0 ? -((value) + 1) + 1ULL : (value)) -#define ASSYM(name, value) \ -char name ## sign[(value) < 0 ? 1 : 0]; \ -char name ## w0[ASSYM_ABS(value) & 0xFFFFU]; \ -char name ## w1[(ASSYM_ABS(value) & 0xFFFF0000UL) >> 16]; \ -char name ## w2[(ASSYM_ABS(value) & 0xFFFF00000000ULL) >> 32]; \ -char name ## w3[(ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48] +#define ASSYM(name, value) \ +char name ## sign[((value) < 0 ? 1 : 0) + ASSYM_BIAS]; \ +char name ## w0[(ASSYM_ABS(value) & 0xFFFFU) + ASSYM_BIAS]; \ +char name ## w1[((ASSYM_ABS(value) & 0xFFFF0000UL) >> 16) + ASSYM_BIAS]; \ +char name ## w2[((ASSYM_ABS(value) & 0xFFFF00000000ULL) >> 32) + ASSYM_BIAS]; \ +char name ## w3[((ASSYM_ABS(value) & 0xFFFF000000000000ULL) >> 48) + ASSYM_BIAS] #endif /* !_SYS_ASSYM_H_ */ diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index f8eae841b38c..dd4acd903d72 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -51,7 +51,7 @@ /* * Macro to test if we're using a specific version of gcc or later. */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else @@ -83,9 +83,9 @@ #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else -#ifndef __GNUC__ +#if !(defined(__GNUC__) || defined(__INTEL_COMPILER)) #define __inline /* delete GCC keyword */ -#endif /* !__GNUC__ */ +#endif /* !(__GNUC__ || __INTEL_COMPILER) */ #endif /* !__cplusplus */ #else /* !(__STDC__ || __cplusplus) */ @@ -93,7 +93,7 @@ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" -#ifndef __GNUC__ +#if !(defined(__GNUC__) || defined(__INTEL_COMPILER)) #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed @@ -112,7 +112,7 @@ #define signed #define volatile #endif /* !NO_ANSI_KEYWORDS */ -#endif /* !__GNUC__ */ +#endif /* !(__GNUC__ || __INTEL_COMPILER) */ #endif /* !(__STDC__ || __cplusplus) */ /* @@ -132,12 +132,12 @@ #define __aligned(x) #define __section(x) #else -#if !__GNUC_PREREQ__(2, 5) +#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) #define __dead2 #define __pure2 #define __unused #endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 +#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused @@ -151,9 +151,17 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif +#if defined(__INTEL_COMPILER) +#define __dead2 __attribute__((__noreturn__)) +#define __pure2 __attribute__((__const__)) +#define __unused __attribute__((__unused__)) +#define __packed __attribute__((__packed__)) +#define __aligned(x) __attribute__((__aligned__(x))) +#define __section(x) __attribute__((__section__(x))) +#endif #endif -#if __GNUC_PREREQ__(3, 1) +#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #define __always_inline __attribute__((__always_inline__)) #else #define __always_inline @@ -166,11 +174,11 @@ #endif /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ -#if !__GNUC_PREREQ__(2, 7) +#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __func__ NULL #endif -#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 +#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #define __LONG_LONG_SUPPORTED #endif @@ -236,7 +244,7 @@ * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ -#if !__GNUC_PREREQ__(2, 7) +#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #else @@ -247,16 +255,18 @@ #endif /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ -#if __FreeBSD_cc_version >= 300001 +#if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #else #define __printf0like(fmtarg, firstvararg) #endif -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifndef __INTEL_COMPILER #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); +#endif #ifdef __STDC__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ @@ -274,9 +284,9 @@ __asm__(".asciz \"msg\""); \ __asm__(".previous") #endif /* __STDC__ */ -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else /* diff --git a/sys/sys/dir.h b/sys/sys/dir.h index 670850ac37ef..1f74c60b6d1c 100644 --- a/sys/sys/dir.h +++ b/sys/sys/dir.h @@ -37,7 +37,7 @@ #ifndef _SYS_DIR_H_ #define _SYS_DIR_H_ -#if __GNUC__ +#if defined(__GNUC__) || defined (__INTEL_COMPILER) #warning "The information in this file should be obtained from " #warning "and is provided solely (and temporarily) for backward compatibility." #endif diff --git a/sys/sys/ioctl.h b/sys/sys/ioctl.h index c18b22dda7ba..6666b22ed384 100644 --- a/sys/sys/ioctl.h +++ b/sys/sys/ioctl.h @@ -43,7 +43,7 @@ #define _SYS_IOCTL_H_ #ifdef _KERNEL -#if __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #warning "Don't #include ioctl.h in the kernel. Include xxxio.h instead." #endif #endif diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index f025e18db14d..5550ed1d714e 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -39,16 +39,16 @@ /* * Private macros, not to be used outside this header file. */ -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __MAKE_SET(set, sym) \ static void const * const __set_##set##_sym_##sym \ __section("set_" #set) __unused = &sym -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ #ifndef lint -#error "This file needs to be compiled by GCC or lint" +#error "This file needs to be compiled by GCC, an Intel compiler or lint" #endif /* lint */ #define __MAKE_SET(set, sym) extern void const * const (__set_##set##_sym_##sym) -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ /* * Public macros. diff --git a/sys/sys/param.h b/sys/sys/param.h index 85b0b07e3087..a403f8db8bba 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -59,7 +59,7 @@ * scheme is: <0 if release branch, otherwise 1>xx */ #undef __FreeBSD_version -#define __FreeBSD_version 502107 /* Master, propagated to newvers */ +#define __FreeBSD_version 502108 /* Master, propagated to newvers */ #ifndef LOCORE #include diff --git a/sys/sys/queue.h b/sys/sys/queue.h index b8758472bffa..ae79a21f89fa 100644 --- a/sys/sys/queue.h +++ b/sys/sys/queue.h @@ -521,7 +521,7 @@ struct quehead { struct quehead *qh_rlink; }; -#ifdef __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) static __inline void insque(void *a, void *b) @@ -545,12 +545,12 @@ remque(void *a) element->qh_rlink = 0; } -#else /* !__GNUC__ */ +#else /* !(__GNUC__ || __INTEL_COMPILER) */ void insque(void *a, void *b); void remque(void *a); -#endif /* __GNUC__ */ +#endif /* __GNUC__ || __INTEL_COMPILER */ #endif /* _KERNEL */ diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h index 7f14ae92c156..ed14be74a79a 100644 --- a/sys/sys/syslimits.h +++ b/sys/sys/syslimits.h @@ -38,7 +38,7 @@ #define _SYS_SYSLIMITS_H_ #if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_) -#if __GNUC__ +#if defined(__GNUC__) || defined(__INTEL_COMPILER) #warning "No user-serviceable parts inside." #endif #endif