- 論壇徽章:
- 0
|
回復 1# JackyBsh
不知怎么描述好,再進一步解釋一下吧。
內(nèi)核壓縮部分被包圍在未壓縮部分的中間,由未壓縮部分負責解壓壓縮部分,而解壓方式采用的是 in-place 解壓,也就是說,內(nèi)核解壓后的部分將覆蓋原來的壓縮部分。顯然,也會覆蓋包圍在內(nèi)核壓縮影像外圍的非壓縮部分。但是事實上,解壓縮后,非解壓縮的代碼還有一些工作要做,最后才跳轉(zhuǎn)到解開的壓縮部分。因此,這就有一個矛盾,既然被覆蓋了,如何還能繼續(xù)執(zhí)行呢?相關(guān)代碼如下:
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
也就是說,表面上看,在調(diào)用decompress_kernel,本身head_32.S似乎已經(jīng)被覆蓋,那么后面的代碼,包括跳轉(zhuǎn)到解壓的內(nèi)核的代碼“jmp *%ebp”,怎么還能夠依然執(zhí)行呢?
不知問題描述清楚沒有,希望有高手能夠解答。
|
|