Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
npitre
via email
Author
Contributor
|
||
|
||
b 1f | ||
.word 0x016f2818 @ Magic numbers to help the loader | ||
.word start @ absolute load/run zImage address | ||
.word _edata @ zImage end address | ||
|
First of all, let me share some history of the original purpose of repeat mov r0, r0 in ARM mode by Russell.
http://comments.gmane.org/gmane.linux.ports.arm.kernel/26690
Q1. Now I'm wondering what happens to this kernel if the boot loader Russell has mentioned calls this kernel at 0xNNNN8020. What value can be in r12 at 0xNNNN8020?
Here are the code compiled in thume-2 mode:
$ arm-linux-gnueabihf-objdump -d arch/arm/boot/compressed/head.o
00000000 :
0: e1a00000 nop ; (mov r0, r0)
4: e1a00000 nop ; (mov r0, r0)
8: e1a00000 nop ; (mov r0, r0)
c: e1a00000 nop ; (mov r0, r0)
10: e1a00000 nop ; (mov r0, r0)
14: e1a00000 nop ; (mov r0, r0)
18: e1a00000 nop ; (mov r0, r0)
1c: e28fc00d add ip, pc, #13
20: e12fff1c bx ip
24: 016f2818 .word 0x016f2818
Q2. How many nops can be replaced by the installers you've mentioned? (means boot loaders?) seven nops? or eight nops?