From 8bb4226f07b1e9ee79f3429a1495eaa694b13334 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Fri, 6 Sep 2024 21:55:42 +0100 Subject: Fix more broken x86 cases Thanks Evan Lin for reporting. --- src/x86.c | 3 ++- src/x86.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/x86.c b/src/x86.c index 7a5d00e..e0431d6 100644 --- a/src/x86.c +++ b/src/x86.c @@ -1,5 +1,5 @@ /* - * Copyright © 2023 Michael Smith + * Copyright © 2024 Michael Smith * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -25,6 +25,7 @@ static int mrmsib(const uchar *p, int addrlen) { // But it's confusingly-written enough that the code I wrote before didn't // work, so with any luck nobody will need to refer to it again and this is // actually correct now. Fingers crossed. + if ((*p & 0xC6) == 0x06) return 3; // special case for disp16 if (addrlen == 4 || *p & 0xC0) { int sib = addrlen == 4 && *p < 0xC0 && (*p & 7) == 4; switch (*p & 0xC0) { diff --git a/src/x86.h b/src/x86.h index a62c0ee..52e4f9b 100644 --- a/src/x86.h +++ b/src/x86.h @@ -143,8 +143,6 @@ X(X86_XORALI, 0x34) \ X(X86_CMPALI, 0x3C) \ X(X86_PUSHI8, 0x6A) \ - X(X86_MOVALII, 0xA0) /* From offset (indirect) */ \ - X(X86_MOVIIAL, 0xA2) /* To offset (indirect) */ \ X(X86_TESTALI, 0xA8) \ X(X86_JO, 0x70) \ X(X86_JNO, 0x71) \ @@ -190,7 +188,9 @@ X(X86_XOREAXI, 0x35) \ X(X86_CMPEAXI, 0x3D) \ X(X86_PUSHIW, 0x68) \ + X(X86_MOVALII, 0xA0) /* From offset (indirect) */ \ X(X86_MOVEAXII, 0xA1) /* From offset (indirect) */ \ + X(X86_MOVIIAL, 0xA2) /* To offset (indirect) */ \ X(X86_MOVIIEAX, 0xA3) /* To offset (indirect) */ \ X(X86_TESTEAXI, 0xA9) \ X(X86_MOVEAXI, 0xB8) \ -- cgit v1.2.3