- 論壇徽章:
- 0
|
本帖最后由 aweii 于 2013-05-10 10:02 編輯
我在看2.6.24內(nèi)核,linux/arch/x86/boot/compressed/head_32.S中,既然運(yùn)行時(shí)被重定位了,那么連接時(shí)的標(biāo)號(hào)地址就不準(zhǔn)確了,怎么還能直接調(diào)用call decompress_kernel呢?相關(guān)代碼如下:
……
call 1f
1: popl %ebp
……
movl output_len(%ebx), %eax
pushl %eax
pushl %ebp # output address
movl input_len(%ebx), %eax
pushl %eax # input_len
leal input_data(%ebx), %eax
pushl %eax # input_data
leal _end(%ebx), %eax
pushl %eax # end of the image as third argument
pushl %esi # real mode pointer as second arg
call decompress_kernel
addl $20, %esp
popl %ecx
……
既然用了input_len(%ebx), 說明代碼是從0地址開始鏈接的,并且通過寄存器進(jìn)行了重定位尋址,那么decompress_kernel應(yīng)該
也是相對于0始址的偏移量(head_32.S和misc_32.c是一起鏈接的),當(dāng)壓縮內(nèi)核移到到0x100000+X的地址開始解壓縮前夕,decompress_kernel的實(shí)際位置顯然和鏈接位置不一致,怎么還能用call decomress_kernel呢(沒有重定位)?前面的call 1f 可以看做是短調(diào)用(二進(jìn)制代碼中用相對位移,無需重定位),而call decomress_kernel顯然不是。 |
|