summaryrefslogtreecommitdiffstats
path: root/sys/i386/include/endian.h
Commit message (Collapse)AuthorAgeFilesLines
* Initiate deorbit burn sequence for 80386 support in FreeBSD: Removejhb2004-11-161-10/+0
| | | | 80386 (I386_CPU) support from the kernel.
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* These are changes to allow to use the Intel C/C++ compiler (lang/icc)trhodes2004-03-121-3/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Microoptimization to allow the compiler to evaluate ntohl() etc onpeter2003-09-221-4/+49
| | | | | | | | | | | | known constants at compile time rather than at run time. We have a number of nasty hacks around the place to cache ntohl() of constants (eg: nfs). This change allows the compiler to compile-time evaluate ntohl(1) as 0x01000000 rather than having to emit assembler code to do it. This has other smaller flow-on effects because the compiler can see that ntohl(constant) itself has a constant value now and can propagate the compile time evaluation. Obtained from: Ideas from NetBSD and Linux, and some code from NetBSD
* Style sync.obrien2003-08-031-0/+1
|
* Be careful not to define GCC-specific optimizations in the non-GCCmike2002-09-231-2/+11
| | | | case.
* o Merge <machine/ansi.h> and <machine/types.h> into a new headermike2002-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | called <machine/_types.h>. o <machine/ansi.h> will continue to live so it can define MD clock macros, which are only MD because of gratuitous differences between architectures. o Change all headers to make use of this. This mainly involves changing: #ifdef _BSD_FOO_T_ typedef _BSD_FOO_T_ foo_t; #undef _BSD_FOO_T_ #endif to: #ifndef _FOO_T_DECLARED typedef __foo_t foo_t; #define _FOO_T_DECLARED #endif Concept by: bde Reviewed by: jake, obrien
* Add manifest constants: _LITTLE_ENDIAN, _BIG_ENDIAN, _PDP_ENDIAN, andmike2002-04-101-6/+15
| | | | | | _BYTE_ORDER. These are far more useful than their non-underscored equivalents as these can be used in restricted namespace environments. Mark the non-underscored variants as deprecated.
* o Don't require long long support in bswap64() functions.mike2002-03-091-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | o In i386's <machine/endian.h>, macros have some advantages over inlines, so change some inlines to macros. o In i386's <machine/endian.h>, ungarbage collect word_swap_int() (previously __uint16_swap_uint32), it has some uses on i386's with PDP endianness. Submitted by: bde o Move a comment up in <machine/endian.h> that was accidentially moved down a few revisions ago. o Reenable userland's use of optimized inline-asm versions of byteorder(3) functions. o Fix ordering of prototypes vs. redefinition of byteorder(3) functions, so that the non-GCC (libc asm) case has proper prototypes. o Add proper prototypes for byteorder(3) functions in <sys/param.h>. o Prevent redundant duplicate prototypes by making use of the _BYTEORDER_PROTOTYPED define. o Move the bswap16(), bswap32(), bswap64() C functions into MD space for platforms in which asm versions don't exist. This significantly reduces the complexity of some things at the cost of duplicate code. Reviewed by: bde
* Add the following functions/macros to support byte order conversions andtmm2002-02-271-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | device drivers for bus system with other endinesses than the CPU (using interfaces compatible to NetBSD): - bwap16() and bswap32(). These have optimized implementations on some architectures; for those that don't, there exist generic implementations. - macros to convert from a certain byte order to host byte order and vice versa, using a naming scheme like le16toh(), htole16(). These are implemented using the bswap functions. - stream bus space access functions, which do not perform a byte order conversion (while the normal access functions would if the bus endianess differs from the CPU endianess). htons(), htonl(), ntohs() and ntohl() are implemented using the new functions above for kernel usage. None of the above interfaces is currently exported to user land. Make use of the new functions in a few places where local implementations of the same functionality existed. Reviewed by: mike, bde Tested on alpha by: mike
* Add C++ support.mike2002-02-191-0/+5
|
* o Move NTOHL() and associated macros into <sys/param.h>. These aremike2002-02-181-39/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | deprecated in favor of the POSIX-defined lowercase variants. o Change all occurrences of NTOHL() and associated marcros in the source tree to use the lowercase function variants. o Add missing license bits to sparc64's <machine/endian.h>. Approved by: jake o Clean up <machine/endian.h> files. o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>. o Remove prototypes for non-existent bswapXX() functions. o Include <machine/endian.h> in <arpa/inet.h> to define the POSIX-required ntohl() family of functions. o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>, and <sys/param.h>. o Prepend underscores to the ntohl() family to help deal with complexities associated with having MD (asm and inline) versions, and having to prevent exposure of these functions in other headers that happen to make use of endian-specific defines. o Create weak aliases to the canonical function name to help deal with third-party software forgetting to include an appropriate header. o Remove some now unneeded pollution from <sys/types.h>. o Add missing <arpa/inet.h> includes in userland. Tested on: alpha, i386 Reviewed by: bde, jake, tmm
* Various assembly fixes mostly in the form of using the "+" modifier forjhb2001-12-181-7/+7
| | | | | | | output operands to mark them as both input and output rather than listing operands twice. Reviewed by: bde
* Whitespace fixes so thre 386 versoion of __uint8_swap_uint32 is easier tojhb2001-11-281-2/+4
| | | | read.
* o Remove some GCCisms in src/powerpc/include/endian.h.mike2001-08-301-10/+11
| | | | | | | | | | | | | | | | | | | | o Unify <machine/endian.h>'s across all architectures. o Make bswapXX() functions use a different spelling of u_int16_t and friends to reduce namespace pollution. The bswapXX() functions don't actually exist, but we'll probably import these at some point. Atleast one driver (if_de) depends on bswapXX() for big endian cases. o Deprecate byteorder(3) prototypes from <sys/types.h>, these are now prototyped indirectly in <arpa/inet.h>. o Deprecate in_addr_t and in_port_t typedefs in <sys/types.h>, these are now typedef'd in <arpa/inet.h>. o Change byteorder(3) prototypes to use standards compliant uint32_t (spelled __uint32_t to reduce namespace pollution). o Document new preferred headers and standards compliance. Discussed with: bde PR: 29946 Reviewed by: bmilekic
* Back out wrapping the asm ... ; bits in #ifndef lint macros. Theremarkm2001-04-141-6/+0
| | | | | | | | | | | | | | | | | are some good reasons for not doing this, even if the linting of the code breaks. 1) If lint were ever to understand the stuff inside the macros, that would break the checks. 2) There are ways to use __GNUC__ to exclude overly specific code. 3) (Not yet practical) Lint(1) needs to properlyu understand all of te code we actually run. Complained about by: bde Education by: jake, jhb, eivind
* Make this more lint-friendly. This file seems to be invoked in justmarkm2001-04-131-4/+10
| | | | | about any .c file that includes a .h, and lint produces copious whining because of the asm ...; stuff.
* Spell what was originally "unsigned long" as "unsigned long" again,dwmalone2001-03-061-4/+4
| | | | | | | to cut down on some compiler warnings caused by lexically mismatched types. Reviewed by: bde
* Quick fix for namespace problems which broke many ports. Spellbde2000-10-281-6/+6
| | | | | uint16_t as "unsigned short" like it used to be and uint32_t as "unsigned int" not like it used to be (was: "unsigned long").
* Move __uint16_swap_uint32, __uint8_swap_uint32 andbrian2000-10-161-2/+4
| | | | | | __uint8_swap_uint16 inside __GNUC__. Reviewed by: bde
* Remove namespace polution (x -> __x) introduced in the lastbrian2000-10-151-10/+10
| | | | | | revision. Pointed out by: bde
* Redefine __word_swap_long, __byte_swap_long and __byte_swap_wordbrian2000-10-151-34/+31
| | | | | | | | as inline functions, renaming them to __uint16_swap_uint32, __uint8_swap_uint32 and __uint8_swap_uint16. Doing it properly suggested by: msmith Reviewed by: msmith
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-2/+2
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Put I*86_CPU options in opt_global.h and don't #include "opt_cpu.h"bde1997-08-311-5/+1
| | | | centrally.
* Fixed linting of and compilation of the gcc byte-swapping macrosbde1997-04-201-15/+12
| | | | | | | | | | | | | | | properly. Simply don't use the gcc macros if we're not gcc, and declare prototypes for the byte-swapping functions in case the macro versions are not used. The previous fix was wrong and broke libpcap, which abuses -Dlint. Don't pollute the namespace if _POSIX_SOURCE is defined. This is broken - it makes almost everything in <machine/endian.h> inaccessible if _POSIX_SOURCE is defined, yet <machine/endian.h> is not a POSIX header. Other systems don't do it any better. Removed always-false `BYTE_ORDER == BIG_ENDIAN' ifdef. Obtained from: partly from Lite(2?) and NetBSD
* Don't try to lint the gcc extension byte-swapping macros.nate1997-03-171-2/+2
| | | | Submitted by: Eivind Eklund <eivind@dimaga.com>
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Make LKM's build again. I have added the allegedly brokendyson1996-12-071-0/+4
| | | | | | | | ACTUALLY_LKM_NOT_KERNEL until the real fix comes through. Whatever flag that is used to indicate building LKMs will have be be substituted in the future. This allows proper selection of the usage of the efficient, single instruction in the kernel, but alas, doesn't allow for use in userland or LKMs :-(. Them's the breaks!!!
* Change endian.h so that when a kernel is compiled without I386_CPU, anddyson1996-12-071-2/+2
| | | | | | | with one of the following (I486_CPU,I586_CPU,I686_CPU) so it can take advantage of the very quick bswap insn. This keeps LKMs from being built to take advantage of the insn, but also makes sure that the LKMs can be run on all CPUs. (The LKMs don't pick up the CPU options :-( ).
* Relax the constraints on the bswap opcode (it works on non-bytedyson1996-11-291-24/+16
| | | | | | registers.) Also clean up some namespace pollution, and remove gcc-1 support (nothing really works with it anymore anyway.) Submitted by: Bruce Evans <bde@freebsd.org> and me.
* Support the appropriate use of bswap instruction on non-I386 builds.dyson1996-11-291-1/+10
| | | | | | Per Wayne Scott of Intel, the old sequence took 20cycles!!! on a P6. Another nice side-benefit is that the kernel is about 3K smaller!!! Submitted by: Wayne Scott <wscott@ichips.intel.com>
* When compiling with '-Wall -pedantic', the byte swapping macros gave thenate1996-10-211-3/+3
| | | | | | | | | following warning: warning: ANSI C forbids braced-groups within expressions Adding __extension__ before the statement-expression seems to work right. Submitted by: bde (a *long* time ago)
* Rename the local variable used by various macros outside the user'sjkh1995-02-121-21/+21
| | | | | namespace. Reported-By: "Philippe Charnier" <charnier@lirmm.fr>
* Change "asm" to "__asm" - makes it possible to compile code withcsgr1994-09-101-6/+6
| | | | "-ansi" compiler switch set.
* adding libc/quad:alm1993-12-191-1/+7
| | | | | | added _QUAD_HIGH/LOW added (U_)QUAD_MAX/MIN (from NetBSD)
* Made all header files idempotent and moved incorrect common data fromwollman1993-11-071-1/+5
| | | | | headers into a related source file. Added cons.h as first step towards moving i386/i386/cons.h to machine/cons.h where it belongs.
* Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, somergrimes1993-10-161-9/+2
| | | | minor cleanup. Added $Id$ to files that did not have any version info, etc
* Initial import, 0.1 + pk 0.2.4-B1rgrimes1993-06-121-0/+117
OpenPOWER on IntegriCloud