[Olsr-dev] alignment problems on FreeBSD-arm with inbuf and msg_buffer
Henning Rogge
(spam-protected)
Mon Mar 23 13:34:05 CET 2009
On Montag 23 März 2009 13:24:18 John Hay wrote:
> Hi,
>
> Trying to get the latest 0.5.6 tip working on FreeBSD-current on an ARM
> processor, I encountered bus errors which I traced back to the inbuf
> and msg_buffer arrays that are non-aligned and cause the bus error as
> soon as a 16 bit or 32 bit variable is read or written to it.
>
> I do not understand why I have not encountered it before because it
> looks like inbuf and msg_buffer has been like that for some time.
> Maybe the compiler changed or the functions used to access those
> variables.
>
> My fix was to put the arrays in an union with an int. Is there a
> better way?
What do you think about this ?
> -static char inbuf[MAXMESSAGESIZE + 1];
> +static uint32_t inbuf_alinged[(MAXMESSAGESIZE+4)/sizeof(uint32_t)];
> +static char *inbuf = (char *)inbuf_aligned;
Henning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20090323/8a05e432/attachment.sig>
More information about the Olsr-dev
mailing list