Thank you mike!
so ,after the first instruction ,rbp contains the offset of actually loaded address, which equals the physical address.
$_text - __START_KERNEL_map contains the expected physical address .
Right ?
在2015年12月30日 19:35,Mike Krinkin 写道:
On Wed, Dec 30, 2015 at 06:45:40PM +0800, xiaoqiang zhao wrote:
> Hello:
>
> After kernel is decompressed, the kernel will execute startup_64 and
> the first two instructions are:
>
> leaq _text(%rip), %rbp
this gets an actual address of kernel code in rbp register (which might
differ from an address where kernel is compiled to run)
> subq $_text - __START_KERNEL_map, %rbp
__START_KERNEL_map is an expected addres of kernel code, i. e. where
kernel is compiled to run.
So rbp contains difference between address where kernel is loaded and
address where it is expected to be loaded.
>
> I tried to understand them but can not figure out what rbp contains
> after this two instructions. Anybody give me a clear explanation?
>
> Thanks a lot!
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies