https://bugs.kde.org/show_bug.cgi?id=493004

            Bug ID: 493004
           Summary: amd64: Support lods rep prefixes
    Classification: Developer tools
           Product: valgrind
           Version: 3.23 GIT
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: vex
          Assignee: jsew...@acm.org
          Reporter: cont...@mborgerson.com
  Target Milestone: ---

Created attachment 173577
  --> https://bugs.kde.org/attachment.cgi?id=173577&action=edit
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.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to