Date: Sun, 02 Feb 2014 13:00:04 -0700 From: Ian Lepore <ian@FreeBSD.org> To: freebsd-arm <freebsd-arm@FreeBSD.org> Cc: Bernd Walter <ticso@cicely7.cicely.de> Subject: wandboard / imx6 / exynos4 / cortex-a9 "wrong-endian bug" fixed Message-ID: <1391371204.13026.43.camel@revolution.hippie.lan>
next in thread | raw e-mail | index | archive | help
As some of you know from previous email or irc conversations, I've been chasing a strange bug for months that affects some cortex-a9 chips, which I've been calling the "wrong-endian bug", where some registers get restored with wrong-endian values on return from an interrupt, leading to a panic or crash during boot. I finally tracked the cause down to our gnu assembler (gas), which apparently thinks that when you say "msr spsr_all, r0" what you meant by "_all" was "only restore 16 of the 32 bits". It's not a bug per se, it's just how the gas authors think the assembler should behave. So, when the chip powers on there may be some garbage bits in the spsr register, and they would never get cleared out because only some of the bits would get restored, and if the big-endian bit was among them Bad Things Happened. I'm not sure why this only affected some cortex-a9 chips such as imx6, but maybe some chips set those registers to zero and some don't at power-on. I fixed the problem by updating our source code to use the newer arm instruction syntax for msr and msr instructions, which ensures all 32 bits get restored. That change happened in r261393, but because of other changes and churn in the tree the first really stable revision that includes the fix is r261410. So if you're working with wandboard or another imx6-based system, please make sure to update to this rev. -- Ian
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1391371204.13026.43.camel>