[Olsr-dev] alignment problems on FreeBSD-arm with inbuf and msg_buffer
Henning Rogge
(spam-protected)
Mon Mar 23 13:53:18 CET 2009
On Montag 23 März 2009 13:46:36 you wrote:
> On Mon, Mar 23, 2009 at 01:34:05PM +0100, Henning Rogge wrote:
> > 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;
>
> That would also work.
I have pushed the change to the repository... can you test it ?
http://gredler.at/hg/olsrd-0.5.6/rev/7af4361b1dd1
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/77f46564/attachment.sig>
More information about the Olsr-dev
mailing list