[Olsr-dev] alignment problems on FreeBSD-arm with inbuf and msg_buffer

John Hay (spam-protected)
Mon Mar 23 17:06:21 CET 2009


On Mon, Mar 23, 2009 at 01:53:18PM +0100, Henning Rogge wrote:
> 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

Can you do the same for msg_buffer in lq_packet.c?

John
-- 
John Hay -- (spam-protected) / (spam-protected)




More information about the Olsr-dev mailing list