Fix x86-64 OUT missing 16-bit opcode prefix#119
Conversation
Using 16-bit registers should emit the 16-bit prefix `0x66`. Co-authored-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
|
Hey, thanks for the contribution. It looks good, I'll have to check why this wasn't caught in the test harnasses. |
|
Hey, thanks for further investigating this issue. If there is anything I can do to help you push this over the finish line, please let me know! |
|
@CensoredUsername is there anything we can do here to get this over the finish line? |
|
Hey, sorry for the lack of progress. Life's been a bit in the way. I didn't find any specific pattern, it looks to me like it was just an oversight in the instruction encoding generation that this didn't make it in to the encoding list and test harnesses. I'll try to get this in a release ASAP. |
|
I'm just adding this in right now, digging further has revealed that in the switch to the generated test cases a couple years ago any test for generic instructions at the end of the opmap (https://github.com/CensoredUsername/dynasm-rs/blob/master/plugin/src/arch/x64/gen_opmap.rs#L5170-L5571). That's a bit more work to all add and y'all have waited long enough so I'll first just push a release with the fix. |
|
Fixed in v4.0.2. |
We discovered a bug that leads to a missing 16-bit prefix for the x86
OUTinstruction when using 16-bit registers. As far as I can tell, no other instructions miss the prefix in their 16-bit version. So far I've testedADD,MOV,MUL,PUSH, andIN.Below is a minimal reproducer:
The assert fails with the current state of
master. This PR adds changes that modify theopmapto generate the missing prefix.I also wanted to add a test for this, but didn't know where to place it, nor where to start (as this would mean to test a lot of instructions and I don't know if I can just add them to one of the files in testing) and if this is even necessary. I would be happy to hear about your opinion on this!