WLAN from SDIO to SPI: battle plan
Joerg Reisenweber
joerg at openmoko.org
Thu Aug 28 16:26:39 CEST 2008
Am Mi 27. August 2008 schrieb Andy Green:
> 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.
I remember when writing TTY-driver code in assembler for BS2000 back in 1985,
there were all sorts of PACK and ALIGN16 and ALIGN32 directives to cope with
that. There was good reason they were there.
Think in COBOL-M there were similar options for data and linkage section.
Just a nearly OT annotation ;-) Sorry couldn't resist as these low-level
machine interfaces were my favorite battlefield
cheers
jOERG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20080828/08c17f59/attachment.pgp
More information about the openmoko-kernel
mailing list