2009年8月3日月曜日

relocated

前回のつづきでhead_32.Sのrelocatedラベルの処理を見てみましょう。

arch/x86/boot/compressed/head_32.S
=============
.section ".text"
relocated:

/*
* BSSセクションをクリア
*/
xorl %eax,%eax
leal _edata(%ebx),%edi
leal _end(%ebx), %ecx
subl %edi,%ecx
cld
rep
stosb

/*
* デコンプレッサ用にスタックをセット
*/
leal boot_stack_end(%ebx), %esp

/*
* パラメータをセットして、decompress_kernel関数をコールする
*/
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 boot_heap(%ebx), %eax
pushl %eax # heap area as third argument
pushl %esi # real mode pointer as second arg
call decompress_kernel
addl $20, %esp
popl %ecx

=============
ここでやっているのはまずBSSセクションをクリアしてスタックをセットした後、decomoress_kernel関数を呼び出すというものです。
decompress_kernelコール前には解凍先アドレス、解凍元アドレス、サイズを引数として渡すためにスタックに積んでいます。

0 件のコメント:

コメントを投稿