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

Re: [Xen-devel] [PATCH] vmx: Restore debug registers when injecting #DB traps



>>> On 11.03.16 at 15:51, <ross.lagerwall@xxxxxxxxxx> wrote:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -3091,24 +3091,23 @@ static int vmx_handle_eoi_write(void)
>   * It is the callers responsibility to ensure that this function is only used
>   * in the context of an appropriate vmexit.
>   */
> -static void vmx_propagate_intr(void)
> +static void vmx_propagate_intr(unsigned long intr)
>  {
> -    unsigned long intr, tmp;
> -
> -    __vmread(VM_EXIT_INTR_INFO, &intr);
> -
> -    ASSERT(intr & INTR_INFO_VALID_MASK);
> -
> -    __vmwrite(VM_ENTRY_INTR_INFO, intr);
> +    struct hvm_trap trap = {
> +        .vector = intr & INTR_INFO_VECTOR_MASK,
> +        .type = MASK_EXTR(intr, INTR_INFO_INTR_TYPE_MASK) };

Please use MASK_EXTR() for both. Also the closing brace would better
go on the next line.

> +    unsigned long tmp;
>  
>      if ( intr & INTR_INFO_DELIVER_CODE_MASK )
>      {
>          __vmread(VM_EXIT_INTR_ERROR_CODE, &tmp);
> -        __vmwrite(VM_ENTRY_EXCEPTION_ERROR_CODE, tmp);
> +        trap.error_code = tmp;
>      }
> -
> +    else
> +        trap.error_code = HVM_DELIVER_NO_ERROR_CODE;
>      __vmread(VM_EXIT_INSTRUCTION_LEN, &tmp);
> -    __vmwrite(VM_ENTRY_INSTRUCTION_LEN, tmp);
> +    trap.insn_len = tmp;

For this one I was unsure already for the original change (but it had
gone in already by the time I got to see it): The VM-exit instruction
length field is undefined (i.e. not necessarily zero) for the #AC
intercept case, and also for some (most) of the #DB ones. I therefore
think this needs some qualification, with zero getting used otherwise.

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®.