Re: usb: descriptor structures have to be packed

Oleg Verych <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Palacky University in Olomouc, experimental physics department.
Message-ID <[email protected]>
On Wed, Feb 07, 2007 at 10:58:17PM +0000, Phil Endecott wrote:
[]
> This patch is:
> "Prevent an unaligned exception to occur.  (GCC 4.1) tmp is defined as char
> pointer while it is later accessed as short."
> 
> This is, in a sense, the opposite of what we're looking at.  There they 
> have added aligned(2) to a char; that makes it more aligned so it's 
> safe.  Adding packed attributes reduces the alignment, which is not 
> always safe.

Your intro pseudo-code:

|   g() {
|      char c;
|      struct S s; /* packed or not */
|      (s.intfield)++;
|      f(&s);
|   }

Due to `c', `s' gets to be unaligned, i.e. light turned before you've
touched a switch: layout of `c' is independed, it's a byte, not followed
by a byte, thus must be padded. No?.

If this wasn't acknowledged by gcc guys as a bug, maybe bigger-first,
manual padding is solution (or many other things, that original
developers have in mind, rather than haven't, while implementing,
testing, using GCC).

Anyways, i salute to guys, who have made AVR and MSP430 GCC ports, thus i
could get some understanding of things. And, i think, they are ordinary:
as me and you. So what's the problem to hack and to send patch? Of
course, ARM stuff is buried alive in chips, users, etc (:.

(still slight off topic, sorry if any)
____

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.