On 17 Nov 2005, at 14:22, 焦冶 wrote:
> I read the xen source and find that xen.lds locates the xen binary
> image
> at 0xFC500000, and then mkelf32(generated from mkelf32.c) to relocated
> it at
> 0x100000. And my question is WHY? Why doesn''t xen.lds directly
locate
> xen
> image at 0x100000? Is there any reason?
The compiler-generated code isn''t relocatable -- it needs to be
statically linked to a particular address which cannot then be changed
at runtime. So we link to the proper runtime virtual address
(0xFC500000) but the bootloader cannot load the code there as it is not
running with paging enabled. So we rewrite the load address with
mkelf32 to load at physical address 1MB (0x10000). The entry code in
Xen is specially written to know that it is running at 1MB with paging
disabled, and does what is necessary to enable paging, map the code at
0xFC500000, and then run the C code. This special code is in
xen/arch/x86/boot/x86_32.S.
-- Keir
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel