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

Re: [Xen-devel] [PATCH 15 of 20] Switch shadow/virtual VMCS between n1/n

To: Eddie Dong <eddie.dong@xxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 15 of 20] Switch shadow/virtual VMCS between n1/n2 guests
From: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Date: Thu, 2 Jun 2011 15:56:23 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 02 Jun 2011 07:57:03 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <bd15acfc9b822ccf27b5.1307005048@xxxxxxxxxxxxxxxxxxxx>
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>
References: <patchbomb.1307005033@xxxxxxxxxxxxxxxxxxxx> <bd15acfc9b822ccf27b5.1307005048@xxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.21 (2010-09-15)
At 16:57 +0800 on 02 Jun (1307033848), Eddie Dong wrote:
> +static void nvmx_update_exit_control(struct vcpu *v,
> +                                     unsigned long host_cntrl)
> +{
> +    u32 shadow_cntrl;
> +    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
> +
> +#define REMOVED_EXIT_CONTROL_BITS    ((1<<2) |           \

Define a macro for whatever 1<<2 means here, please. 

> +                (VM_EXIT_SAVE_GUEST_PAT) |               \
> +                (VM_EXIT_SAVE_GUEST_EFER) |              \
> +                (VM_EXIT_SAVE_PREEMPT_TIMER))
> +    shadow_cntrl = __get_vvmcs(nvcpu->nv_vvmcx, VM_EXIT_CONTROLS);
> +    shadow_cntrl &= ~REMOVED_EXIT_CONTROL_BITS;
> +    shadow_cntrl |= host_cntrl;
> +    __vmwrite(VM_EXIT_CONTROLS, shadow_cntrl);
> +}
[...]
> +static void sync_vvmcs_guest_state(struct vcpu *v, struct cpu_user_regs 
> *regs)
> +{
> +    int i;
> +    unsigned long mask;
> +    unsigned long cr;
> +    struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v);
> +    void *vvmcs = nvcpu->nv_vvmcx;
> +
> +    /* copy shadow vmcs.gstate back to vvmcs.gstate */
> +    for ( i = 0; i < ARRAY_SIZE(vmcs_gstate_field); i++ )
> +        shadow_to_vvmcs(vvmcs, vmcs_gstate_field[i]);
> +    /* RIP, RSP are in user regs */
> +    __set_vvmcs(vvmcs, GUEST_RIP, regs->rip);
> +    __set_vvmcs(vvmcs, GUEST_RSP, regs->rsp);
> +
> +    /* SDM 20.6.6: L2 guest execution may change GUEST CR0/CR4 */
> +    mask = __get_vvmcs(vvmcs, CR0_GUEST_HOST_MASK);
> +    if ( ~mask )
> +    {
> +        cr = __get_vvmcs(vvmcs, GUEST_CR0);
> +        cr = (cr & mask) | (__vmread(GUEST_CR4) & ~mask);

Cut-n-paste error?                      ^^^^^^^^^

Tim.

-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

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

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