ia64/xen-unstable

changeset 11403:37e5dfad8425

[HVM][VMX] Add CR8 virtualization. Needed for x86/64 Windows boot.
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
author kaf24@firebug.cl.cam.ac.uk
date Thu Aug 31 23:58:23 2006 +0100 (2006-08-31)
parents 0da01d6f7017
children e83368c8d5e2
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Thu Aug 31 23:56:45 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Thu Aug 31 23:58:23 2006 +0100
     1.3 @@ -46,6 +46,8 @@
     1.4  #include <asm/hvm/vpic.h>
     1.5  #include <asm/hvm/vlapic.h>
     1.6  
     1.7 +extern uint32_t vlapic_update_ppr(struct vlapic *vlapic);
     1.8 +
     1.9  static DEFINE_PER_CPU(unsigned long, trace_values[5]);
    1.10  #define TRACE_VMEXIT(index,value) this_cpu(trace_values)[index]=value
    1.11  
    1.12 @@ -1613,6 +1615,7 @@ static int mov_to_cr(int gp, int cr, str
    1.13      unsigned long value;
    1.14      unsigned long old_cr;
    1.15      struct vcpu *v = current;
    1.16 +    struct vlapic *vlapic = VLAPIC(v);
    1.17  
    1.18      switch ( gp ) {
    1.19      CASE_GET_REG(EAX, eax);
    1.20 @@ -1756,6 +1759,12 @@ static int mov_to_cr(int gp, int cr, str
    1.21              shadow_update_paging_modes(v);
    1.22          break;
    1.23      }
    1.24 +    case 8:
    1.25 +    {
    1.26 +        vlapic_set_reg(vlapic, APIC_TASKPRI, ((value & 0x0F) << 4));
    1.27 +        vlapic_update_ppr(vlapic);
    1.28 +        break;
    1.29 +    }
    1.30      default:
    1.31          printk("invalid cr: %d\n", gp);
    1.32          __hvm_bug(regs);
    1.33 @@ -1769,13 +1778,20 @@ static int mov_to_cr(int gp, int cr, str
    1.34   */
    1.35  static void mov_from_cr(int cr, int gp, struct cpu_user_regs *regs)
    1.36  {
    1.37 -    unsigned long value;
    1.38 +    unsigned long value = 0;
    1.39      struct vcpu *v = current;
    1.40 +    struct vlapic *vlapic = VLAPIC(v);
    1.41  
    1.42 -    if ( cr != 3 )
    1.43 +    if ( cr != 3 && cr != 8)
    1.44          __hvm_bug(regs);
    1.45  
    1.46 -    value = (unsigned long) v->arch.hvm_vmx.cpu_cr3;
    1.47 +    if ( cr == 3 )
    1.48 +        value = (unsigned long) v->arch.hvm_vmx.cpu_cr3;
    1.49 +    else if ( cr == 8 )
    1.50 +    {
    1.51 +        value = (unsigned long)vlapic_get_reg(vlapic, APIC_TASKPRI);
    1.52 +        value = (value & 0xF0) >> 4;
    1.53 +    }
    1.54  
    1.55      switch ( gp ) {
    1.56      CASE_SET_REG(EAX, eax);