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

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

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] problem in using MSR in the hypervisor
From: Long Wang <longwang.longwang@xxxxxxxxx>
Date: Fri, 8 Oct 2010 16:42:46 -0500
Delivery-date: Fri, 08 Oct 2010 14:43:28 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=t8HN3rwpNRIsjdcba268qR55jXUbAsUt6P1WeXRzRAc=; b=qpTwEbP9uLTgPLdxEXwl30A9j55vpw6pL6J3CBQUfOHkb/0jY8q7KXH84a4GNzgli+ 11S+AXBtnCB5Ouzmwfgq6T46C6drtjbQXQtHpLJzp6of4+4Tu4+goOqc2JTZjC+rJUKg k+xxfePn51XtiJOAJUqDs5tg+ZPly94CcyNb0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=u1GzkZvR27PZA7pqJKdF9khZHd/j88oh0yuhoquUutAwzGQg2huigMzhtJCs/huyws t/vDQFndvl9rWVHz69J6fL/8l4/WHIySEcFQjaV2rx0VDn8uCoZ3JnCC4+jSEkqG0ExX +hCIZ3LSCItrUD011nYwaCY4hgDj/6bf5i604=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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

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