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

Re: [Xen-devel] [PATCH v5] hvm/svm: Implement Debug events



On 03/23/2018 05:10 AM, Jan Beulich wrote:
>>>> On 23.03.18 at 09:31, <aisaila@xxxxxxxxxxxxxxx> wrote:
>> @@ -2656,9 +2663,28 @@ void svm_vmexit_handler(struct cpu_user_regs *regs)
>>          HVMTRACE_0D(SMI);
>>          break;
>>  
>> +    case VMEXIT_ICEBP:
>>      case VMEXIT_EXCEPTION_DB:
>>          if ( !v->domain->debugger_attached )
>> -            hvm_inject_hw_exception(TRAP_debug, X86_EVENT_NO_EC);
>> +        {
>> +            int rc;
>> +            unsigned int trap_type = exit_reason == VMEXIT_ICEBP ?
>> +                X86_EVENTTYPE_PRI_SW_EXCEPTION : X86_EVENTTYPE_HW_EXCEPTION;
>> +
>> +            inst_len = 0;
>> +
>> +            if ( trap_type == X86_EVENTTYPE_PRI_SW_EXCEPTION )
>> +                inst_len = __get_instruction_length(v, INSTR_ICEBP);
> It'll be the SVM maintainers to judge, but I think the code structure
> I've previously suggested would make things more clear:
>
>             if ( exit_reason != VMEXIT_ICEBP )
>             {
>                 trap_type == X86_EVENTTYPE_HW_EXCEPTION;
>                 inst_len = 0;
>             }
>             else
>             {
>                 trap_type == X86_EVENTTYPE_PRI_SW_EXCEPTION;
>                 inst_len = __get_instruction_length(v, INSTR_ICEBP);
>             }
>
> Perhaps even with likely() added.

Yes, I also think this is easier to read.

-boris



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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