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

Re: [Xen-devel] [PATCH v2 2/2] xen-access: write_ctrlreg_c4 test



>>> On 16.06.17 at 16:32, <tamas@xxxxxxxxxxxxx> wrote:
> On Tue, May 30, 2017 at 3:46 AM, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx> 
> wrote:
>> @@ -314,6 +317,22 @@ static void get_request(vm_event_t *vm_event, 
>> vm_event_request_t *req)
>>  }
>>
>>  /*
>> + * X86 control register names
>> + */
>> +static const char* get_x86_ctrl_reg_name(uint32_t index)
>> +{
>> +    static const char* names[] = {
> 
> I would prefer to see this being defined in the following form so that
> it is clear where the indexes come from:
>   [VM_EVENT_X86_CR0] = "CR0",
>   ...
> 
>> +        "CR0",
>> +        "CR3",
>> +        "CR4",
>> +        "XCR0",
>> +    };
> 
> And this check to be index > VM_EVENT_X86_XCR0

Or perhaps even better >= ARRAY_SIZE()?

>> +    return (index > 3) ? "" : names[index];
>> +}
>> +
>> +
>> +/*

I also notice there are two successive blank lines here, which we
generally try to avoid.

Jan


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

 


Rackspace

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