Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Jan 2008 13:15:49 -0600 (CST)
From:      Mark Tinguely <tinguely@casselton.net>
To:        imp@bsdimp.com, jhay@meraka.org.za
Cc:        freebsd-arm@freebsd.org, des@freebsd.org
Subject:   Re: sshd broken on arm?
Message-ID:  <200801181915.m0IJFndO057697@casselton.net>
In-Reply-To: <20080118185634.GA28843@zibbi.meraka.csir.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help

<deleted background on sshd failing>

>  Hmmm Just to make sure that I'm on the right page. On FreeBSD ARM one
>  is not supposed to be able to access unaligned memory? Ie. an int that
>  does not start on an address that is a multiple of 4.

Some ARM implementation can be programmed to do unaligned accesses, but
yes, halfword, word and long word accesses must be properly aligned.

>  In a C function if you have something like "char tmp[4]", can you assume
>  that the compiler will align it on a 4 byte boundary or can it do it on
>  a byte boundary?

No it will not automatically be align correctly to be used as a integer.

>  If one cannot access unaligned ints and char arrays are not int aligned,
>  then we were just lucky that the code worked at some stage.

The items above this array were probably a multiple of 4 bytes and something
has changed in a structure to make this no longer true. You can find the
offending structure and pad it to make it a multiple of 4 bytes, or cheat
and declare a integer before the char array.

--Mark Tinguely



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801181915.m0IJFndO057697>