Hello Gordon;
> Maybe I've been staring at the problem too long, but it looks like on
> the ARM (even compiling natively on a NetWinder), a pointer
> to a struct
> points to the first element of the struct (no surprise
> there), but this
> is actually the highest address of the element.
>
> For example:
> struct foo_t { u16 x; };
> foo_t foo;
>
> so that:
> &foo = 0x204da35
> &foo.x = 0x204da35
>
> But if you assign foo.x = 4 you get this in memory:
>
> 0x204da34 = 0x04
> 0x204da35 = 0x00
> 0x204da36 = 0x00
>
> But the same code compiled on an i386 results in this:
>
> 0x204da34 = 0x00
> 0x204da35 = 0x04
> 0x204da36 = 0x00
>
> I'm not sure if I can fix this using alignment magic in the compiler.
Your problem is that the compiler is padding the structure. Try:
struct foo_t { u16 x; } __attribute__ packed;
Best Regards,
--George
Received on Thu Sep 14 15:33:58 2000
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:42 EDT