Subject: Re: Bitfields and kernel
To: Brian C. Grayson <bgrayson@marvin.ece.utexas.edu>
From: Simon Burge <simonb@netbsd.org>
List: tech-kern
Date: 09/29/1999 10:10:24
"Brian C. Grayson" wrote:

>   Is there any inherent reason why using bitfields in the kernel
> would be evil?  For example, for some PPC stuff, I'd rather have code
> like (off-the-top-of-my-head, so forgive semantic goof-ups):

Isn't the powerpc capable of operating bi-endian?  Then you'd end up
with something like:

typedef struct {
#if _BYTE_ORDER == _LITTLE_ENDIAN
  unsigned int reserved0_12:13;
  unsigned int pow:1;
  unsigned int reserved14:1;
  unsigned int ile:1;
#else
  unsigned int ile:1;
  unsigned int reserved14:1;
  unsigned int pow:1;
  unsigned int reserved0_12:13;
#endif
} reg_msr_t;

Look at some of the headers in sys/arch/mips/include to see how ugly
this gets...

Simon.