From: Keir Fraser Subject: Re: GP exception on vmxon Date: Fri, 11 Jan 2008 08:41:06 +0000 Message-ID: References: <94FC11B010DA41AABF5C2C72688A8EEF@aaaex.asmpt.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0552849206==" Return-path: In-Reply-To: <94FC11B010DA41AABF5C2C72688A8EEF@aaaex.asmpt.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Hu Jia Yi , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --===============0552849206== Content-type: multipart/alternative; boundary="B_3282885669_5065799" > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3282885669_5065799 Content-type: text/plain; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable How early do you run? Are you really confident that you disabled A20M? A simple test would confirm this (check whether address 2MB aliases with 1MB)= . -- Keir On 11/1/08 06:46, "Hu Jia Yi" wrote: > Hello, I tried to write a piece of code to start vmx. > This code is directly interacting with cpu instead of with virtual cpu as= in > xen. > But every time I call vmxon, a GP exception happens. > =20 > Could anybody help me on this? The following is the context > =20 > 1. After booting up to the program, I disable A20M. > 2. allocate a 4kb-aligned vmxon region and calculate its physical address= . > 3. setup identity page table and enter protected page mode. In this step = I > also set x86_cr0_ne ( cr0.bit5) > 4. call start_vmx. This start_vmx function is similar to the one in xen3.= 1.0 >> 1. test cpuid with eax =3D 1. ecx.vmxe(bit5) is 1. >> 2. Test IA32_FEATURE_CONTROL_MSR, result is 0x05, so bit 0 and bit 2 are= both >> 1.=20 >> 3. Set cr4.vmxe (bit13) to 1 >> 4. Call vmx_init_vmcs_config(). This function is the same as in xen3.1.0= . >> 5. Call vmxon, passing it the physical adderss calculated in step2, usin= g the >> same op-code as xen > f. stop vmx by calling vmxoff. > =20 > Using =B3while(1)=B2, I traced and found the GP exception happened in step 4.= e. > From Intel Software Development Manual 2B, I get the following conditions= to > throw a GP. > =20 > IF (CPL > 0) or (in A20M mode) or > (the values of CR0 and CR4 are supported in VMX operation) or > (bit 0 (lock bit) of IA32_FEATURE_CONTROL MSR is clear) or > (bit 2 of IA32_FEATURE_CONTROL MSR is clear) > THEN #GP(0); > =20 > I checked the conditions and found none of them was violated. > The results are as follows > =20 > CR0 : 0x80000031 > IA32_VMX_CR0_FIXED0: 0x80000021 > IA32_VMX_CR0_FIXED1: 0xFFFFFFFF > =20 > CR4 : 0x2250 > IA32_VMX_CR4_FIXED0: 0x2000 > IA32_VMX_CR4_FIXED1: 0x27FF > =20 > IA32_VMX_BASIC_MSR is 001A 0400 0000 0007 > The revision ID 0x07 is assigned to the corresponding field in vmxon regi= on in > the step 4.d=20 > =20 > IA32_FEATURE_CONTROL is 0x05 > =20 > My PC has a 32 bit, VT-support multi-core CPU. > I use only the BSP and haven=B9t dealt with multi-cpu wake-up. > =20 > Best regards, > Hu Jia Yi > Ext: 20430 > Tel: 65-67510430 > =20 >=20 >=20 > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel --B_3282885669_5065799 Content-type: text/html; charset="ISO-8859-1" Content-transfer-encoding: quoted-printable Re: [Xen-devel] GP exception on vmxon How e= arly do you run? Are you really confident that you disabled A20M? A simple t= est would confirm this (check whether address 2MB aliases with 1MB).

 -- Keir

On 11/1/08 06:46, "Hu Jia Yi" <jyhu@asmpt.com> wrote:

Hello, I tried to write a pi= ece of code to start vmx.
This code is directly interacting with cpu instead of with virtual cpu as i= n xen.
But every time I call vmxon, a GP exception happens.
 
Could anybody help me on this? The following is the context
 
  1. After booting up t= o the program, I disable A20M.=20
  2. allocate a 4kb-aligned vmxon region = and calculate its physical address.=20
  3. setup identity page table and enter = protected page mode. In this step I also set x86_cr0_ne ( cr0.bit5)=20
  4. call start_vmx. This start_vmx funct= ion is similar to the one in xen3.1.0
    1. test cpuid with eax =3D 1. ecx.vmx= e(bit5) is 1.=20
    2. Test IA32_FEATURE_CONTROL_MSR, resul= t is 0x05, so bit 0 and bit 2 are both 1.=20
    3. Set cr4.vmxe (bit13) to 1=20
    4. Call vmx_init_vmcs_config(). This fu= nction is the same as in xen3.1.0.=20
    5. Call vmxon, passing it the physical = adderss calculated in step2, using the same op-code as xen
f.    stop vmx = by calling vmxoff.
 
Using “while(1)”, I traced and found the GP exception happened = in step 4.e.
>From Intel Software Development Manual 2B, I get the following conditions t= o throw a GP.
 
IF (CPL > 0) or (in A20M mode) or
(the values of CR0 and CR4 are supported in VMX operation) or
(bit 0 (lock bit) of IA32_FEATURE_CONTROL MSR is clear) or
(bit 2 of IA32_FEATURE_CONTROL MSR is clear)
THEN #GP(0);
 
I checked the conditions and found none of them was violated.
The results are as follows
 
CR0 :            &nb= sp;            &= nbsp;            = ; 0x80000031
IA32_VMX_CR0_FIXED0:    0x80000021
IA32_VMX_CR0_FIXED1:    0xFFFFFFFF
 
CR4 :            &nb= sp;            &= nbsp;            = ; 0x2250
IA32_VMX_CR4_FIXED0:    0x2000
IA32_VMX_CR4_FIXED1:    0x27FF
 
IA32_VMX_BASIC_MSR is 001A 0400 0000 0007
The revision ID 0x07 is assigned to the corresponding field in vmxon region= in the step 4.d
 
IA32_FEATURE_CONTROL is 0x05
 
My PC has a 32 bit, VT-support multi-core CPU.
I use only the BSP and haven’t dealt with multi-cpu wake-up.
 
Best regards,
Hu Jia Yi
Ext: 20430
Tel: 65-67510430
<= FONT FACE=3D"Times New Roman">


____________________= ___________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/x= en-devel

--B_3282885669_5065799-- --===============0552849206== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0552849206==--