-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Somebody in the thread at some point said: | HI: | Yes. it works after remove "__attribute__((__packed__))" | | #arm-angstrom-linux-gnueabi-objdump -d ./cpu/arm920t/s3c24x0/spi.o | .... | d0: e59d2004 ldr r2, [sp, #4] | d4: e3a0304f mov r3, #79 ; 0x4f | d8: e582300c str r3, [r2, #12] | dc: e59d2004 ldr r2, [sp, #4] | e0: e3a03001 mov r3, #1 ; 0x1 | e4: e5823008 str r3, [r2, #8] | e8: e59d2004 ldr r2, [sp, #4] | ec: e283301e add r3, r3, #30 ; 0x1e | f0: e5823000 str r3, [r2] | f4: e3a01000 mov r1, #0 ; 0x0 | f8: e2811001 add r1, r1, #1 ; 0x1 | fc: e59d2004 ldr r2, [sp, #4] | 100: e3a030ff mov r3, #255 ; 0xff | | I see the same problem, if use "__packed__" attribute, GCC | will compile with byte-access code which may takes more | instruction. Say, update a counter, and it can't keep it ATOMIC access, | may produce race, or data corrupt.
You need __packed__ if the start of your struct pointer may not be aligned to 32-bit boundary, but you want to access 32-bit items in there. This happens in network processing code for example, the struct representing the packet payload can easily be at funny alignment due to snipped headers from earlier protocols. You don't need it for dealing with a bunch of 32-bit registers always found on 32-bit boundaries. - -Andy -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAki1cO0ACgkQOjLpvpq7dMplwQCdHdDw3fn9uUdWbjUJ/xWPePRO LcAAnR4cL34rnwpZhc+tptJPtDfqQDt+ =B9rW -----END PGP SIGNATURE-----
