]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 8677/1: boot/compressed: fix decompressor header layout for v7-M
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 24 May 2017 14:31:57 +0000 (15:31 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Mon, 5 Jun 2017 09:29:40 +0000 (10:29 +0100)
commit370f980978c4960c0c086a134185f1682477bbba
treec56eee8aecc36198c7f3909f99effa5e802b263e
parentda8738e6e9881f6018bd2eaf49d10535b8cb39ef
ARM: 8677/1: boot/compressed: fix decompressor header layout for v7-M

As reported by Patrice, the header layout of the decompressor is
incorrect when building for v7-M. In this case, the __nop macro
resolves to 'mov r0, r0', which is emitted as a narrow encoding,
resulting in the header data fields to end up at lower offsets than
required.

Given the variety of targets we need to support with the same code,
the startup sequence is a bit of a jumble, and uses instructions
and macros whose encoding widths cannot be specified (badr), or only
exist in a narrow encoding (bx)

So force the use of a wide encoding in __nop, and replace the start
sequence with a simple jump to the label marking the start of code,
preceded by a Thumb2 mode switch if required (using explicit wide
encodings where appropriate). The label itself can be moved to the
start of code [where it belongs] due to the larger range of branch
instructions as compared to adr instructions.

Reported-by: Patrice CHOTARD <patrice.chotard@st.com>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/boot/compressed/efi-header.S
arch/arm/boot/compressed/head.S