union/struct representations for MAS Registers

Jimi Xenidis jimix at pobox.com
Thu Aug 11 03:31:45 EST 2011


On Aug 10, 2011, at 12:25 PM, David Laight wrote:

> 
>> I have some and use them in some code, they represent ISA 
>> 2.06 MAVN=1 (version 2)
>> Can I keep them?
>> if so, should I put them somewhere useful to others?
>> 
>> Examples:
>> union mas1 {
>> 	u32 _val;
>> 	struct {
>> 		u32 v:1;
>> 		u32 iprot:1;
>> 		u32 tid:14;
>> 		u32 _reserved_1:2;
>> 		u32 ind:1;
>> 		u32 ts:1;
>> 		u32 tsize:4;
>> 		u32 _reserved_2:8;
>> 	};
>> };
> 
> Bitfields are rather non-portable, the compiler has a lot of choice
> about how to align the bits in memory.

I'm ok with the masking stuff.
However, I'm actually surprised this is true given the maturity of our ABIs.

-JX
> Their use to map anything physical is doomed to portabilily issues.
> 
> 	David
> 
> 



More information about the Linuxppc-dev mailing list