[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: problem in using MSR in the hypervisor


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Long Wang <longwang.longwang@xxxxxxxxx>
  • Date: Sat, 9 Oct 2010 14:26:26 -0500
  • Delivery-date: Sat, 09 Oct 2010 12:27:14 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=idbH1xrplCw1lvRrfjmfpmBu6q735uwFBA8wFPbRgn92y0Q3TQLOIXGg/uNg5rLleM 7Q4kGoh4iVHw6Ncn/n564kiWc3FbjJQo/aeowBMaBFmi3ulYc8g/Udz+O7jMkOlMoiEE K5NW2PHowqT6p7zBbc9uJVjeiqnXQBtsX6w14=
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

I added code in the hypervisor to manipulate MSR. Here is my code in
emulate_privileged_op() in the Xen hypervisor:

....
       // for WRMSR
       case MSR_P4_IQ_PERFCTR0:
       case MSR_P4_IQ_CCCR0:
       case MSR_P4_CRU_ESCR0:
       case MSR_P4_IQ_PERFCTR2:
       case MSR_P4_IQ_CCCR2:
       case MSR_P4_CRU_ESCR1:
           wrmsr_safe(regs->ecx, eax, edx);
           break;
......
       // for RDMSR
       case MSR_P4_IQ_PERFCTR0:
       case MSR_P4_IQ_CCCR0:
       case MSR_P4_CRU_ESCR0:
       case MSR_P4_IQ_PERFCTR2:
       case MSR_P4_IQ_CCCR2:
       case MSR_P4_CRU_ESCR1:
               printk("the_cs = 0x%x\n", the_cs);
               __asm__ volatile(
                         "mov %%cs, %0\n"
                         :"=r"(the_cs)
                         :
               );
               printk("the_cs = 0x%x\n", the_cs);
               rdmsr_safe(regs->ecx, regs->eax, regs->edx);
           break;


The wrmsr_safe() and rdmsr_safe() trigger a general protection fault,
and the value read from the msr is 0. But I printed out the cs
descriptor, and found the CPL is 0. Why there is a general protection
fault here? How can I fix this?


thanks,
long

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.