Hi,

I'd like to provide a patch for VEX/priv/guest_x86_toIR.c such that running user
code that uses a 32-bit Goto BLAS library through memcheck (from the valgrind
3.5.0 release or earlier releases) does not issue a

> vex x86->IR: unhandled instruction bytes: 0xF 0xE 0x89 0xE6
> ==29436== valgrind: Unrecognised instruction at address 0x4124d04.
> ==29436== Your program just tried to execute an instruction that Valgrind
> ==29436== did not recognise.  There are two possible reasons for this.
> ==29436== 1. Your program has a bug and erroneously jumped to a non-code
> ==29436==    location.  If you are running Memcheck and you just saw a
> ==29436==    warning about a bad jump, it's probably your program's fault.
> ==29436== 2. The instruction is legitimate but Valgrind doesn't handle it,
> ==29436==    i.e. it's Valgrind's fault.  If you think this is the case or
> ==29436==    you are not sure, please let us know and we'll try to fix it.
> ==29436== Either way, Valgrind will now raise a SIGILL signal which will
> ==29436== probably kill your program.
> 
> Program received signal 4 (SIGILL): Illegal instruction.

any more.

The patch applies the same changes as the first patch for #124499 discussed in
http://bugs.kde.org/show_bug.cgi?id=124499 (comment #3) which subsequently made
it - along with other changes not required here - into the source code
(VEX/priv/guest_amd64_toIR.c) with revision 1604.

A sample code using the critical DTRSM BLAS function is attached. Get Goto BLAS
at http://www-prc.tacc.utexas.edu/resources/software/software.php?#blas, unpack,
compile it on a 32-bit Linux machine using ./quickbuild.32bit. Then, compile the
sample code, link it against Goto BLAS and run valgrind against it:

  gfortran -g sample.f90 -lgoto
  valgrind ./a.out

Without the patch, memcheck bails out.

with kind regards,
Sven
diff -Naur original/valgrind-3.5.0/VEX/priv/guest_x86_toIR.c 
patched/valgrind-3.5.0/VEX/priv/guest_x86_toIR.c
--- original/valgrind-3.5.0/VEX/priv/guest_x86_toIR.c   2009-08-19 
15:37:52.000000000 +0200
+++ patched/valgrind-3.5.0/VEX/priv/guest_x86_toIR.c    2009-08-20 
10:35:41.000000000 +0200
@@ -14682,11 +14682,12 @@
          break;
       }

+      case 0x0E: /* FEMMS */
       case 0x77: /* EMMS */
          if (sz != 4)
             goto decode_failure;
          do_EMMS_preamble();
-         DIP("emms\n");
+         DIP("{f}emms\n");
          break;

       /* =-=-=-=-=-=-=-=-=- unimp2 =-=-=-=-=-=-=-=-=-=-= */

program main
  ! example taken from 
  ! 
http://users.physik.tu-muenchen.de/gammel/matpack/html/Software/Blas/blas3_dtrsm.html
  REAL*8 A(100,40), B(40,20), alpha
  M = 16
  N = 18
  LDA = 100
  LDB = 40
  alpha = 2.0D0
  CALL DTRSM ('L','U','N','U',M,N,alpha,A,LDA,B,LDB)
end program
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to