WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Why Xen use mkelf32 instead of lds?

To: 焦冶 <uframer@xxxxxxxxx>
Subject: Re: [Xen-devel] Why Xen use mkelf32 instead of lds?
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Thu, 17 Nov 2005 14:32:58 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 17 Nov 2005 14:27:36 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <437c9212.16b67ac2.7ab3.0855@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <437c9212.16b67ac2.7ab3.0855@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx

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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>