From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andi Kleen Subject: Re: Early test for 32- vs 64-bit hvm domain? Date: Wed, 30 Jan 2008 19:44:08 +0100 Message-ID: References: <20080129173438062.00000002384@djm-pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: In-Reply-To: (Keir Fraser's message of "Wed\, 30 Jan 2008 08\:21\:24 +0000") List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "dan.magenheimer@oracle.com" , "xen-devel@lists.xensource.com" , Samuel Thibault List-Id: xen-devel@lists.xenproject.org Keir Fraser writes: > On 30/1/08 00:34, "Dan Magenheimer" wrote: > >>> As long as e.g. Linux has not started (i.e. during bios and grub for >>> instance), you can't know whether that will be a 64bit Linux >>> or a 32bit >>> Linux. >> >> That's what I was afraid of... >> >> Then what is the earliest point in the execution of an x86_64 >> domain/vcpu in *xen* where hvm_long_mode_enabled(v) will work >> properly? E.g. in Linux/x86_64 is long mode set early in __start? >> And is this done via a hypercall or an emulated instruction? > > As sson as you see LME bit get set in the EFER MSR then you know you have a > 64-bit guest. Writes to EFER are emulated in long_mode_do_msr_write() in > vmx.c and svm.c. Those are the places to patch in Xen 3.1 branch. You could do it slightly earlier by intercepting bios int 0x15 eax=0xec00 ebx=2 The kernel issues that to tell the BIOS it is 64bit. That will only work if the boot loader does not skip the real mode code (a few do) -Andi