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

Re: [Xen-devel] [PATCH] x86emul: relax asm() constraints



>>> On 15.02.16 at 14:39, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 15/02/16 12:06, Jan Beulich wrote:
>> @@ -4542,9 +4542,10 @@ x86_emulate(
>>  
>>      case 0xbc: /* bsf or tzcnt */ {
>>          bool_t zf;
>> -        asm ( "bsf %2,%0; setz %b1"
>> +
>> +        asm ( "bsf %2,%0; setz %1"
>>                : "=r" (dst.val), "=q" (zf)
> 
> This =q could become =qm, like the even_parity() change.

Ah, indeed. And there are a couple more.

>> @@ -4698,7 +4700,7 @@ x86_emulate(
>>              break;
>>          case 4:
>>  #ifdef __x86_64__
>> -            asm ( "bswap %k0" : "=r" (dst.val) : "0" (*dst.reg) );
>> +            asm ( "bswap %k0" : "=r" (dst.val) : "0" (*(uint32_t *)dst.reg) 
>> );
> 
> What is the purpose of both the explicit cast and k constraint?

Operand size gets (or at least may get) derived from the output
operand. While we could also constrain that one to 32 bits, it
seems better to have the whole dst.val written just in case. Of
src.val, otoh, we definitely only need to load the low 32 bits
(possibly saving a REX prefix), and we also definitely need to
force the bswap to have 32-bit operand size.

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