mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-04 16:25:34 +00:00
ARM: decompressor: factor out routine to obtain the inflated image size
Before adding another reference to the inflated image size, factor out the slightly complicated way of loading the unaligned little-endian constant from the end of the compressed data. Tested-by: Tony Lindgren <tony@atomide.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
parent
e951a1f427
commit
184bf653a7
1 changed files with 26 additions and 17 deletions
|
@ -151,6 +151,25 @@
|
|||
.L_\@:
|
||||
.endm
|
||||
|
||||
/*
|
||||
* The kernel build system appends the size of the
|
||||
* decompressed kernel at the end of the compressed data
|
||||
* in little-endian form.
|
||||
*/
|
||||
.macro get_inflated_image_size, res:req, tmp1:req, tmp2:req
|
||||
adr \res, .Linflated_image_size_offset
|
||||
ldr \tmp1, [\res]
|
||||
add \tmp1, \tmp1, \res @ address of inflated image size
|
||||
|
||||
ldrb \res, [\tmp1] @ get_unaligned_le32
|
||||
ldrb \tmp2, [\tmp1, #1]
|
||||
orr \res, \res, \tmp2, lsl #8
|
||||
ldrb \tmp2, [\tmp1, #2]
|
||||
ldrb \tmp1, [\tmp1, #3]
|
||||
orr \res, \res, \tmp2, lsl #16
|
||||
orr \res, \res, \tmp1, lsl #24
|
||||
.endm
|
||||
|
||||
.section ".start", "ax"
|
||||
/*
|
||||
* sort out different calling conventions
|
||||
|
@ -268,15 +287,15 @@ not_angel:
|
|||
*/
|
||||
mov r0, pc
|
||||
cmp r0, r4
|
||||
ldrcc r0, LC0+32
|
||||
ldrcc r0, LC0+28
|
||||
addcc r0, r0, pc
|
||||
cmpcc r4, r0
|
||||
orrcc r4, r4, #1 @ remember we skipped cache_on
|
||||
blcs cache_on
|
||||
|
||||
restart: adr r0, LC0
|
||||
ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
|
||||
ldr sp, [r0, #28]
|
||||
ldmia r0, {r1, r2, r3, r6, r11, r12}
|
||||
ldr sp, [r0, #24]
|
||||
|
||||
/*
|
||||
* We might be running at a different address. We need
|
||||
|
@ -284,20 +303,8 @@ restart: adr r0, LC0
|
|||
*/
|
||||
sub r0, r0, r1 @ calculate the delta offset
|
||||
add r6, r6, r0 @ _edata
|
||||
add r10, r10, r0 @ inflated kernel size location
|
||||
|
||||
/*
|
||||
* The kernel build system appends the size of the
|
||||
* decompressed kernel at the end of the compressed data
|
||||
* in little-endian form.
|
||||
*/
|
||||
ldrb r9, [r10, #0]
|
||||
ldrb lr, [r10, #1]
|
||||
orr r9, r9, lr, lsl #8
|
||||
ldrb lr, [r10, #2]
|
||||
ldrb r10, [r10, #3]
|
||||
orr r9, r9, lr, lsl #16
|
||||
orr r9, r9, r10, lsl #24
|
||||
get_inflated_image_size r9, r10, lr
|
||||
|
||||
#ifndef CONFIG_ZBOOT_ROM
|
||||
/* malloc space is above the relocated stack (64k max) */
|
||||
|
@ -652,13 +659,15 @@ LC0: .word LC0 @ r1
|
|||
.word __bss_start @ r2
|
||||
.word _end @ r3
|
||||
.word _edata @ r6
|
||||
.word input_data_end - 4 @ r10 (inflated size location)
|
||||
.word _got_start @ r11
|
||||
.word _got_end @ ip
|
||||
.word .L_user_stack_end @ sp
|
||||
.word _end - restart + 16384 + 1024*1024
|
||||
.size LC0, . - LC0
|
||||
|
||||
.Linflated_image_size_offset:
|
||||
.long (input_data_end - 4) - .
|
||||
|
||||
#ifdef CONFIG_ARCH_RPC
|
||||
.globl params
|
||||
params: ldr r0, =0x10000100 @ params_phys for RPC
|
||||
|
|
Loading…
Add table
Reference in a new issue