-
Notifications
You must be signed in to change notification settings - Fork 46
confusion around x86 "and" instructions #16
Comments
This is on purpose - you can encode 64-bit AND with unsigned immediate by not promoting the instruction to 64-bit. Then it's basically the same as the former - it's only possible when the operand is a register though. |
Suppose I am looking at this from the perspective of a decode and I encounter a byte sequence that matches "81 /4 id" how do I know whether this which "rule" applies. In other words: is this a 32bit or a 64bit instructions. Maybe this is dependent on the processor mode? I would also expect that the "or" instruction has similar/symmetric rules but I did not see any. |
In case of decode, you should always decode to an original instruction and consider all other aliases as just aliases. The encoder would support the alias (or not, depending on how you see it), but the decoder would always decode to a canonical representation. OR doesn't have that capability, because it would zero extend the high part of 32-bit reg, which is what |
Ah I see. Is there a programmatic way to determine which instructions are "original" . |
I found another conflict:
These are the only two such cases I found in the fairly large part of the tables that I process. This is seems like an odd exception given that this pattern is not repeated with another ALU type instruction. |
I spoke to soon. Here is another ambiguity of a slightly different flavor:
|
Can you describe what is ambiguous in The instructions really do what is described. |
I see. I think the problems is that I am currently mostly focused on the decoding part while asmdb is more focused on encoding. If I encounter What I have done on my side to deal with this is
where r = M format restricted to reg; m = M format restricted to m This gets rid of the ambiguity for me. Not sure if this makes sense for asmdb, though |
These two seem to conflict:
["and" , "X:r32/m32, id/ud" , "MI" , "81 /4 id" , "ANY _XLock OF=0 SF=W ZF=W AF=U PF=W CF=0"],
["and" , "X:r64, ud" , "MI" , "81 /4 id" , "X64 _XLock OF=0 SF=W ZF=W AF=U PF=W CF=0"],
The text was updated successfully, but these errors were encountered: