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

Re: [Xen-devel] [PATCH v5 3/4] VMX: use proper instruction mnemonics if assembler supports them



>>> On 29.08.13 at 13:47, Tim Deegan <tim@xxxxxxx> wrote:
> At 16:31 +0100 on 26 Aug (1377534696), Jan Beulich wrote:
>> -static inline unsigned long __vmread_safe(unsigned long field, int *error)
>> +static inline bool_t __vmread_safe(unsigned long field, unsigned long 
>> *value)
>>  {
>> -    unsigned long ecx;
>> +    bool_t okay;
>>  
>> -    asm volatile ( VMREAD_OPCODE
>> -                   MODRM_EAX_ECX
>> -                   /* CF==1 or ZF==1 --> rc = -1 */
>> -                   "setna %b0 ; neg %0"
>> -                   : "=q" (*error), "=c" (ecx)
>> -                   : "0" (0), "a" (field)
>> +    asm volatile (
>> +#ifdef HAVE_GAS_VMX
>> +                   "vmread %2, %1\n\t"
>> +#else
>> +                   VMREAD_OPCODE MODRM_EAX_ECX
>> +#endif
>> +                   /* CF==1 or ZF==1 --> rc = 0 */
>> +                   "setnbe %0"
> 
> This inversion of the (undocumented) return value could be a nasty
> surprise for anyone backporting code that uses __vmread_safe().  Can you
> please leave it as it was?

The prior return value was the value read; we can't make this the
return value if at the same time we want to be able to utilize the
instruction's capability to read into a memory location (and not
just a register). And hence the short answer to your question is:
No.

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