target/i386: Decode group 3 /1 instructions as TEST - #2353
Open
unknown-1-0 wants to merge 1 commit into
Open
Conversation
According to table A-6 in Volume 3 of AMD64 Architecture Programmer's Manual, group 3 instructions that have ModRM.reg field value of either 0 or 1 are decoded as TEST instruction. Although Volume 2 of Intel 64 and IA-32 Architectures Software Developer's Manual leaves the cell for ModRM.reg == 1 in group 3 in table A-6 blank, group 3 instructions with ModRM.reg == 1 seem to behave like TEST on Intel CPUs. Currently, Unicorn does not recognize group 3 instruction with ModRM.reg == 1. As a result, it raises an #UD exception. This behavior does not match that of a real hardware. Fix this issue by adding a missing `case 1:` to the group 3 decoder. Upstream QEMU issue: https://gitlab.com/qemu-project/qemu/-/work_items/3580 Signed-off-by: Andrey Polivoda <apolivodaa433@gmail.com>
unknown-1-0
force-pushed
the
i386-decode-modrm-reg-1-in-group-3-as-test
branch
from
August 12, 2026 13:39
fc5ebd1 to
e71f504
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
According to table A-6 in Volume 3 of AMD64 Architecture Programmer's Manual, group 3 instructions that have ModRM.reg field value of either 0 or 1 are decoded as TEST instruction.
Although Volume 2 of Intel 64 and IA-32 Architectures Software Developer's Manual leaves the cell for ModRM.reg == 1 in group 3 in table A-6 blank, group 3 instructions with ModRM.reg == 1 seem to behave like TEST on Intel CPUs.
Currently, Unicorn does not recognize group 3 instruction with ModRM.reg == 1. As a result, it raises an #UD exception. This behavior does not match that of a real hardware.
Fix this issue by adding a missing
case 1:to the group 3 decoder.Upstream QEMU issue: https://gitlab.com/qemu-project/qemu/-/work_items/3580