Bug 152501 - (daa) vex x86->IR: unhandled instruction bytes: 0x27 0x66 0x89 0x45
Summary: (daa) vex x86->IR: unhandled instruction bytes: 0x27 0x66 0x89 0x45
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: vex (show other bugs)
Version: 3.2.3
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-18 11:25 UTC by Sergei Trofimovich
Modified: 2007-11-23 23:13 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
C source for testing DAA instruction (2.33 KB, text/x-csrc)
2007-11-18 17:22 UTC, Sergei Trofimovich
Details
Contains test for DAA, DAS, AAA, AAS insns (3.88 KB, text/x-csrc)
2007-11-18 22:35 UTC, Sergei Trofimovich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Trofimovich 2007-11-18 11:25:03 UTC
Version:           3.2.3 (using KDE KDE 3.5.7)
Installed from:    Gentoo Packages
Compiler:          gcc version 4.2.2 (Gentoo 4.2.2 p1.0) Configured with: /var/tmp/portage/sys-devel/gcc-4.2.2/work/gcc-4.2.2/configure --prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.2.2 --includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.2/include --datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.2 --mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.2/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.2.2/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.2.2/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libunwind-exceptions --disable-multilib --enable-libmudflap --disable-libssp --disable-libgcj --with-arch=i686 --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
OS:                Linux

I use valgrind for testing an x86 emulator.
Emulator can run different x86 binaries (DOS, MS WINDOWS),
checks instructions and operands validness and runs
instructions on real processor. Some of binaries contain
old instructions: DAA, DAS, etc.

Valgrind crashes on them.
Comment 1 Julian Seward 2007-11-18 13:28:52 UTC
> instructions on real processor. Some of binaries contain
> old instructions: DAA, DAS, etc.


Write a program which tests DAA, DAS, etc, with all possible input 
values, so as to demonstrate correct behaviour of the instructions,
and send it.  That will make it much easier for me to implement
the instructions.
Comment 2 Sergei Trofimovich 2007-11-18 17:22:09 UTC
Created attachment 22105 [details]
C source for testing DAA instruction

Small program loops around all significant values of
AX: 0..0xFF; and EFLAGS: SF ZF AF PF CF
(according to intel specs).
Comment 3 Sergei Trofimovich 2007-11-18 21:29:18 UTC
Same tests can be ran for AAS, AAD, DAS.

* Should I attach 3 more files or write one test for all insns?
* Does this test look good or I've chosen wrong way?
Comment 4 Julian Seward 2007-11-18 21:48:42 UTC
> * Should I attach 3 more files or write one test for all insns?


One test for all 4 insns.

> * Does this test look good or I've chosen wrong way?


Yes, looks good.  I just need to implement them now.  Thanks.
Comment 5 Sergei Trofimovich 2007-11-18 22:35:39 UTC
Created attachment 22112 [details]
Contains test for DAA, DAS, AAA, AAS insns

New testcase, beware :)
On my p4-3.0GHz:
$ time { ./wr_sig > bcd_dump; }

real	0m8.269s
user	0m5.068s
sys	0m2.654s

Generates 320 MB log
Comment 6 Julian Seward 2007-11-23 03:47:48 UTC
Fixed (vex r1800).  Please verify.

Is it OK to include a simplified version of your test program in the
Valgrind test suite?
Comment 7 Sergei Trofimovich 2007-11-23 23:13:17 UTC
> Fixed (vex r1800).  Please verify.
(after i've left only AF and CF)
$ diff -uN orig_log vg_log | wc -l 
0
Great. Seems to work!

>Is it OK to include a simplified version of your test program in the
>Valgrind test suite?
Sure.

Thanks!