lkml.org 
[lkml]   [2007]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 5/8] Immediate Values - x86 Optimization (update)
Mathieu Desnoyers wrote:
> * H. Peter Anvin (hpa@zytor.com) wrote:
>> Mathieu Desnoyers wrote:
>>> * H. Peter Anvin (hpa@zytor.com) wrote:
>>>> Mathieu Desnoyers wrote:
>>>>>> - Use "=g" constraint for char immediate value inline assembly.
>>>>>>
>>>>>> "=g" is the same as "=rmi" which is inherently bogus. In your actual
>>>>>> code you use "=r", the correct constraint is "=q".
>>>>> q
>>>>> Any register accessible as rl. In 32-bit mode, a, b, c, and d; in
>>>>> 64-bit mode, any integer register. I am worried that "=q" might exclude
>>>>> the si and di registers in 32-bit mode.
>>>>> What exactly is wrong with "=r" ?
>>>> For "char" (8-bit) values, sp/bp/si/di are illegal in 32-bit mode.
>>>>
>>>> Hence "=q".
>>>>
>>> Ah! yep, I see, so we say:
>>> 1 byte : "=q"
>>> 2 bytes : "=r"
>>> 4 bytes : "=r"
>>> 8 bytes : "=r"
>>> ? (si and di appear to be legal for 2 and 4 bytes in 32-bit mode)
>> That's right.
>>
>> -hpa
>

Something else to watch out for... in 64-bit mode the lengths most of
these will depend on which register is used, since whether or not a REX
prefix is needed will vary.

As far as I can tell, you're assuming fixed length instructions, which
is wrong unless you manually constrain yourself to only legacy registers.

-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-13 22:33    [W:0.166 / U:1.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site