* Why Xen use mkelf32 instead of lds?
[not found] <E1EchLl-0000HS-6N@host-192-168-0-1-bcn-london>
@ 2005-11-17 14:22 ` 焦冶
2005-11-17 14:32 ` Keir Fraser
0 siblings, 1 reply; 2+ messages in thread
From: 焦冶 @ 2005-11-17 14:22 UTC (permalink / raw)
To: xen-devel
Hi,Guys!
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Why Xen use mkelf32 instead of lds?
2005-11-17 14:22 ` Why Xen use mkelf32 instead of lds? 焦冶
@ 2005-11-17 14:32 ` Keir Fraser
0 siblings, 0 replies; 2+ messages in thread
From: Keir Fraser @ 2005-11-17 14:32 UTC (permalink / raw)
To: 焦冶; +Cc: xen-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-11-17 14:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <E1EchLl-0000HS-6N@host-192-168-0-1-bcn-london>
2005-11-17 14:22 ` Why Xen use mkelf32 instead of lds? 焦冶
2005-11-17 14:32 ` Keir Fraser
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.