11.0-CURRENT (r292413) on a rpi2b: arm-gnueabi-freebsd/bin/ar, _fseeko, and memset vs memory alignment (SCTRL bit[1]=1?): Explains the Bus error?
Andrew Turner
andrew at fubar.geek.nz
Mon Dec 28 14:08:09 UTC 2015
On Mon, 28 Dec 2015 03:33:09 -0800
Mark Millard <markmi at dsl-only.net> wrote:
...
> The failing code is for the "placement new" in the loop:
>
> A) &getArgBuffer()[I] is not always an address for which the vst1.64
> instruction gets an aligned address.
>
> but. . .
>
> B) TemplateArgument(Args[I])'s copy construction activity has code
> (such as the vst1.64) requiring a specific alignment when SCTLR
> bit[1]==1.
>
> C) Nothing here has any explicitly packed data structures.
The bug is we enable the alignment checks in the kernel. Compilers
assume there are no alignment checks on ARMv7. We have taught gcc to
generate worse code on FreeBSD because of this.
There was some concern about reading non-naturally aligned data in the
kernel not being atomic, this could be checked by, in debug
configurations, enabling alignment checks on entry to the kernel and
disabling them on exit. We could also have a flag for clang to tell it
we are in the kernel, there is already something similar for iOS.
Andrew
More information about the freebsd-arm
mailing list