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

Re: [Xen-devel] [PATCH v2 06/12] VMX: add VMFUNC leaf 0 (EPTP switching) to emulator.



>>> On 22.06.15 at 20:56, <edmund.h.white@xxxxxxxxx> wrote:
> @@ -1826,6 +1827,20 @@ static void vmx_vcpu_update_vmfunc_ve(struct vcpu *v)
>      vmx_vmcs_exit(v);
>  }
>  
> +static bool_t vmx_vcpu_emulate_vmfunc(struct cpu_user_regs *regs)
> +{
> +    bool_t rc = 0;
> +
> +    if ( !cpu_has_vmx_vmfunc && altp2mhvm_active(current->domain) &&
> +         regs->eax == 0 &&
> +         p2m_switch_vcpu_altp2m_by_id(current, (uint16_t)regs->ecx) )
> +    {
> +        regs->eip += 3;

What if the instruction has some (bogus but not invalid) opcode
prefix?

> @@ -2091,6 +2108,13 @@ static void vmx_invlpg_intercept(unsigned long vaddr)
>          vpid_sync_vcpu_gva(curr, vaddr);
>  }
>  
> +static int vmx_vmfunc_intercept(struct cpu_user_regs *regs)
> +{
> +    gdprintk(XENLOG_ERR, "Failed guest VMFUNC execution\n");
> +    domain_crash(current->domain);
> +    return X86EMUL_OKAY;
> +}

What is this unconditional crashing of the guest good for?

> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -3837,6 +3837,14 @@ x86_emulate(
>              goto rdtsc;
>          }
>  
> +        if (modrm == 0xd4) /* vmfunc */
> +        {
> +            fail_if(ops->vmfunc == NULL);
> +            if ( (rc = ops->vmfunc(ctxt) != 0) )
> +                goto done;
> +            break;
> +        }

Together with the two preceding if()-s this is now finally the point
where switch() should be used instead.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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