Commit 183ef7ad authored by Arvind Sankar's avatar Arvind Sankar Committed by Borislav Petkov

x86/boot: Simplify calculation of output address

Condense the calculation of decompressed kernel start a little.

Committer notes:

before:

ebp = ebx - (init_size - _end)

after:

eax = (ebx + _end) - init_size

where in both ebx contains the temporary address the kernel is moved to
for in-place decompression.

The before and after difference in register state is %eax and %ebp
but that is immaterial because the compressed image is not built with
-mregparm, i.e., all arguments of the following extract_kernel() call
are passed on the stack.
Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200107194436.2166846-1-nivedita@alum.mit.edu
parent b2b1d94c
...@@ -240,11 +240,9 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated) ...@@ -240,11 +240,9 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated)
/* push arguments for extract_kernel: */ /* push arguments for extract_kernel: */
pushl $z_output_len /* decompressed length, end of relocs */ pushl $z_output_len /* decompressed length, end of relocs */
movl BP_init_size(%esi), %eax leal _end(%ebx), %eax
subl $_end, %eax subl BP_init_size(%esi), %eax
movl %ebx, %ebp pushl %eax /* output address */
subl %eax, %ebp
pushl %ebp /* output address */
pushl $z_input_len /* input_len */ pushl $z_input_len /* input_len */
leal input_data(%ebx), %eax leal input_data(%ebx), %eax
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment