Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
Hello Stefan, On Mon, 15 Dec 2014 22:06:11 +0100, Stefan Agner ste...@agner.ch wrote: Hi Andreas, On 2014-12-15 15:24, Andreas Färber wrote: Hi Stefan, Am 03.12.2014 um 18:04 schrieb Stefan Agner: Can this be fixed by the merger or should I create a new revision? It looks as if this was neither applied nor respun? I have some more patches to make CONFIG_USE_PRIVATE_LIBGCC build for Thumb that I would like to rebase on it. Not sure what the expectation is... Probably I should just do a respin since there are now three minor nits... Agreed, and assuming the three nits are cared for, I'd take it as a bugfix. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
Hi Stefan, Am 03.12.2014 um 18:04 schrieb Stefan Agner: Can this be fixed by the merger or should I create a new revision? It looks as if this was neither applied nor respun? I have some more patches to make CONFIG_USE_PRIVATE_LIBGCC build for Thumb that I would like to rebase on it. In particular, I have pieced together a tiny asm/unified.h file with THUMB() and ARM() macros and doing the .syntax unified in that central place, and resyncing the various arch/arm/lib/_*.S files from Linux. https://github.com/afaerber/u-boot/commits/stm32 Is there a particular reason you are doing the .syntax inline here? And looking beyond this patch, assuming this is for your Vybrid's M4, do you already have a concept for how to go about vectors.S, start.S and the like for ARMv7-M? :) I've stubbed them out for now but haven't managed to successfully link yet... Regards, Andreas -- SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 21284 AG Nürnberg ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
Hi Andreas, On 2014-12-15 15:24, Andreas Färber wrote: Hi Stefan, Am 03.12.2014 um 18:04 schrieb Stefan Agner: Can this be fixed by the merger or should I create a new revision? It looks as if this was neither applied nor respun? I have some more patches to make CONFIG_USE_PRIVATE_LIBGCC build for Thumb that I would like to rebase on it. Not sure what the expectation is... Probably I should just do a respin since there are now three minor nits... In particular, I have pieced together a tiny asm/unified.h file with THUMB() and ARM() macros and doing the .syntax unified in that central place, and resyncing the various arch/arm/lib/_*.S files from Linux. https://github.com/afaerber/u-boot/commits/stm32 Is there a particular reason you are doing the .syntax inline here? No particular reason other than laziness :-) And looking beyond this patch, assuming this is for your Vybrid's M4, do you already have a concept for how to go about vectors.S, start.S and the like for ARMv7-M? :) I've stubbed them out for now but haven't managed to successfully link yet... Actually no, I don't use U-Boot on the M4 (so far). For Linux on the Vybrid M4, I use a special boot loader which runs on the A5 Linux. On Vybrid (the variant we use at least) boots always from the A5 first, hence I have a running Linux. Or alternatively, I could run the M4 from U-Boot running on the A5. So far, I had no need to run U-Boot on the M4. The reason I was interested in Thumb2 was the size: Due to lack of 5V on the Colibri module we need to load the boot loader using Vybrid's serial loader over UART which is somewhat slow. So the 25% reduction of size means 25% less download time... -- Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
I tested these changes on several compilers and binutils. 4.3.3, 4.6.3, 4.7.2, 4.8.2 and 4.9.2 gcc with binutils 2.19, 2.21-24 in both THUMB and ARM on the Vybrid. It seem we must have an image = 224kB which is the IRAM bank0 size - 0x8000 of u-boot base; u-boot since v2014.04 will not boot for me as the QSPI seemed to take it over this boundary. The attached patches are meant to be attached as they aren't meant to be taken by patchworks, etc but just to show the small changes I made to minimize the image to less than 224kB. [build script] # File sizes similar because of 'mkimage' padding+hdr for 'imx'. # 2nd size is for the 'thumb2' builds. set -e ## (Sourcery CodeBench Lite 2012.03-56) 4.6.3 ## (Sourcery CodeBench Lite 2012.03-56) 2.21.53.20110905 # 227092 Dec 1 15:20 u-boot.imx # 173844 Dec 1 15:36 u-boot.imx export PATH=$PATH:$HOME/x-tools/arm-2012.03/bin ## 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601] ## GNU assembler (GNU Binutils) 2.23.2 # 222996 Dec 1 15:19 u-boot.imx # 173844 Dec 1 15:35 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-2013.q3/bin ## (crosstool-NG hg+default-9838aecd6340) 4.8.2 ## (GNU Binutils) 2.23.2 # 222996 Dec 1 15:18 u-boot.imx # 173844 Dec 1 15:34 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-eabi/bin ## (Sourcery G++ Lite 2009q1-161) 4.3.3 ## (Sourcery G++ Lite 2009q1-161) 2.19.51.20090205 # 218900 Dec 1 15:17 u-boot.imx - no CONFIG_SYS_LONGHELP # GCC does not produce working THUMB binaries. #export PATH=$PATH:/opt/arm-2009q1/bin NAME=arm-none-eabi- ## (crosstool-NG 1.20.0) 4.9.2 ## (crosstool-NG 1.20.0) 2.24 # 222996 Dec 1 15:21 u-boot.imx # 173844 Dec 1 15:32 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi-vybrid-4.9.2/bin/ ## (crosstool-NG hg+default-2a773bd38e71) 4.7.3 ## (crosstool-NG hg+default-2a773bd38e71) 2.22 # 222996 Dec 1 15:22 u-boot.imx # 173844 Dec 1 15:31 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi-4.7.2/bin ## (crosstool-NG hg+-c7fa97debb36) 4.6.3 ## (crosstool-NG hg+-c7fa97debb36) 2.21.1 # 227092 Dec 1 15:24 u-boot.imx # 173844 Dec 1 15:30 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi.gcc4.6.3/bin #NAME=arm-none-linux-gnueabi- ## (Timesys 20130708) 4.7.3 ## (Timesys 20130708) 2.23.2 # 227092 Dec 1 15:25 u-boot.imx # 173844 Dec 1 15:29 u-boot.imx #export PATH=$PATH:$HOME/x-tools/armv7l-timesys-linux-gnueabi/bin #NAME=armv7l-timesys-linux-gnueabi- ## (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 4.8.2 20131014 ## (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 2.23.2.20130610 Linaro 2013.10-4 # 222996 Dec 1 15:26 u-boot.imx # 173844 Dec 1 15:28 u-boot.imx #export PATH=$PATH:$HOME/x-tools/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin #NAME=arm-linux-gnueabihf- make CROSS_COMPILE=$NAME vf610twr_config make CROSS_COMPILE=$NAME $* u-boot.imx cp u-boot.imx /srv/tftp [end script] I applied Stefan's memcpy/thumb patch, reverted c6150aaf and applied 'fs/ext4/ext4fs.c, fs/fs.c fs/fat/fat_write.c: Adjust 64bit math methods' by Tom Rini tr...@ti.com (it has a little whitespace fat in it). All of the images booted on a Vybrid Tower (Rev H) from an SD card. Only issue is that I think the 'AFLAGS_NOWARN' can be removed as per below... On 21 Nov 2014, ste...@agner.ch wrote: Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. arch/arm/config.mk | 4 +- arch/arm/include/asm/assembler.h | 33 ++-- arch/arm/lib/memcpy.S | 80 +++- arch/arm/lib/memset.S | 112 --- 4 files changed, 142 insertions(+), 87 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index f0eafd6..14f4e9f 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -26,7 +26,9 @@ PLATFORM_CPPFLAGS +=
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
On 2014-12-03 16:44, Bill Pringlemeir wrote: I tested these changes on several compilers and binutils. 4.3.3, 4.6.3, 4.7.2, 4.8.2 and 4.9.2 gcc with binutils 2.19, 2.21-24 in both THUMB and ARM on the Vybrid. It seem we must have an image = 224kB which is the IRAM bank0 size - 0x8000 of u-boot base; u-boot since v2014.04 will not boot for me as the QSPI seemed to take it over this boundary. The attached patches are meant to be attached as they aren't meant to be taken by patchworks, etc but just to show the small changes I made to minimize the image to less than 224kB. [build script] # File sizes similar because of 'mkimage' padding+hdr for 'imx'. # 2nd size is for the 'thumb2' builds. set -e ## (Sourcery CodeBench Lite 2012.03-56) 4.6.3 ## (Sourcery CodeBench Lite 2012.03-56) 2.21.53.20110905 # 227092 Dec 1 15:20 u-boot.imx # 173844 Dec 1 15:36 u-boot.imx export PATH=$PATH:$HOME/x-tools/arm-2012.03/bin ## 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601] ## GNU assembler (GNU Binutils) 2.23.2 # 222996 Dec 1 15:19 u-boot.imx # 173844 Dec 1 15:35 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-2013.q3/bin ## (crosstool-NG hg+default-9838aecd6340) 4.8.2 ## (GNU Binutils) 2.23.2 # 222996 Dec 1 15:18 u-boot.imx # 173844 Dec 1 15:34 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-eabi/bin ## (Sourcery G++ Lite 2009q1-161) 4.3.3 ## (Sourcery G++ Lite 2009q1-161) 2.19.51.20090205 # 218900 Dec 1 15:17 u-boot.imx - no CONFIG_SYS_LONGHELP # GCC does not produce working THUMB binaries. #export PATH=$PATH:/opt/arm-2009q1/bin NAME=arm-none-eabi- ## (crosstool-NG 1.20.0) 4.9.2 ## (crosstool-NG 1.20.0) 2.24 # 222996 Dec 1 15:21 u-boot.imx # 173844 Dec 1 15:32 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi-vybrid-4.9.2/bin/ ## (crosstool-NG hg+default-2a773bd38e71) 4.7.3 ## (crosstool-NG hg+default-2a773bd38e71) 2.22 # 222996 Dec 1 15:22 u-boot.imx # 173844 Dec 1 15:31 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi-4.7.2/bin ## (crosstool-NG hg+-c7fa97debb36) 4.6.3 ## (crosstool-NG hg+-c7fa97debb36) 2.21.1 # 227092 Dec 1 15:24 u-boot.imx # 173844 Dec 1 15:30 u-boot.imx #export PATH=$PATH:$HOME/x-tools/arm-none-linux-gnueabi.gcc4.6.3/bin #NAME=arm-none-linux-gnueabi- ## (Timesys 20130708) 4.7.3 ## (Timesys 20130708) 2.23.2 # 227092 Dec 1 15:25 u-boot.imx # 173844 Dec 1 15:29 u-boot.imx #export PATH=$PATH:$HOME/x-tools/armv7l-timesys-linux-gnueabi/bin #NAME=armv7l-timesys-linux-gnueabi- ## (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 4.8.2 20131014 ## (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 2.23.2.20130610 Linaro 2013.10-4 # 222996 Dec 1 15:26 u-boot.imx # 173844 Dec 1 15:28 u-boot.imx #export PATH=$PATH:$HOME/x-tools/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin #NAME=arm-linux-gnueabihf- make CROSS_COMPILE=$NAME vf610twr_config make CROSS_COMPILE=$NAME $* u-boot.imx cp u-boot.imx /srv/tftp [end script] I applied Stefan's memcpy/thumb patch, reverted c6150aaf and applied 'fs/ext4/ext4fs.c, fs/fs.c fs/fat/fat_write.c: Adjust 64bit math methods' by Tom Rini tr...@ti.com (it has a little whitespace fat in it). All of the images booted on a Vybrid Tower (Rev H) from an SD card. Only issue is that I think the 'AFLAGS_NOWARN' can be removed as per below... On 21 Nov 2014, ste...@agner.ch wrote: Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. arch/arm/config.mk | 4 +- arch/arm/include/asm/assembler.h | 33 ++-- arch/arm/lib/memcpy.S | 80 +++- arch/arm/lib/memset.S | 112 --- 4 files changed, 142 insertions(+), 87 deletions(-) diff --git a/arch/arm/config.mk
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
Hi Stefan, On 21 November 2014 at 08:34, Stefan Agner ste...@agner.ch wrote: Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Reviewed-by: Simon Glass s...@chromium.org Tested on pit and found that it fixed the problem with Thumb mode. Still works fine in ARM mode. Tested-by: Simon Glass s...@chromium.org A few nits: - typo 'Hoever' in commit message - you could mention the Linux commit/release you synced to Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. arch/arm/config.mk | 4 +- arch/arm/include/asm/assembler.h | 33 ++-- arch/arm/lib/memcpy.S| 80 +++- arch/arm/lib/memset.S| 112 --- 4 files changed, 142 insertions(+), 87 deletions(-) Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
On 2014-11-30 20:33, Simon Glass wrote: Hi Stefan, On 21 November 2014 at 08:34, Stefan Agner ste...@agner.ch wrote: Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Reviewed-by: Simon Glass s...@chromium.org Tested on pit and found that it fixed the problem with Thumb mode. Still works fine in ARM mode. Tested-by: Simon Glass s...@chromium.org A few nits: - typo 'Hoever' in commit message - you could mention the Linux commit/release you synced to Thanks for testing Simon. The Linux commit/release I synced to was some 3.18-rcX. However, the relevant files did not change since 3.17, so we can add that as the synced version. -- Stefan Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. arch/arm/config.mk | 4 +- arch/arm/include/asm/assembler.h | 33 ++-- arch/arm/lib/memcpy.S| 80 +++- arch/arm/lib/memset.S| 112 --- 4 files changed, 142 insertions(+), 87 deletions(-) Regards, Simon ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
On 2014-11-21 16:34, Stefan Agner wrote: Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. Any thoughts on that? Would be nice to have it in 2015.01 as the current state breaks Thumb2 for our board. -- Stefan ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v2] arm: build arch memset/memcpy in Thumb2 mode
Resynchronize memcpy/memset with kernel and build them explicitly in Thumb2 mode (unified syntax). Those assembler files can be built and linked in ARM mode too, however when calling them from Thumb2 built code, the stack got corrupted and the copy did not succeed (the exact details have not been traced back). Hoever, the Linux kernel builds those files in Thumb2 mode. Hence U-Boot should build them in Thumb2 mode too when CONFIG_SYS_THUMB_BUILD is set. To build the files without warning, some assembler instructions had to be replaced with their UAL compliant variant (thanks Jeroen for this input). To build the file in Thumb2 mode the implicit-it=always option need to be set to generate Thumb2 compliant IT instructions where needed. We add this option to the general AFLAGS when building for Thumb2. Signed-off-by: Stefan Agner ste...@agner.ch --- Changes since v1: - Don't set auto-it in AFLAGS - Removed no-warn-deprecated warning suppression - Converted non-UAL assembler instructions to their UAL compliant variants Tested in ARM and Thumb2 mode on Vybrid SoC. Disassembled the memset/ memcpy object files before and after converting the instructions to UAL, the output was identical. arch/arm/config.mk | 4 +- arch/arm/include/asm/assembler.h | 33 ++-- arch/arm/lib/memcpy.S| 80 +++- arch/arm/lib/memset.S| 112 --- 4 files changed, 142 insertions(+), 87 deletions(-) diff --git a/arch/arm/config.mk b/arch/arm/config.mk index f0eafd6..14f4e9f 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -26,7 +26,9 @@ PLATFORM_CPPFLAGS += -D__ARM__ # Choose between ARM/Thumb instruction sets ifeq ($(CONFIG_SYS_THUMB_BUILD),y) -PF_CPPFLAGS_ARM := $(call cc-option, -mthumb -mthumb-interwork,\ +AFLAGS_IMPLICIT_IT := $(call as-option,-Wa$(comma)-mimplicit-it=always) +PF_CPPFLAGS_ARM:= $(AFLAGS_IMPLICIT_IT) $(AFLAGS_NOWARN) \ + $(call cc-option, -mthumb -mthumb-interwork,\ $(call cc-option,-marm,)\ $(call cc-option,-mno-thumb-interwork,)\ ) diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h index 5e4789b..11b80fb 100644 --- a/arch/arm/include/asm/assembler.h +++ b/arch/arm/include/asm/assembler.h @@ -14,12 +14,14 @@ * assembler source. */ +#include config.h + /* * Endian independent macros for shifting bytes within registers. */ #ifndef __ARMEB__ -#define pull lsr -#define push lsl +#define lspull lsr +#define lspush lsl #define get_byte_0 lsl #0 #define get_byte_1 lsr #8 #define get_byte_2 lsr #16 @@ -29,8 +31,8 @@ #define put_byte_2 lsl #16 #define put_byte_3 lsl #24 #else -#define pull lsl -#define push lsr +#define lspull lsl +#define lspush lsr #define get_byte_0 lsr #24 #define get_byte_1 lsr #16 #define get_byte_2 lsr #8 @@ -54,7 +56,28 @@ #define PLD(code...) #endif + .irpc,,eq,ne,cs,cc,mi,pl,vs,vc,hi,ls,ge,lt,gt,le,hs,lo + .macro ret\c, reg +#if defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) + mov\c pc, \reg +#else + .ifeqs \reg, lr + bx\c\reg + .else + mov\c pc, \reg + .endif +#endif + .endm + .endr + /* - * Cache alligned + * Cache aligned, used for optimized memcpy/memset + * In the kernel this is only enabled for Feroceon CPU's... + * We disable it especially for Thumb builds since those instructions + * are not made in a Thumb ready way... */ +#ifdef CONFIG_SYS_THUMB_BUILD +#define CALGN(code...) +#else #define CALGN(code...) code +#endif diff --git a/arch/arm/lib/memcpy.S b/arch/arm/lib/memcpy.S index f655256..eeaf003 100644 --- a/arch/arm/lib/memcpy.S +++ b/arch/arm/lib/memcpy.S @@ -10,9 +10,14 @@ * published by the Free Software Foundation. */ +#include linux/linkage.h #include asm/assembler.h +#ifdef CONFIG_SYS_THUMB_BUILD +#define W(instr) instr.w +#else #define W(instr) instr +#endif #define LDR1W_SHIFT0 #define STR1W_SHIFT0 @@ -30,7 +35,7 @@ .endm .macro ldr1b ptr reg cond=al abort - ldr\cond\()b \reg, [\ptr], #1 + ldrb\cond\() \reg, [\ptr], #1 .endm .macro str1w ptr reg abort @@ -42,7 +47,7 @@ .endm .macro str1b ptr reg cond=al abort - str\cond\()b \reg, [\ptr], #1 + strb\cond\() \reg, [\ptr], #1 .endm .macro enter reg1 reg2 @@ -56,10 +61,12 @@ .text /* Prototype: void *memcpy(void *dest, const void *src, size_t n); */ - -.globl memcpy -memcpy: - + .syntax unified +#ifdef CONFIG_SYS_THUMB_BUILD + .thumb + .thumb_func +#endif +ENTRY(memcpy) cmp r0, r1 moveq pc, lr @@ -79,7 +86,7 @@ memcpy: CALGN( andsip, r0, #31