[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test
From: |
M. Warner Losh |
Subject: |
Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test |
Date: |
Sat, 03 Mar 2007 06:24:52 -0700 (MST) |
In message: <address@hidden>
Andreas Schwab <address@hidden> writes:
: Paul Brook <address@hidden> writes:
:
: >> : I find this curious... C99 (6.7.2.1) says "the allocation order of
: >> : bit-fields within a unit (high-order to low-order or low-order to
: >> : high-order) is implementation defined". I can't see any requirement
: >> : for this, so is it just convention that bitfields on big endian systems
: >> : start from the most significant bit, and those on little endian systems
: >> : start from the least significant bit? (My thinking is that endianness
: >> : usually refers to byte ordering and not so much bit ordering.)
: >>
: >> This is a convention that goes back a very long ways. It was this way
: >> in the mid 1980's, and has remained true through today. I've
: >> personally observed this to be the case on many different MIPS
: >> compilers, ARM compilers and SPARC compilers over the years.
: >
: > I'm fairly sure I've seen targets that use other bitfield orderings, though
I
: > can't remember offhand what they were.
:
: Bi-endian targets are examples of this. The bitfield ordering is normally
: independent of the selected byte order. For example, big-endian MIPS has
: little endian bit order.
Except that compilers use the convention that was described above.
Big endian MIPS definitely uses a different bit ordering for C bit
fields than little endian MIPS. This is true for compilers from SGI,
DEC and GNU and NetBSD, FreeBSD, Linux, Ultrix, OSF, and IRIX. All of
them use the following, or variants for, say, the IP header:
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
unsigned int ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
unsigned int ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
...
Warner
- [Qemu-devel] [PATCH] pcnet32 driver change, please test, Thiemo Seufer, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Thiemo Seufer, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Stuart Brady, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, M. Warner Losh, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Paul Brook, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, M. Warner Losh, 2007/03/02
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Andreas Schwab, 2007/03/03
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test,
M. Warner Losh <=
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Andreas Schwab, 2007/03/03
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, M. Warner Losh, 2007/03/03
- Re: [Qemu-devel] [PATCH] pcnet32 driver change, please test, Andreas Schwab, 2007/03/03