diff options
author | Enrico Scholz <enrico.scholz@sigma-chemnitz.de> | 2012-01-02 11:49:17 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-01-02 13:07:08 +0100 |
commit | af42feb9d255bc3ea3b514180f265479ea8834f9 (patch) | |
tree | 95754bdadc623ba18e2d3bd99a4e1b3043307e3d | |
parent | b936cd4d687704770d33bfc6915c9506bf2fc46d (diff) | |
download | barebox-af42feb9d255bc3ea3b514180f265479ea8834f9.tar.gz barebox-af42feb9d255bc3ea3b514180f265479ea8834f9.tar.xz |
ARM: set SCTRL[A] only when architecture does not support unaligned access
Recent gcc generates code with unaligned access when architecture
supports it. Setting A bit unconditionally causes data-aborts on such
code rendering barebox unusable.
Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/cpu/start.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index dc1f5a8cd3..61d7e3e5d5 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -84,7 +84,16 @@ void __naked __bare_init reset(void) /* disable MMU stuff and caches */ r = get_cr(); r &= ~(CR_M | CR_C | CR_B | CR_S | CR_R | CR_V); - r |= CR_A | CR_I; + r |= CR_I; + + if (!(r & CR_U)) + /* catch unaligned access on architectures which do not + * support unaligned access */ + r |= CR_A; + else + r &= ~CR_A; + + #ifdef __ARMEB__ r |= CR_B; #endif |