diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2019-07-16 12:32:37 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2019-08-23 11:39:29 +0100 |
commit | 20699a42c020289e31afe33ff0909acdc5ca1350 (patch) | |
tree | 9228950881f670704a85453fd584b4bddc6f9ff4 /arch | |
parent | 3c86889b0584be3e0243c22bf0901f12dfebac9a (diff) | |
download | linux-stable-20699a42c020289e31afe33ff0909acdc5ca1350.tar.gz linux-stable-20699a42c020289e31afe33ff0909acdc5ca1350.tar.bz2 linux-stable-20699a42c020289e31afe33ff0909acdc5ca1350.zip |
ARM: 8893/1: boot: Explain the 8 nops
This was unclear to me until Russell explained the obvious
that 8 nops are added to offset an a.out image. Reading
git history reveals that thumb kernels first removed the
nops and then kept 7 of them (the last instruction being
a switch to thumb mode) as it turns out that some boot
loaders were using this as a "patch area". Also the magic
numbers after the initial nops and the jump of course
need to stay in the same offset for kernel file
detection.
Make the code easier to understand with a comment.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Acked-by: Roy Franz <rfranz@marvell.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/compressed/head.S | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index e59d14679fb0..544450c90673 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -153,6 +153,18 @@ AR_CLASS( .arm ) start: .type start,#function + /* + * These 7 nops along with the 1 nop immediately below for + * !THUMB2 form 8 nops that make the compressed kernel bootable + * on legacy ARM systems that were assuming the kernel in a.out + * binary format. The boot loaders on these systems would + * jump 32 bytes into the image to skip the a.out header. + * with these 8 nops filling exactly 32 bytes, things still + * work as expected on these legacy systems. Thumb2 mode keeps + * 7 of the nops as it turns out that some boot loaders + * were patching the initial instructions of the kernel, i.e + * had started to exploit this "patch area". + */ .rept 7 __nop .endr |