freebsd-dev/sys/dev/cx/machdep.h
Tom Rhodes a122cca953 These are changes to allow to use the Intel C/C++ compiler (lang/icc)
to build the kernel. It doesn't affect the operation if gcc.

Most of the changes are just adding __INTEL_COMPILER to #ifdef's, as
icc v8 may define __GNUC__ some parts may look strange but are
necessary.

Additional changes:
 - in_cksum.[ch]:
   * use a generic C version instead of the assembly version in the !gcc
     case (ASM code breaks with the optimizations icc does)
     -> no bad checksums with an icc compiled kernel
     Help from:		andre, grehan, das
     Stolen from: 	alpha version via ppc version
     The entire checksum code should IMHO be replaced with the DragonFly
     version (because it isn't guaranteed future revisions of gcc will
     include similar optimizations) as in:
        ---snip---
          Revision  Changes    Path
          1.12      +1 -0      src/sys/conf/files.i386
          1.4       +142 -558  src/sys/i386/i386/in_cksum.c
          1.5       +33 -69    src/sys/i386/include/in_cksum.h
          1.5       +2 -0      src/sys/netinet/igmp.c
          1.6       +0 -1      src/sys/netinet/in.h
          1.6       +2 -0      src/sys/netinet/ip_icmp.c

          1.4       +3 -4      src/contrib/ipfilter/ip_compat.h
          1.3       +1 -2      src/sbin/natd/icmp.c
          1.4       +0 -1      src/sbin/natd/natd.c
          1.48      +1 -0      src/sys/conf/files
          1.2       +0 -1      src/sys/conf/files.amd64
          1.13      +0 -1      src/sys/conf/files.i386
          1.5       +0 -1      src/sys/conf/files.pc98
          1.7       +1 -1      src/sys/contrib/ipfilter/netinet/fil.c
          1.10      +2 -3      src/sys/contrib/ipfilter/netinet/ip_compat.h
          1.10      +1 -1      src/sys/contrib/ipfilter/netinet/ip_fil.c
          1.7       +1 -1      src/sys/dev/netif/txp/if_txp.c
          1.7       +1 -1      src/sys/net/ip_mroute/ip_mroute.c
          1.7       +1 -2      src/sys/net/ipfw/ip_fw2.c
          1.6       +1 -2      src/sys/netinet/igmp.c
          1.4       +158 -116  src/sys/netinet/in_cksum.c
          1.6       +1 -1      src/sys/netinet/ip_gre.c
          1.7       +1 -2      src/sys/netinet/ip_icmp.c
          1.10      +1 -1      src/sys/netinet/ip_input.c
          1.10      +1 -2      src/sys/netinet/ip_output.c
          1.13      +1 -2      src/sys/netinet/tcp_input.c
          1.9       +1 -2      src/sys/netinet/tcp_output.c
          1.10      +1 -1      src/sys/netinet/tcp_subr.c
          1.10      +1 -1      src/sys/netinet/tcp_syncache.c
          1.9       +1 -2      src/sys/netinet/udp_usrreq.c

          1.5       +1 -2      src/sys/netinet6/ipsec.c
          1.5       +1 -2      src/sys/netproto/ipsec/ipsec.c
          1.5       +1 -1      src/sys/netproto/ipsec/ipsec_input.c
          1.4       +1 -2      src/sys/netproto/ipsec/ipsec_output.c

          and finally remove
            sys/i386/i386        in_cksum.c
            sys/i386/include     in_cksum.h
        ---snip---
 - endian.h:
   * DTRT in C++ mode
 - quad.h:
   * we don't use gcc v1 anymore, remove support for it
   Suggested by:	bde (long ago)
 - assym.h:
   * avoid zero-length arrays (remove dependency on a gcc specific
     feature)
     This change changes the contents of the object file, but as it's
     only used to generate some values for a header, and the generator
     knows how to handle this, there's no impact in the gcc case.
   Explained by:	bde
   Submitted by:	Marius Strobl <marius@alchemy.franken.de>
 - aicasm.c:
   * minor change to teach it about the way icc spells "-nostdinc"
   Not approved by:	gibbs (no reply to my mail)
 - bump __FreeBSD_version (lang/icc needs to know about the changes)

Incarnations of this patch survive gcc compiles since a loooong time,
I use it on my desktop. An icc compiled kernel works since Nov. 2003
(exceptions: snd_* if used as modules), it survives a build of the
entire ports collection with icc.

Parts of this commit contains suggestions or submissions from
Marius Strobl <marius@alchemy.franken.de>.

Reviewed by:	-arch
Submitted by:	netchild
2004-03-12 21:45:33 +00:00

97 lines
2.4 KiB
C

/*
* Cronyx DDK: platform dependent definitions.
*
* Copyright (C) 1998-1999 Cronyx Engineering
* Author: Alexander Kvitchenko, <aak@cronyx.ru>
*
* Copyright (C) 2001-2003 Cronyx Engineering.
* Author: Roman Kurakin, <rik@cronyx.ru>
*
* This software is distributed with NO WARRANTIES, not even the implied
* warranties for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Authors grant any other persons or organisations permission to use
* or modify this software as long as this message is kept with the software,
* all derivative works or modified versions.
*
* Cronyx Id: machdep.h,v 1.3.4.3 2003/11/27 14:21:58 rik Exp $
* $FreeBSD$
*/
/*
* DOS (Borland Turbo C++ 1.0)
*/
#if defined (MSDOS) || defined (__MSDOS__)
# include <dos.h>
# include <string.h>
# define inb(port) inportb(port)
# define inw(port) inport(port)
# define outb(port,b) outportb(port,b)
# define outw(port,w) outport(port,w)
# define GETTICKS() biostime(0,0L)
#else
/*
* Windows NT
*/
#ifdef NDIS_MINIPORT_DRIVER
# include <string.h>
# define inb(port) inp((unsigned short)(port))
# define inw(port) inpw((unsigned short)(port))
# define outb(port,b) outp((unsigned short)(port),b)
# define outw(port,w) outpw((unsigned short)(port),(unsigned short)(w))
#pragma warning (disable: 4761)
#pragma warning (disable: 4242)
#pragma warning (disable: 4244)
#define ulong64 unsigned __int64
#else
/*
* Linux
*/
#ifdef __linux__
# undef REALLY_SLOW_IO
# include <asm/io.h> /* should swap outb() arguments */
# include <linux/string.h>
# include <linux/delay.h>
static inline void __ddk_outb (unsigned port, unsigned char byte)
{ outb (byte, port); }
static inline void __ddk_outw (unsigned port, unsigned short word)
{ outw (word, port); }
# undef outb
# undef outw
# define outb(port,val) __ddk_outb(port, val)
# define outw(port,val) __ddk_outw(port, val)
# define GETTICKS() (jiffies * 200 / 11 / HZ)
#else
/*
* FreeBSD and BSD/OS
*/
#ifdef __FreeBSD__
# include <sys/param.h>
# include <machine/cpufunc.h>
# include <sys/libkern.h>
# include <sys/systm.h>
# define memset(a,b,c) bzero (a,c)
# if __FreeBSD_version > 501000
# define port_t int
# endif
#endif
#endif
#endif
#endif
#ifndef inline
# if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
# define inline __inline__
# else
# define inline /**/
# endif
#endif
#ifndef ulong64
#define ulong64 unsigned long long
#endif