Commit Graph

16278 Commits

Author SHA1 Message Date
Petar Jovanovic
92ecddd13e mips: code refactoring (NFC)
Code in VEX/priv/guest_mips_toIR.c is notably refactored.
DSP ASE dissasembly has been put in a separate file: guest_mipsdsp_toIR.c.

Patch by Aleksandar Rikalo.
2019-03-27 18:42:05 +00:00
Mark Wielaard
8ed9b61432 Use ULong instead of unsigned long in s390_irgen_EX_SS.
ovl was defined as an unsigned long. This would cause warnings from gcc:

  guest_s390_toIR.c:195:30: warning: right shift count >= width of type
  [-Wshift-count-overflow]

when building on 32bit arches, or building a 32bit secondary arch.

Fix this by defining ovl as ULong which is always guaranteed 64bit.
2019-03-27 15:51:34 +01:00
Mark Wielaard
f04ae9f359 Use gcc -Wimplicit-fallthrough=2 by default if available
GCC 7 instroduced -Wimplicit-fallthrough
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

It caught a couple of bugs, but it does need a bit of extra comments to
explain when a switch case statement fall-through is deliberate. Luckily
with -Wimplicit-fallthrough=2 various existing comments already do that.
I have fixed the bugs, but adding explicit break statements where
necessary and added comments where the fall-through was correct.

https://bugs.kde.org/show_bug.cgi?id=405430
2019-03-27 15:34:45 +01:00
Petar Jovanovic
d6da48fe5a mips: use local labels for do_acasW()
use local labels for do_acasW() to avoid defining symbols multiple times
when the function gets inlined.

It fixes assembler error reported in KDE #400164.
2019-03-25 19:53:21 +01:00
Petar Jovanovic
77d4c217ce update .gitignore with amd64 tests f16c and rdrand
Add
  /none/tests/amd64/f16c
  /none/tests/amd64/rdrand

to .gitignore.
2019-03-25 17:45:04 +00:00
Petar Jovanovic
e61d130870 mips: if revision is specified, use it for compilation
If user has specified a particular MIPS revision in configure line,
do not interfere with this (i.e. skip setting FLAG_M32/FLAG_M64).

Related KDE issues #402123 and #400975.

Patch by Stefan Maksimovic.
2019-03-25 17:39:38 +00:00
Petar Jovanovic
b93d378296 mips: add a comment about decoding LX on Cavium
Interpret LX as a Cavium instruction, otherwise try decoding it as a DSP
instruction.
The fallthrough is deliberate.

Related to KDE #405430.
2019-03-25 16:47:09 +00:00
Carl Love
ed80ebfa17 PPC64, fix for vrlwnm, vrlwmi, vrldrm, vrldmi instructions.
Fixes the case where the specified end bit is less then the start bit.

Valgrind bug 405734
2019-03-22 12:50:52 -05:00
Carl Love
30a24515f0 PPC64, fix output for xvcvdpsp instruction.
The instruction should write the output to the upper and lower 32-bit
halfs of the results.

Valgrind bugzilla 405733.
2019-03-22 12:42:27 -05:00
Carl Love
e998650095 PPC64, The function _get_maxmin_fp_NaN does not handle the case of QNaN, SNaN correctly.
This patch fixes Valgrind to handle the case of QNaN, SNaN input the same
as the HW handles it.

Valgrind bug 405365.
2019-03-22 12:32:29 -05:00
Carl Love
d4686f635e PPC64, instructions xvcvdpsxws, xvcvdpuxws do not handle over/underflow, NaN correctly
The instructions are not checking for overflow, underflow, NaN and setting
the output correctly.

Valgrind bugzilla 405363
2019-03-22 12:26:00 -05:00
Carl Love
2da60f569f PPC64, fix for vmsummbm instruction.
The instruction needs to have the 32-bit "lane" values chopped to 32-bits.
The current lane implementation is not doing the chopping.  Need to
explicitly do the chop and add.

Valgrind bug 405362
2019-03-22 12:06:31 -05:00
Carl Love
886b0a1cf4 PPC64, fix implementation of xvcvsxdsp and xvcvuxddp instructions.
Instructions need to write result to upper and lower 32-bit half of the
64-bit result.

This is a fix for Valgrind bug 405356.
2019-03-22 11:56:38 -05:00
Bart Van Assche
30b3264e60 drd: Fix an integer overflow in the stack margin calculation 2019-03-21 20:09:16 -07:00
Petar Jovanovic
2cfe32ab11 update NEWS about the fix for KDE #405458
KDE #405458 has been fixed in the previous commit

  commit 029f1196fc
  Author: Petar Jovanovic <mips32r2@gmail.com>
  Date:   Mon Mar 18 16:47:50 2019 +0100

  mips: correct order of function arguments for mkFormVEC
2019-03-18 15:55:09 +00:00
Petar Jovanovic
029f1196fc mips: correct order of function arguments for mkFormVEC
Vectors wt and ws were incorrectly received in mkFormVEC().
Issue spotted by Mark Wielaard and reported as KDE #405458.
2019-03-18 16:48:45 +01:00
Julian Seward
472b067e39 amd64: Implement RDRAND, VCVTPH2PS and VCVTPS2PH.
Bug 398870 - Please add support for instruction vcvtps2ph
Bug 353370 - RDRAND amd64->IR: unhandled instruction bytes: 0x48 0xF 0xC7 0xF0

This commit implements:

* amd64 RDRAND instruction, on hosts that have it.

* amd64 VCVTPH2PS and VCVTPS2PH, on hosts that have it.

  The presence/absence of these on the host is now reflected in the CPUID
  results returned to the guest.  So code that tests for these features in
  CPUID and acts accordingly should "just work".

* New test cases, none/tests/amd64/rdrand and none/tests/amd64/f16c.  These
  are built if the host's assembler can handle them, in the usual way.
2019-03-17 21:43:26 +01:00
Philippe Waroquiers
081c34ea47 Fix Bug 404638 - Add VG_(replaceIndexXA)
Based on a patch from Łukasz Marek.

Note that this function differs from:
   *(T*)VG_(indexXA)(arr, index) = new_value;
as the function will mark the array as unsorted.

Note that this function is currently unused in the current valgrind code basis,
but it is useful for tools outside of valgrind tree.
2019-03-16 12:11:39 +01:00
Ilya Leoshkevich
7e9113cb7a Bug 405403 - s390x: Allow using disInstr_S390 on little-endian hosts
Certain projects, e.g. https://angr.io, use VEX as an intermediate
representation for the binary code analysis. In order to make it
possible to use them to analyze S/390 code on Intel, this patch
resolves the following issues in the disassembler:

- Bit fields, which are used to describe instruction formats, map to
  different bits on different hosts. This patch replaces them with
  macros, e.g. SS.l bit field becomes SS_l macro. Most bit field usages
  are replaced using the following perl script:

    perl -p -i \
         -e 's/\(&ovl\.value\)/&ovl/g;' \
         -e 's/ovl\.value/ovl/g;' \
         -e 's/ovl\.fmt\.([a-zA-Z\d_]+)\.([a-z\d]+)/$1_$2(ovl)/g' \
         priv/guest_s390_toIR.c

  Since after that there are no more structs, #pragma pack is also
  removed.

- Instructions are loaded from memory as words, which behaves
  differently depending on host endianness. Such loads are replaced by
  assembly of words from separately loaded bytes. This affects regular
  disassembly functions, and also s390_irgen_EXRL(), which loads
  last_execute_target this way.

- disInstr_S390() explicitly prohibits little-endian hosts with an
  assert, which is removed in this patch.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
2019-03-15 15:00:30 +01:00
Petar Jovanovic
cd20c8ca58 Finetune arch_hwcaps() in none/tests/libvex_test.c
The libvexmultiarch_test failed on s390, since VEX was configured for MIPS64
with 32bit FPUs. Modify arch_hwcaps() to a realist case with 64bit FPUs.

This fixes KDE #402351.
2019-03-14 16:02:53 +00:00
Tom Hughes
2102b6c369 Document 403123 as fixed 2019-03-14 15:22:44 +00:00
Tom Hughes
09566120e7 Suppress FSGSBASE flag from cpuid results
We don't support {rd,wr}{fs,gs}base so we shouldn't say we do.
2019-03-14 15:17:10 +00:00
Julian Seward
ea09451baf Bug 399287 - amd64 front end: Illegal Instruction vcmptrueps. Add test cases. 2019-03-13 14:25:41 +01:00
Julian Seward
ecc4e97093 Bug 399287 - amd64 front end: Illegal Instruction vcmptrueps. Fix, but no test cases. 2019-03-13 14:25:41 +01:00
Mark Wielaard
d15f70a925 Rename gettid() to gettid_sys() in gdbserver_tests.
glibc might defined gettid() itself through unistd.h:
https://sourceware.org/bugzilla/show_bug.cgi?id=6399

Rename to gettid_sys() so we don't clash with the glibc definition.
2019-03-13 13:34:01 +01:00
Julian Seward
4816357b5c VEX/auxprogs/genoffsets.c: Add cast to my_offsetof. n-i-bz.
Clang/LLVM trips over my_offsetof in VEX/auxprogs/genoffsets.c.  See LLVM
PR 40890 for details (https://bugs.llvm.org/show_bug.cgi?id=40890).

Now, it's a Clang bug that Clang exits on an assertion failure rather than
emits a diagnostic, but the previous my_offsetof expression is a pointer,
not an integer.  Add a cast as done in other definitions of offsetof in
the tree.  Patch from Ed Maste <emaste@freebsd.org>.
2019-03-12 18:37:15 +01:00
Rhys Kidd
901cec4bce Add missing documentation file from EXTRA_DIST
Ensure this documentation file is included in tarball.

Fixes: 9f3d49a ("Create 3.10.0 section in NEWS, add (first draft of) README_DEVELOPERS_processes")
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Rhys Kidd
3cd099ab5f macOS: Don't duplicate -fno-stack-protector
Since f38d96d -fno-stack-protector has been added to $(AM_CFLAGS_BASE) on all
platforms, if the compiler supports it. Accordingly, there's no need to still add
this a second time specifically for macOS.

Fixes: f38d96d ("Add -Wformat -Wformat-security to the list of compile flags.")
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Rhys Kidd
71cf18c120 config: Conditionalize -finline-functions on compiler support
Certain clang compiler versions do not support -finline-functions, so only apply
this compiler option conditionally if supported.

Warnings with Apple LLVM version 8.0.0 (clang-800.0.42.1), based on upstream clang 3.9.0:

  clang: warning: optimization flag '-finline-functions' is not supported
  clang: warning: argument unused during compilation: '-finline-functions'

Fixes: 7dd9a7f ("Add -finline-functions to standard build flags, so gcc will
                 consider all functions as candidates for inlining.")

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Rhys Kidd
fbc91518e5 Makefile.am: Consistent indent and align
This approach is utilized consistently throughout the file, and would make
alphabetical reordering easier. Adopt it here as well.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Rhys Kidd
bdfab93fab config: Set automake options consistenly in one location
Avoid use of two manners of setting automake configuration options,
and consolidate them into AM_INIT_AUTOMAKE macro.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Rhys Kidd
b06c2c7e23 config: remove unrequired AC_HEADER_STDC
Autoconf says:
"This macro is obsolescent, as current systems have conforming
header files. New programs need not use this macro".

Was previously required to ensure the system has C header files conforming
to ANSI C89 (ISO C90). Specifically, this macro checks for stdlib.h,
stdarg.h, string.h, and float.h.

This autoconf option was used to provide conditional fallback support
via defined STDC_HEADERS.

valgrind does not utilize conditional fallback support so, so this macro
is both obsolete and unused, so let's drop it.

Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-03-11 22:49:37 +11:00
Julian Seward
dffe3a2d1b Add a 3_14_BUGSTATUS.txt file and add to it all bugs reported since 3.14 was release.
At least, the bugs are post-triaged ones, so some have been removed.
2019-03-10 11:11:16 +01:00
Julian Seward
4ee1dd2778 bb_to_IR(): increase assertion limits on the maximum size of self-checking translations. n-i-bz. 2019-03-09 17:58:11 +01:00
Petar Jovanovic
3217459c72 modify massif/tests/mmapunmap.vgtest to comply with glibc change
The change in the glibc version (2.27 -> 2.28) results in one additional
function call being present in the backtrace for mips64, which leads to the
line to be checked to be out of bounds.

Changed the post line in mmapunmap.vgtest to work around this.

This fixes massif/tests/mmapunmap failure on mips64.

Patch by Stefan Maksimovic.
2019-03-04 19:26:37 +01:00
Mark Wielaard
7f74ba249e Bug 405079 - unhandled ppc64le-linux syscall: 131 (quotactl)
quotactl is really a "generic" linux syscall that just happened to not
have been hooked up for ppc64le. Add it to syswrap-ppc64-linux.c.
2019-03-04 17:22:56 +01:00
Julian Seward
6bcb493b03 Adjust the built-in profiler so that it can try to count host insns as well as guest insns. n-i-bz. 2019-02-26 09:57:57 +01:00
Julian Seward
85545d9d25 Fix another format string signedness warning, arm64-linux only. n-i-bz. 2019-02-25 11:48:43 +01:00
Mark Wielaard
256cf43c5e memcheck powerpc subfe x, x, x initializes x to 0 or -1 based on CA
GCC might use subfe x, x, x to initialize x to 0 or -1, based on
whether the carry flag is set. This happens in some cases when g++
compiles resetting a unique_ptr. The "trick" used by the compiler is
that it can AND a pointer with the register x (now 0x0 or 0xffffffff)
to set something to NULL or to the given pointer.

subfe is implemented as rD = (log not)rA + rB + XER[CA]
if we instead implement it as rD = rB - rA - (XER[CA] ^ 1)
then memcheck can see that rB and Ra cancel each other out if they
are the same.

https://bugs.kde.org/show_bug.cgi?id=404054
2019-02-21 17:21:53 +01:00
Carl Love
de7fc1a059 Fix missed changes from Rename some int<->fp conversion IROps patch
The previous commit 6b16f0e2a0 dated
Sat Jan 26 17:38:01 2019 by Julian Seward <jseward@acm.org> renamed some of
the int<->fp conversion Iops to add a trailing _DEP.  The patch missed
renaming two of the Iops.  This patch renames the missed Iops.
2019-02-05 10:19:01 -06:00
Julian Seward
e125eb3931 Make the DHAT viewer components be copied into the distribution tarball. Followup to 441bfc5f51 (dhat overhaul). 2019-02-03 10:31:15 +01:00
Julian Seward
15ac949bef Make the DHAT viewer components be copied into the install tree. Followup to 441bfc5f51 (dhat overhaul). 2019-02-03 10:06:36 +01:00
Julian Seward
cad6b8a984 Fix "make post-regtest-checks" after 441bfc5f51 (dhat overhaul). 2019-02-02 16:10:50 +01:00
Julian Seward
7094b51f0a Another -Wformat-signedness fix that was missed in dee1c5ac84. 2019-02-02 14:22:43 +01:00
Julian Seward
cadbb5d441 Enable -Wformat-signedness, if the compiler supports it. 2019-02-02 14:20:49 +01:00
Julian Seward
dee1c5ac84 Fix format string warnings from gcc9. No functional change (I think!) 2019-02-02 14:06:51 +01:00
Nicholas Nethercote
7e5fc882e9 Remove reference to non-existent *.post.exp files in dhat/tests/. 2019-02-02 07:41:02 +11:00
Nicholas Nethercote
f71002f1b5 Add missing stuff for a DHAT test. 2019-02-01 15:08:31 +11:00
Nicholas Nethercote
441bfc5f51 Overhaul DHAT.
This commit thoroughly overhauls DHAT, moving it out of the
"experimental" ghetto. It makes moderate changes to DHAT itself,
including dumping profiling data to a JSON format output file. It also
implements a new data viewer (as a web app, in dhat/dh_view.html).

The main benefits over the old DHAT are as follows.

- The separation of data collection and presentation means you can run a
  program once under DHAT and then sort the data in various ways. Also,
  full data is in the output file, and the viewer chooses what to omit.

- The data can be sorted in more ways than previously. Some of these
  sorts involve useful filters such as "short-lived" and "zero reads or
  zero writes".

- The tree structure view avoids the need to choose stack trace depth.
  This avoids both the problem of not enough depth (when records that
  should be distinct are combined, and may not contain enough
  information to be actionable) and the problem of too much depth (when
  records that should be combined are separated, making them seem less
  important than they really are).

- Byte and block measures are shown with a percentage relative to the
  global count, which helps gauge relative significance of different
  parts of the profile.

- Byte and blocks measures are also shown with an allocation rate
  (bytes and blocks per million instructions), which enables comparisons
  across multiple profiles, even if those profiles represent different
  workloads.

- Both global and per-node measurements are taken at the global heap
  peak ("At t-gmax"), which gives Massif-like insight into the point of
  peak memory use.

- The final/liftimes stats are a bit more useful than the old deaths
  stats. (E.g. the old deaths stats didn't take into account lifetimes
  of unfreed blocks.)

- The handling of realloc() has changed. The sequence `p = malloc(100);
  realloc(p, 200);` now increases the total block count by 2 and the
  total byte count by 300. Previously it increased them by 1 and 200.
  The new handling is a more operational view that better reflects the
  effect of allocations on performance. It makes a significant
  difference in the results, giving paths involving reallocation (e.g.
  repeated pushing to a growing vector) more prominence.

Other things of note:

- There is now testing, both regression tests that run within the
  standard test suite, and viewer-specific tests that cannot run within
  the standard test suite. The latter are run by loading
  dh_view.html?test=1 in a web browser.

- The commit puts all tool lists in Makefiles (and similar files) in the
  following consistent order: memcheck, cachegrind, callgrind, helgrind,
  drd, massif, dhat, lackey, none; exp-sgcheck, exp-bbv.

- A lot of fields in dh_main.c have been given more descriptive names.
  Those names now match those used in dh_view.js.
2019-02-01 14:54:34 +11:00
Julian Seward
b19f6882cf s390 back end: s390_isel_vec_expr_wrk: fix some enum type confusion. n-i-bz.
In s390_isel_vec_expr_wrk() there has been some assignments of enum-typed
values to variables of different enum types.  This fixes it.  It also adds a
few initialisations to variables of type HReg for safety against the
possibility of them being used uninitialised.  No functional change.  Tested
by Andreas Arnez.
2019-01-31 07:56:26 +01:00