To: linux-arm-kernel@lists.arm.linux.org.uk Subject: [PATCH] boot/compressed: Switch CPU into little endian mode X-Draft-From: ("nnml:Linux.arm" "") From: Peter Korsgaard Date: Tue, 27 Sep 2005 08:30:55 +0200 Message-ID: <87achzuin4.fsf@p4.48ers.dk> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Lines: 44 Xref: p4.48ers.dk mbox-out:513 Hi, The following patch provides a boot/compressed/little-endian.S just like the existing big-endian.S to switch the CPU into little endian mode. This is useful for booting a little endian kernel from a big endian bootloader (after byteswapping the kernel image). I realise that this isn't neded by most people, but it only gives an overhead of 3 instructions. Signed-off-by: Peter Korsgaard --- diff -urpN linux-2.6.14-rc2.orig/arch/arm/boot/compressed/Makefile linux-2.6.14-rc2/arch/arm/boot/compressed/Makefile --- linux-2.6.14-rc2.orig/arch/arm/boot/compressed/Makefile 2005-09-26 21:32:40.000000000 +0200 +++ linux-2.6.14-rc2/arch/arm/boot/compressed/Makefile 2005-09-26 21:56:26.000000000 +0200 @@ -56,6 +56,8 @@ endif ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) OBJS += big-endian.o +else +OBJS += little-endian.o endif # diff -urpN linux-2.6.14-rc2.orig/arch/arm/boot/compressed/little-endian.S linux-2.6.14-rc2/arch/arm/boot/compressed/little-endian.S --- linux-2.6.14-rc2.orig/arch/arm/boot/compressed/little-endian.S 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.14-rc2/arch/arm/boot/compressed/little-endian.S 2005-09-26 21:56:50.000000000 +0200 @@ -0,0 +1,13 @@ +/* + * linux/arch/arm/boot/compressed/little-endian.S + * + * Switch CPU into little endian mode. + * Author: Peter Korsgaard + */ + + .section ".start", #alloc, #execinstr + + mrc p15, 0, r0, c1, c0, 0 @ read control reg + bic r0, r0, #(1 << 7) @ enable little endian mode + mcr p15, 0, r0, c1, c0, 0 @ write control reg + -- Bye, Peter Korsgaard