Date: Mon, 28 Dec 2015 14:07:29 +0000 From: Andrew Turner <andrew@fubar.geek.nz> To: Mark Millard <markmi@dsl-only.net> Cc: Warner Losh <imp@bsdimp.com>, mat@FreeBSD.org, freebsd-arm <freebsd-arm@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Ian Lepore <ian@FreeBSD.org> Subject: Re: 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? Message-ID: <20151228140729.565c9dc6@zapp.Home> In-Reply-To: <9DA7895D-B3DE-41FD-900C-EC95BDE19728@dsl-only.net> References: <4CC6220D-72FB-45AD-AE70-5EB4EF0BCF5C@dsl-only.net> <DB75F0D6-86CB-4383-8653-6017C76729F9@dsl-only.net> <A338272B-982F-4E1F-B87D-1E33815EA212@dsl-only.net> <0D81C2CA-BF1C-4C14-B816-A8C5F68715B5@bsdimp.com> <51EB4AAB-BC81-4282-BA4D-D329C41D660B@dsl-only.net> <8B52074F-FDEF-4119-BB04-630F9BE9E6DB@bsdimp.com> <BBAAE33E-BD65-40A3-A0B3-F3346FC08112@dsl-only.net> <DC9EE7C3-2763-44EF-91DA-AFE63C48E537@dsl-only.net> <D38C49E3-B622-49EA-9B30-3B1B2FA2E569@bsdimp.com> <118D2970-4799-46B1-81A1-0101B907C1BE@dsl-only.net> <9DA7895D-B3DE-41FD-900C-EC95BDE19728@dsl-only.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Dec 2015 03:33:09 -0800 Mark Millard <markmi@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20151228140729.565c9dc6>