This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bitfields: types vs modes?


> http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042c/IHI0042C_aapcs.pdf
> 
> and, in particular, \S 7.1.7.5, entitled "Volatile bit-fields".
> 
> A first question is if these are the semantics that you're looking for
> in your project.  If so, then we could collaborate with you on
> implementing them.  If not, there may be still be some common parts.

Yes, that's pretty much what they asked for.  However, it is still
somewhat ambiguous - for example, if you have an 8-bit "int" field,
which 4 bytes are read to get that field?  Should we take into
consideration adjacent field types, or the type's natural alignment?
What if the field spans natural alignment boundaries?  What if the
larger-than-field access exceeds the memory region and causes a fault?

For example, in this case, when we access x.b does it also read a, or
c?  Will reading x.d cause a segment fault?

volatile struct {
	char a:8;
	int b:24;
	char c:8;
	int d:8;
	} x;

We need to figure out how much information we should pass to the
target to let it make these decisions, if it needs to.  A common
function to do by-type access could be called from your target and
mine.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]