Skip to content

Commit 172d99c

Browse files
committed
[DISASSEMBLER] Treat F6/F7 /1 as TEST aliases (sync microsoft#374)
Handle Group 3 opcode extension /1 for F6/F7 the same as /0 when sizing TEST immediates. Current CPUs execute these encodings as TEST aliases, although public manuals only document /0.
1 parent 51acce4 commit 172d99c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Source/KNSoft.SlimDetours/Disassembler.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,10 +1424,10 @@ CopyF6(
14241424
{
14251425
UNREFERENCED_PARAMETER(pEntry);
14261426

1427-
// TEST BYTE /0
1428-
if (0x00 == (0x38 & pbSrc[1]))
1427+
// TEST BYTE /0 and /1 (/1 is an undocumented alias of /0).
1428+
if (0x00 == (0x30 & pbSrc[1]))
14291429
{
1430-
// reg(bits 543) of ModR/M == 0
1430+
// reg(bits 543) of ModR/M == 000 or 001
14311431
REFCOPYENTRY ce = /* f6 */ &g_rceCopyMap[eENTRY_CopyBytes2Mod1];
14321432
return ce->pfCopy(pDisasm, ce, pbDst, pbSrc);
14331433
} else
@@ -1453,10 +1453,10 @@ CopyF7(
14531453
{
14541454
UNREFERENCED_PARAMETER(pEntry);
14551455

1456-
// TEST WORD /0
1457-
if (0x00 == (0x38 & pbSrc[1]))
1456+
// TEST WORD /0 and /1 (see CopyF6 for /1 rationale).
1457+
if (0x00 == (0x30 & pbSrc[1]))
14581458
{
1459-
// reg(bits 543) of ModR/M == 0
1459+
// reg(bits 543) of ModR/M == 000 or 001
14601460
REFCOPYENTRY ce = /* f7 */ &g_rceCopyMap[eENTRY_CopyBytes2ModOperand];
14611461
return ce->pfCopy(pDisasm, ce, pbDst, pbSrc);
14621462
} else

0 commit comments

Comments
 (0)