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

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



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


 


Rackspace

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