Created attachment 173577 [details] Patch SUMMARY Attached patch adds support for rep prefixes on the lods instruction. STEPS TO REPRODUCE Build and run https://github.com/qemu/qemu/blob/master/tests/tcg/i386/test-i386.c OBSERVED RESULT Instruction is not repeated as expected. See below: ``` $ diff <(./test-i386) <(~/valgrind-src/bin/valgrind ./test-i386) ==38992== Memcheck, a memory error detector ==38992== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al. ==38992== Using Valgrind-3.24.0.GIT and LibVEX; rerun with -h for copyright info ==38992== Command: ./test-i386 ==38992== ==38992== ==38992== HEAP SUMMARY: ==38992== in use at exit: 0 bytes in 0 blocks ==38992== total heap usage: 1 allocs, 1 frees, 4,096 bytes allocated ==38992== ==38992== All heap blocks were freed -- no leaks are possible ==38992== ==38992== For lists of detected and suppressed errors, rerun with: -s ==38992== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 9122,9225c9122,9225 ... < rep lodsb ESI=00005e41fb9f5931 EDI=00005e41fb9f5930 EAX=1234fdb512345678 ECX=0000000000000000 EFL=0000 < rep lodsw ESI=00005e41fb9f5942 EDI=00005e41fb9f5930 EAX=1234fdb512345678 ECX=0000000000000000 EFL=0000 < rep lodsl ESI=00005e41fb9f5964 EDI=00005e41fb9f5930 EAX=0000000012345678 ECX=0000000000000000 EFL=0000 < rep lodsq ESI=00005e41fb9f59a8 EDI=00005e41fb9f5930 EAX=1234fdb512345678 ECX=0000000000000000 EFL=0000 < rep lodsb ESI=00005e41fb9f590f EDI=00005e41fb9f5930 EAX=1234fdb512345678 ECX=0000000000000000 EFL=0000 < rep lodsw ESI=00005e41fb9f58fe EDI=00005e41fb9f5930 EAX=1234fdb512345678 ECX=0000000000000000 EFL=0000 < rep lodsl ESI=00005e41fb9f58dc EDI=00005e41fb9f5930 EAX=0000000012345678 ECX=0000000000000000 EFL=0000 < rep lodsq ESI=00005e41fb9f5898 EDI=00005e41fb9f5930 EAX=dddcdbdad9d8d7d6 ECX=0000000000000000 EFL=0000 --- > rep lodsb ESI=0000000000127921 EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > rep lodsw ESI=0000000000127922 EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > rep lodsl ESI=0000000000127924 EDI=0000000000127930 EAX=0000000012345678 ECX=0000000000000011 EFL=0000 > rep lodsq ESI=0000000000127928 EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > rep lodsb ESI=000000000012791f EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > rep lodsw ESI=000000000012791e EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > rep lodsl ESI=000000000012791c EDI=0000000000127930 EAX=0000000012345678 ECX=0000000000000011 EFL=0000 > rep lodsq ESI=0000000000127918 EDI=0000000000127930 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 > movsb ESI=0000000000127921 EDI=0000000000127931 EAX=1234fdb512345678 ECX=0000000000000011 EFL=0000 ``` EXPECTED RESULT lods should be executed repeatedly, with the values observed on the left of the diff (minus ASLR differences) SOFTWARE/OS VERSIONS Valgrind: VALGRIND_3_23_0-108-g5d404b97d ADDITIONAL INFORMATION Discovered via QEMU differential tests. A version of these tests, with these particular cases commented out, are in Valgrind at /VEX/test/test-amd64.c, but the test in Valgrind repo does not compile.
Do any of these recent items occur in real world compiled code or are they all just from synthetic qemu testcases?
(In reply to Paul Floyd from comment #1) > Do any of these recent items occur in real world compiled code or are they > all just from synthetic qemu testcases? Paul Floyd: The recent issues/patches I've posted to the Valgrind bug tracker were discovered after running [QEMU's unit tests](https://github.com/qemu/qemu/blob/master/tests/tcg/i386/test-i386.c). I've not measured 'real world compiled code' prevalence for these items