summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/armlinux.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-12-10 16:41:07 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-03-06 09:37:59 +0100
commit104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee (patch)
tree9775e9211293396220d225d7a4746c3d06a837ec /arch/arm/lib/armlinux.c
parentcb1bd905dcacd8abd2703f6ce61fc09db8e475a4 (diff)
downloadbarebox-104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee.tar.gz
barebox-104a6a7ccfb7928ca5dc28c8cbe0ea231ffc45ee.tar.xz
ARM: Allow to compile in thumb-2 mode
This shrinks the resulting binary size by ~25%. Exceptions are still handled in arm mode, so we have to explicitely put .arm directives into the exception code. Thumb-2 mode has been tested on i.MX51 Babbage board. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/armlinux.c')
-rw-r--r--arch/arm/lib/armlinux.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 85fe2b9f66..a167036db5 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -255,6 +255,7 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
{
void (*kernel)(int zero, int arch, void *params) = adr;
void *params = NULL;
+ int architecture;
if (oftree) {
printf("booting Linux kernel with devicetree\n");
@@ -272,5 +273,19 @@ void start_linux(void *adr, int swap, unsigned long initrd_address,
__asm__ __volatile__("mcr p15, 0, %0, c1, c0" :: "r" (reg));
}
- kernel(0, armlinux_get_architecture(), params);
+ architecture = armlinux_get_architecture();
+
+#ifdef CONFIG_THUMB2_BAREBOX
+ __asm__ __volatile__ (
+ "mov r0, #0\n"
+ "mov r1, %0\n"
+ "mov r2, %1\n"
+ "bx %2\n"
+ :
+ : "r" (architecture), "r" (params), "r" (kernel)
+ : "r0", "r1", "r2"
+ );
+#else
+ kernel(0, architecture, params);
+#endif
}