diff options
author | 2024-09-07 12:57:38 +0100 | |
---|---|---|
committer | 2024-09-07 12:57:38 +0100 | |
commit | 43c64eee8dd08d61d029be5a30c0edc098d282ab (patch) | |
tree | a71e412b1fefd3abf89093ca4830a5cf3ba1c46e /src/x86.c | |
parent | 8bb4226f07b1e9ee79f3429a1495eaa694b13334 (diff) | |
download | sst-43c64eee8dd08d61d029be5a30c0edc098d282ab.tar.gz sst-43c64eee8dd08d61d029be5a30c0edc098d282ab.zip |
Un-break and re-fix x86
The last fix was, uh, not good. With any luck this is actually correct
now. Certainly, running many millions of test cases fails to find any
mismatch with udis, so it's at least a lot less wrong than it was.
Diffstat (limited to 'src/x86.c')
-rw-r--r-- | src/x86.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -25,7 +25,6 @@ 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) { @@ -41,7 +40,7 @@ static int mrmsib(const uchar *p, int addrlen) { case 0x80: return 1 + addrlen + sib; } } - if (addrlen == 2 && *p == 0x26) return 3; + if (addrlen == 2 && (*p & 0xC7) == 0x06) return 3; return 1; // note: include the mrm itself in the byte count } @@ -66,6 +65,7 @@ P: X86_SEG_PREFIXES(CASES) X86_OPS_1BYTE_NO(CASES) return pfxlen + 1; X86_OPS_1BYTE_I8(CASES) operandlen = 1; X86_OPS_1BYTE_IW(CASES) return pfxlen + 1 + operandlen; + X86_OPS_1BYTE_IWI(CASES) return pfxlen + 1 + addrlen; X86_OPS_1BYTE_I16(CASES) return pfxlen + 3; X86_OPS_1BYTE_MRM(CASES) return pfxlen + 1 + mrmsib(insn + 1, addrlen); X86_OPS_1BYTE_MRM_I8(CASES) operandlen = 1; |