From 25a282dabc5fb656a1402c26920974d129ef7917 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 13 Jan 2014 13:24:30 -0800 Subject: arm: Thumb ALL the things! This patch switches every last part of Coreboot on ARM over to Thumb mode: libpayload, the internal libgcc, and assorted assembly files. In combination with the respective depthcharge patch, this will switch to Thumb mode right after the entry point of the bootblock and not switch back to ARM until the final assembly stub that jumps to the kernel. The required changes to make this work include some new headers and Makefile flags to handle assembly files (using the unified syntax and the same helper macros as Linux), modifying our custom-written libgcc code for 64-bit division to support Thumb (removing some stale old files that were never really used for clarity), and flipping the general CFLAGS to Thumb (some more cleanup there as well while I'm at it). BUG=None TEST=Snow and Nyan still boot. Original-Change-Id: I80c04281e3adbf74f9f477486a96b9fafeb455b3 Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/182212 Original-Reviewed-by: Gabe Black (cherry picked from commit 5f65c17cbfae165a95354146ae79e06c512c2c5a) Conflicts: payloads/libpayload/include/arm/arch/asm.h src/arch/arm/Makefile.inc src/arch/arm/armv7/Makefile.inc *** There is an issue with what to do with ramstage-S-ccopts, and *** will need to be covered in additional ARM cleanup patches. Change-Id: I80c04281e3adbf74f9f477486a96b9fafeb455b3 Signed-off-by: Marc Jones Reviewed-on: http://review.coreboot.org/6930 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/arch/arm/Makefile.inc | 7 ++++++- payloads/libpayload/include/arm/arch/asm.h | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) (limited to 'payloads/libpayload') diff --git a/payloads/libpayload/arch/arm/Makefile.inc b/payloads/libpayload/arch/arm/Makefile.inc index 0078ffe845..2f8da1570a 100644 --- a/payloads/libpayload/arch/arm/Makefile.inc +++ b/payloads/libpayload/arch/arm/Makefile.inc @@ -27,7 +27,8 @@ ## SUCH DAMAGE. ## -CFLAGS += -mfloat-abi=hard -marm -mabi=aapcs-linux -march=armv7-a +CFLAGS += -mthumb -march=armv7-a +arm_asm_flags = -Wa,-mthumb -Wa,-mimplicit-it=always -Wa,-mno-warn-deprecated head.o-y += head.S libc-y += main.c sysinfo.c @@ -37,3 +38,7 @@ libc-y += memcpy.S memset.S memmove.S libc-y += exception_asm.S exception.c libc-y += cache.c cpu.S libcbfs-$(CONFIG_LP_CBFS) += dummy_media.c + +# Add other classes here when you put assembly files into them! +head.o-S-ccopts += $(arm_asm_flags) +libc-S-ccopts += $(arm_asm_flags) diff --git a/payloads/libpayload/include/arm/arch/asm.h b/payloads/libpayload/include/arm/arch/asm.h index 2f8859939c..9e9e7ceff4 100644 --- a/payloads/libpayload/include/arm/arch/asm.h +++ b/payloads/libpayload/include/arm/arch/asm.h @@ -20,16 +20,17 @@ #ifndef __ARM_ASM_H #define __ARM_ASM_H -#if defined __arm__ -# define ARM(x...) x -# define THUMB(x...) -# define W(instr) instr -#elif defined __thumb__ +/* __arm__ is defined regardless of Thumb mode, so need to order this right */ +#if defined __thumb2__ # define ARM(x...) # define THUMB(x...) x # define W(instr) instr.w +#elif defined __thumb__ +# error You are not compiling Thumb2, this won't work! #else -# error Not in ARM or thumb mode! +# define ARM(x...) x +# define THUMB(x...) +# define W(instr) instr #endif #define ALIGN .align 0 @@ -46,4 +47,10 @@ #define END(name) \ .size name, .-name +/* Everything should go into the text section by default. */ + .text + +/* Thumb code uses the (new) unified assembly syntax. */ +THUMB( .syntax unified ) + #endif /* __ARM_ASM_H */ -- cgit v1.2.3