Bug 212353

Summary: vex amd64->IR: unhandled instruction bytes: 0x48 0xE9 (REX.W JMP)
Product: [Developer tools] valgrind Reporter: Mark Harris <markh>
Component: vexAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 3.5.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Bug Depends on:    
Bug Blocks: 253451    

Description Mark Harris 2009-10-30 05:13:08 UTC
Attempting to use valgrind on a VHDL simulation compiled to x86_64 code on
RHEL 4, I encountered the following message from valgrind:

vex amd64->IR: unhandled instruction bytes: 0x48 0xE9 0x2A 0x7 0x0 0x0
==29986== valgrind: Unrecognised instruction at address 0x686a004.

The instruction is REX.W JMP rel32off.  VEX does not like the redundant
REX.W prefix.

I was able to correct the problem by adding the following line to
VEX/priv/guest_amd64_toIR.c:

--- guest_amd64_toIR.c.orig     2009-08-19 06:37:52.000000000 -0700
+++ guest_amd64_toIR.c  2009-10-29 20:20:58.106941000 -0700
@@ -13941,6 +13941,7 @@

    case 0xE9: /* Jv (jump, 16/32 offset) */
       if (haveF2orF3(pfx)) goto decode_failure;
+      if (sz == 8) sz = 4;
       if (sz != 4)
          goto decode_failure; /* JRS added 2004 July 11 */
       d64 = (guest_RIP_bbstart+delta+sz) + getSDisp(sz,delta);