Mark Wielaard 0d4d18
commit e2dec0ff9b1e071779bee2c4e6fc82f8194b1c1d
Mark Wielaard 0d4d18
Author: Mark Wielaard <mark@klomp.org>
Mark Wielaard 0d4d18
Date:   Sun Jul 26 21:17:23 2020 +0200
Mark Wielaard 0d4d18
Mark Wielaard 0d4d18
    Handle REX prefixed JMP instruction.
Mark Wielaard 0d4d18
    
Mark Wielaard 0d4d18
    The NET Core runtime might generate a JMP with a REX prefix.
Mark Wielaard 0d4d18
    For Jv (32bit offset) and Jb (8bit offset) this is valid.
Mark Wielaard 0d4d18
    Prefixes that change operand size are ignored for such JMPs.
Mark Wielaard 0d4d18
    So remove the check for sz == 4 and force sz = 4 for Jv.
Mark Wielaard 0d4d18
    
Mark Wielaard 0d4d18
    https://bugs.kde.org/show_bug.cgi?id=422174
Mark Wielaard 0d4d18
Mark Wielaard 0d4d18
diff --git a/VEX/priv/guest_amd64_toIR.c b/VEX/priv/guest_amd64_toIR.c
Mark Wielaard 0d4d18
index fadf47d41..7888132eb 100644
Mark Wielaard 0d4d18
--- a/VEX/priv/guest_amd64_toIR.c
Mark Wielaard 0d4d18
+++ b/VEX/priv/guest_amd64_toIR.c
Mark Wielaard 0d4d18
@@ -21392,8 +21392,8 @@ Long dis_ESC_NONE (
Mark Wielaard 0d4d18
 
Mark Wielaard 0d4d18
    case 0xE9: /* Jv (jump, 16/32 offset) */
Mark Wielaard 0d4d18
       if (haveF3(pfx)) goto decode_failure;
Mark Wielaard 0d4d18
-      if (sz != 4) 
Mark Wielaard 0d4d18
-         goto decode_failure; /* JRS added 2004 July 11 */
Mark Wielaard 0d4d18
+      sz = 4; /* Prefixes that change operand size are ignored for this
Mark Wielaard 0d4d18
+                 instruction. Operand size is forced to 32bit. */
Mark Wielaard 0d4d18
       if (haveF2(pfx)) DIP("bnd ; "); /* MPX bnd prefix. */
Mark Wielaard 0d4d18
       d64 = (guest_RIP_bbstart+delta+sz) + getSDisp(sz,delta); 
Mark Wielaard 0d4d18
       delta += sz;
Mark Wielaard 0d4d18
@@ -21404,8 +21404,7 @@ Long dis_ESC_NONE (
Mark Wielaard 0d4d18
 
Mark Wielaard 0d4d18
    case 0xEB: /* Jb (jump, byte offset) */
Mark Wielaard 0d4d18
       if (haveF3(pfx)) goto decode_failure;
Mark Wielaard 0d4d18
-      if (sz != 4) 
Mark Wielaard 0d4d18
-         goto decode_failure; /* JRS added 2004 July 11 */
Mark Wielaard 0d4d18
+      /* Prefixes that change operand size are ignored for this instruction. */
Mark Wielaard 0d4d18
       if (haveF2(pfx)) DIP("bnd ; "); /* MPX bnd prefix. */
Mark Wielaard 0d4d18
       d64 = (guest_RIP_bbstart+delta+1) + getSDisp8(delta); 
Mark Wielaard 0d4d18
       delta++;