- 论坛徽章:
- 0
|
回复 1# JackyBsh
不知怎么描述好,再进一步解释一下吧。
内核压缩部分被包围在未压缩部分的中间,由未压缩部分负责解压压缩部分,而解压方式采用的是 in-place 解压,也就是说,内核解压后的部分将覆盖原来的压缩部分。显然,也会覆盖包围在内核压缩影像外围的非压缩部分。但是事实上,解压缩后,非解压缩的代码还有一些工作要做,最后才跳转到解开的压缩部分。因此,这就有一个矛盾,既然被覆盖了,如何还能继续执行呢?相关代码如下:
arch/x86/boot/compressed/head_32.S:
/*
* Do the decompression, and jump to the new kernel..
*/
leal z_extract_offset_negative(%ebx), %ebp
/* push arguments for decompress_kernel: */
pushl %ebp /* output address */
pushl $z_input_len /* input_len */
...
call decompress_kernel
addl $20, %esp
#if CONFIG_RELOCATABLE
/*
* Find the address of the relocations.
*/
leal z_output_len(%ebp), %edi
/*
* Calculate the delta between where vmlinux was compiled to run
* and where it was actually loaded.
*/
movl %ebp, %ebx
subl $LOAD_PHYSICAL_ADDR, %ebx
jz 2f /* Nothing to be done if loaded at compiled addr. */
...
/*
* Jump to the decompressed kernel.
*/
xorl %ebx, %ebx
jmp *%ebp
也就是说,表面上看,在调用decompress_kernel,本身head_32.S似乎已经被覆盖,那么后面的代码,包括跳转到解压的内核的代码“jmp *%ebp”,怎么还能够依然执行呢?
不知问题描述清楚没有,希望有高手能够解答。
|
|