From: Nicolas Pitre <nico@fluxnic.net>
Date: Sat, 12 Feb 2011 21:25:27 +0000 (+0100)
Subject: ARM: 6663/1: make Thumb2 kernel entry point more similar to the ARM one
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b11fe38883d1;p=linux.git

ARM: 6663/1: make Thumb2 kernel entry point more similar to the ARM one

Some installers would binary patch the kernel zImage to replace the
first few nops with custom instructions.  This breaks the Thumb2 kernel
as the mode switch is right at the beginning.  Let's move it towards the
end of the nop sequence instead.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 7193884ed8b06..920f4dbd4883d 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -128,14 +128,14 @@ wait:		mrc	p14, 0, pc, c0, c1, 0
 		.arm				@ Always enter in ARM state
 start:
 		.type	start,#function
- THUMB(		adr	r12, BSYM(1f)	)
- THUMB(		bx	r12		)
- THUMB(		.rept	6		)
- ARM(		.rept	8		)
+		.rept	7
 		mov	r0, r0
 		.endr
+   ARM(		mov	r0, r0		)
+   ARM(		b	1f		)
+ THUMB(		adr	r12, BSYM(1f)	)
+ THUMB(		bx	r12		)
 
-		b	1f
 		.word	0x016f2818		@ Magic numbers to help the loader
 		.word	start			@ absolute load/run zImage address
 		.word	_edata			@ zImage end address