]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
9 years agomips: add definitions of expected ISA levels
Petar Jovanovic [Thu, 26 Nov 2015 18:17:33 +0000 (18:17 +0000)] 
mips: add definitions of expected ISA levels

Add values of supported isa level for MIPS CPU models. This extended
information will be packed in 31:24 bits in hwcaps.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3205

9 years agomips: add definitions for more MIPS processors
Petar Jovanovic [Mon, 23 Nov 2015 15:33:45 +0000 (15:33 +0000)] 
mips: add definitions for more MIPS processors

Add more constants to be used to differentiate MIPS processors in hwcaps.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3204

9 years agomips: fix incorrect assert for hwcaps_host
Petar Jovanovic [Fri, 13 Nov 2015 15:45:38 +0000 (15:45 +0000)] 
mips: fix incorrect assert for hwcaps_host

Fix incorrect and incomplete assert condition for hwcaps_host in
iselSB_MIPS().

Spotted by Coverity and reported by Rhys Kidd.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3203

9 years agoAdd ISA 2.07 vbit test support
Carl Love [Tue, 3 Nov 2015 17:44:55 +0000 (17:44 +0000)] 
Add ISA 2.07 vbit test support

The ISA 2.07 support adds new Iops as well as support for some existing
Iops.  None of these Iops have been enabled in the vbit tester.  This commit
adds the needed support to the files VEX/priv/ir_inject and VEX/pub/libvex.h.
These changes add support for additional immediate operands.

There are additional changes to the memcheck files to complete the ISA 2.07
support.

Bugzilla 354797 was created for this issue.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3202

9 years agoInterpret memory as an ULong value.
Florian Krohm [Sat, 17 Oct 2015 11:19:11 +0000 (11:19 +0000)] 
Interpret memory as an ULong value.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3201

9 years agoGive typeOfPrimop external linkage. This allows us to simplify
Florian Krohm [Fri, 16 Oct 2015 17:26:22 +0000 (17:26 +0000)] 
Give typeOfPrimop external linkage. This allows us to simplify
memcheck/tests/vbit-test which used to have local copies of certain
functions from ir_defs.c

git-svn-id: svn://svn.valgrind.org/vex/trunk@3200

9 years agoBug 278744 cvtps2pd with redundant RexW followup.
Mark Wielaard [Mon, 12 Oct 2015 20:14:48 +0000 (20:14 +0000)] 
Bug 278744 cvtps2pd with redundant RexW followup.

Add correct parentheses as pointed out by GCC 4.9.2 -Wparentheses.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3199

9 years agoBug 278744 cvtps2pd with redundant RexW
Mark Wielaard [Mon, 12 Oct 2015 14:30:58 +0000 (14:30 +0000)] 
Bug 278744 cvtps2pd with redundant RexW

git-svn-id: svn://svn.valgrind.org/vex/trunk@3198

9 years agoDon't advertise RDRAND in cpuid for Core-i7-4910-like avx2 machine.
Mark Wielaard [Thu, 1 Oct 2015 12:31:19 +0000 (12:31 +0000)] 
Don't advertise RDRAND in cpuid for Core-i7-4910-like avx2 machine.

Bug#353370. In amd64g_dirtyhelper_CPUID_avx2 we set the RDRAND bit
but we don't implement support for RDRAND. Turn the bit off so programs
don't try to use RDRAND when running under valgrind.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3197

9 years agoFix, Add support for the Power PC Program Priority Register
Carl Love [Mon, 21 Sep 2015 21:46:46 +0000 (21:46 +0000)] 
Fix, Add support for the Power PC Program Priority Register

Commit r3189 had a typo in it.  In function LibVEX_GuestPPC64_initialise()
the value of  vex_state->guest_PSPB is initialized to 0x0.  The intention was
for it to be initialized to 0x100.  This commit fixes the typo.

The original commit message:

  Added the Program Priority Register (PPR), support to read and write it
  via the mfspr and mtspr instructions as well as the special OR instruction
  No Op instructions.  The setting of the PPR is dependent on the value in
  the Problem State Priority Boost register.  Basic support for this register
  was added.  Not all of the PSPB register functionality was added.

  This patch fixes bugzilla 352769.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3194

9 years agoAdd support for the Power PC mbar instruction.
Carl Love [Wed, 16 Sep 2015 23:01:04 +0000 (23:01 +0000)] 
Add support for the Power PC mbar instruction.

This patch fixes bugzilla 352768.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3190

9 years agoAdd support for the Power PC Program Priority Register
Carl Love [Wed, 16 Sep 2015 22:26:59 +0000 (22:26 +0000)] 
Add support for the Power PC Program Priority Register

Added the Program Priority Register (PPR), support to read and write it
via the mfspr and mtspr instructions as well as the special OR instruction
No Op instructions.  The setting of the PPR is dependent on the value in
the Problem State Priority Boost register.  Basic support for this register
was added.  Not all of the PSPB register functionality was added.

This patch fixes bugzilla 352769.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3189

9 years agoppc: The functions dis_dfp_fmt_conv and dis_dfp_exponent_test
Florian Krohm [Mon, 14 Sep 2015 19:36:29 +0000 (19:36 +0000)] 
ppc: The functions dis_dfp_fmt_conv and dis_dfp_exponent_test
should only be executed in case DFP is supported. Add missing
guards.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3188

9 years agoImprove the spechelper for S390_CC_OP_TEST_UNDER_MASK_16.
Florian Krohm [Tue, 8 Sep 2015 06:25:02 +0000 (06:25 +0000)] 
Improve the spechelper for S390_CC_OP_TEST_UNDER_MASK_16.
Fixes BZ #352284.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3186

9 years agoiselStmt, case Ist_Exit: handle the same assisted transfer cases that
Julian Seward [Mon, 7 Sep 2015 13:06:59 +0000 (13:06 +0000)] 
iselStmt, case Ist_Exit: handle the same assisted transfer cases that
iselNext does.  Fixes #352320.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3185

9 years agoFurther kludge stack alignment issues in x86g_dirtyhelper_FXRSTOR.
Julian Seward [Mon, 7 Sep 2015 08:22:03 +0000 (08:22 +0000)] 
Further kludge stack alignment issues in x86g_dirtyhelper_FXRSTOR.
Fixes (for some definition of "fix") #350359.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3184

9 years agos390: Add support for fixbr(a) instructions.
Florian Krohm [Sat, 5 Sep 2015 20:35:52 +0000 (20:35 +0000)] 
s390: Add support for fixbr(a) instructions.
New IROp Iop_RoundF128toInt.
Patch by Andreas Arnez <arnez@linux.vnet.ibm.com>.
Part of fixing BZ #350290.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3183

9 years agoFix undefined behaviours (left shifting a negative value)
Florian Krohm [Wed, 2 Sep 2015 15:46:05 +0000 (15:46 +0000)] 
Fix undefined behaviours (left shifting a negative value)
as pointed out by clang 3.7

git-svn-id: svn://svn.valgrind.org/vex/trunk@3182

9 years agoUpdate copyright dates, to include 2015. No functional change.
Julian Seward [Fri, 21 Aug 2015 11:29:16 +0000 (11:29 +0000)] 
Update copyright dates, to include 2015.  No functional change.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3181

9 years agoReading from TPIDRURO_EL0 and PMUSERENR_EL0: make these properly
Julian Seward [Thu, 20 Aug 2015 16:53:18 +0000 (16:53 +0000)] 
Reading from TPIDRURO_EL0 and PMUSERENR_EL0: make these properly
conditional in Thumb mode.  They never were before, which strikes
me as incorrect.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3180

9 years agoImplement reading from PMUSERENR_EL0, making it return zero.
Julian Seward [Thu, 20 Aug 2015 16:17:11 +0000 (16:17 +0000)] 
Implement reading from PMUSERENR_EL0, making it return zero.
Fixes (for some definition of "fix") #345984.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3179

9 years agoImplement YIELD. Followup to #348377.
Julian Seward [Tue, 18 Aug 2015 19:55:16 +0000 (19:55 +0000)] 
Implement YIELD.  Followup to #348377.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3178

9 years agoImplement YIELD (encodings T1 and A1). Fixes #348377.
Julian Seward [Mon, 17 Aug 2015 13:55:41 +0000 (13:55 +0000)] 
Implement YIELD (encodings T1 and A1).  Fixes #348377.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3177

9 years agoImplement VCVT.{S,U}32.F32, S[n], S[n], #imm. Fixes 342783.
Julian Seward [Mon, 17 Aug 2015 08:20:55 +0000 (08:20 +0000)] 
Implement VCVT.{S,U}32.F32, S[n], S[n], #imm.  Fixes 342783.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3176

9 years agoLoosen guarding conditions on "mov.w Reg, Reg" so as to allow
Julian Seward [Mon, 17 Aug 2015 07:29:07 +0000 (07:29 +0000)] 
Loosen guarding conditions on "mov.w Reg, Reg" so as to allow
reading or writing of SP.  Fixes #335618.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3175

9 years agoImplement PRFM (register). Fixes #345177.
Julian Seward [Sun, 16 Aug 2015 11:44:30 +0000 (11:44 +0000)] 
Implement PRFM (register).  Fixes #345177.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3174

9 years agovex x86->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xB (ROUNDSD) on OS X
Rhys Kidd [Sat, 15 Aug 2015 07:39:27 +0000 (07:39 +0000)] 
vex x86->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xB (ROUNDSD) on OS X
bz#350062

On OS X 10.10

Before:

== 592 tests, 216 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 592 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

git-svn-id: svn://svn.valgrind.org/vex/trunk@3173

9 years agoHandle PCMPxSTRx case 0x18. Fixes #348574.
Julian Seward [Thu, 13 Aug 2015 14:18:42 +0000 (14:18 +0000)] 
Handle PCMPxSTRx case 0x18.  Fixes #348574.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3172

9 years agoHandle PCMPxSTRx case 0x42. Fixes #339820.
Julian Seward [Thu, 13 Aug 2015 13:44:33 +0000 (13:44 +0000)] 
Handle PCMPxSTRx case 0x42.  Fixes #339820.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3171

9 years agoFix a bunch of missing AVX VCMPPD/VCMPPS cases.
Julian Seward [Thu, 13 Aug 2015 12:38:45 +0000 (12:38 +0000)] 
Fix a bunch of missing AVX VCMPPD/VCMPPS cases.
Fixes #342571, #346476, #348387, #350593.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3170

9 years agoImplement XSAVE/XRSTOR for AVX (state components 0, 1 and 2)
Julian Seward [Wed, 12 Aug 2015 11:15:53 +0000 (11:15 +0000)] 
Implement XSAVE/XRSTOR for AVX (state components 0, 1 and 2)

Refactor existing FXSAVE / FXRSTOR implementation so as to use
the new code, since these are sub-cases of the general XSAVE/XRSTOR
functionality.

Add a new CPUID level to indicate CPUs which are AVX2 compatible,
and enable it by default on AVX2 compatible hosts.

For both the AVX and AVX2 simulated CPUIDs, claim that XSAVEOPT is not
supported, in an attempt to avoid having to implement it.

Remove CPUID kludgery to do with OSX 10.10 (Yosemite) in order to
persuade it not to use XSAVE/XRSTOR.

libvex_ir.h: add new guarded load conversion "ILGop_IdentV128"
as required by XSAVE/XRSTOR support.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3169

10 years agoRemoved unused code that has been lying around since the major refactoring
Julian Seward [Sat, 8 Aug 2015 07:18:08 +0000 (07:18 +0000)] 
Removed unused code that has been lying around since the major refactoring
of this file a couple of years back.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3168

10 years agoFix printf format inconsistencies as pointed out by GCC's
Florian Krohm [Mon, 3 Aug 2015 16:03:13 +0000 (16:03 +0000)] 
Fix printf format inconsistencies as pointed out by GCC's
-Wformat-signedness.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3167

10 years agomips64: make cavium CvmCount register accessible via rdhwr
Petar Jovanovic [Tue, 21 Jul 2015 22:27:19 +0000 (22:27 +0000)] 
mips64: make cavium CvmCount register accessible via rdhwr

Fixes reported issue BZ #346031.

Patch by Crestez Dan Leonard.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3166

10 years agoBug 345248 - add support for Solaris OS in valgrind
Julian Seward [Tue, 21 Jul 2015 14:43:23 +0000 (14:43 +0000)] 
Bug 345248 - add support for Solaris OS in valgrind

VEX aspects -- pretty minimal.

Authors of this port:
    Petr Pavlu         setup@dagobah.cz
    Ivo Raisr          ivosh@ivosh.net
    Theo Schlossnagle  theo@omniti.com

git-svn-id: svn://svn.valgrind.org/vex/trunk@3165

10 years agoFix an obvious typo as reported by dcb314@hotmail.com in BZ #350251.
Florian Krohm [Thu, 16 Jul 2015 21:42:11 +0000 (21:42 +0000)] 
Fix an obvious typo as reported by dcb314@hotmail.com in BZ #350251.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3164

10 years agomips: emit addiu instead of addi
Petar Jovanovic [Mon, 13 Jul 2015 00:04:28 +0000 (00:04 +0000)] 
mips: emit addiu instead of addi

Remove wrong emission of addi when addiu is correct, sufficient and needed.
Attention to this part of the code has been brought by BZ #338924. This
patch fixes the reported issue as well.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3163

10 years agos390: Add support for FIEBR(A) and FIDBR(A).
Florian Krohm [Thu, 9 Jul 2015 20:59:24 +0000 (20:59 +0000)] 
s390: Add support for FIEBR(A) and FIDBR(A).
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com). Part of fixing BZ #342841.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3162

10 years agoFix a bug for TileGX platform found by instruction tests.
Zhi-Gang Liu [Tue, 7 Jul 2015 14:28:38 +0000 (14:28 +0000)] 
Fix a bug for TileGX platform found by instruction tests.

The issue is of the dirty helper of the SIMD instructions
with immediate operand.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3161

10 years agoAdd some functions for misaligned load/store support, and use them
Julian Seward [Tue, 7 Jul 2015 12:41:33 +0000 (12:41 +0000)] 
Add some functions for misaligned load/store support, and use them
in the x86 and amd64 chainer/unchainer.  This makes it possible to
run at least some programs when built with gcc 5.1, with ubsan misaligned
checking enabled.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3160

10 years agoFix condition to avoid that decode[] is indexed out-of-bounds.
Florian Krohm [Wed, 1 Jul 2015 11:30:02 +0000 (11:30 +0000)] 
Fix condition to avoid that decode[] is indexed out-of-bounds.
Spotted by Coverity.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3159

10 years agoRemove unused computations. Spotted by Coverity.
Florian Krohm [Wed, 1 Jul 2015 11:07:03 +0000 (11:07 +0000)] 
Remove unused computations. Spotted by Coverity.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3158

10 years ago* Fix ubsan failures in mullS64 due to signed integer overflow.
Julian Seward [Tue, 30 Jun 2015 13:37:45 +0000 (13:37 +0000)] 
* Fix ubsan failures in mullS64 due to signed integer overflow.
* Take the opportunity to replace 0xFFFFFFFF with a symbolic
  constant.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3157

10 years agomips64: do not use 64-bit loads for lwl/lwr instructions
Petar Jovanovic [Wed, 24 Jun 2015 18:47:39 +0000 (18:47 +0000)] 
mips64: do not use 64-bit loads for lwl/lwr instructions

As reported in BZ #346562, lwl/lwr were implemented incorrectly using
64-bit loads. This has led to incorrect "invalid read of size 8"
warnings. This patch fixes it, and it does some formatting to make the
code more readable.

Original version of the patch proposed by Crestez Dan Leonard.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3156

10 years agoFix a few undefined shift operations as spotted by ubsan.
Florian Krohm [Mon, 22 Jun 2015 11:53:48 +0000 (11:53 +0000)] 
Fix a few undefined shift operations as spotted by ubsan.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3155

10 years ago* x86: on an SSE2 only host, Valgrind in 32 bits now claims to be a Pentium 4.
Philippe Waroquiers [Thu, 18 Jun 2015 21:31:32 +0000 (21:31 +0000)] 
* x86: on an SSE2 only host, Valgrind in 32 bits now claims to be a Pentium 4.
       3.10.1 was wrongly claiming to be a CORE 2, which is SSSE3.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3154

10 years agoA SSE2 only CPU was reported to the guest as a SSE3 CPU.
Philippe Waroquiers [Wed, 17 Jun 2015 21:33:19 +0000 (21:33 +0000)] 
A SSE2 only CPU was reported to the guest as a SSE3 CPU.
The guest code might then select functions calling invalid
instructions.
E.G. giving:
  vex x86->IR: unhandled instruction bytes: 0x66 0xF 0x3A 0xF
  ==13094== valgrind: Unrecognised instruction at address 0x496d4d3.
  ==13094==    at 0x496D4D3: __mempcpy_ssse3 (memcpy-ssse3.S:771)
  ==13094==    by 0x125E0B: ??? (in /bin/dash)
as the host hw cap is not SSE3 enabled, while the guest believes
SSE3 can be used.

So, change CPUID so as to report an SSE3 if the hw is SSE3,
and otherwise SSE1 or lower.

(an SSE2 cpu might be added later on)

git-svn-id: svn://svn.valgrind.org/vex/trunk@3153

10 years agomips64: add support for Cavium LHX
Petar Jovanovic [Tue, 16 Jun 2015 23:40:21 +0000 (23:40 +0000)] 
mips64: add support for Cavium LHX

This patch adds support for LHX (Load Halfword Indexed) instruction.
It is available on CVMv2/MIPS DSP.

Issue reported in BZ #345987.

Patch by Crestez Dan Leonard.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3152

10 years agoJust a dummy white space change to record the fact that in
Florian Krohm [Fri, 5 Jun 2015 19:48:24 +0000 (19:48 +0000)] 
Just a dummy white space change to record the fact that in
r3150 an incorrect BZ # was referenced.
It should say in r3150: BZ #348748  not  BZ #348565.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3151

10 years agoFix a condition that was always true. Found by cppcheck.
Florian Krohm [Fri, 5 Jun 2015 19:35:32 +0000 (19:35 +0000)] 
Fix a condition that was always true. Found by cppcheck.
See BZ #348565.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3150

10 years agoOpps, missed a change in the previous patch. Forgot to remove the format
Carl Love [Fri, 5 Jun 2015 18:52:57 +0000 (18:52 +0000)] 
Opps, missed a change in the previous patch.  Forgot to remove the format
specifier.

The dcbt and dcbtst instructions provide a non-zero hint that describes
a block or data stream to which a program may perform a Store acces,
or indicates the expected use.  The field bits[25:21] (bits 6:10 in
the IBM numbering) in the instruction provide the hint.

Valgrind checks that these bits are non-zero.  Unfortunately, the test was
being applied to other instructions such as the dcbf instruction causing
it to fail when the field was equal to zero.  This patch removes the check
that was being incorrectly applied to all of the instructions.

The valgrind bugzilla for this issue is 348334.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3149

10 years agoThe dcbt and dcbtst instructions provide a non-zero hint that describes
Carl Love [Fri, 5 Jun 2015 17:58:23 +0000 (17:58 +0000)] 
The dcbt and dcbtst instructions provide a non-zero hint that describes
a block or data stream to which a program may perform a Store acces,
or indicates the expected use.  The field bits[25:21] (bits 6:10 in
the IBM numbering) in the instruction provide the hint.

Valgrind checks that these bits are non-zero.  Unfortunately, the test was
being applied to other instructions such as the dcbf instruction causing
it to fail when the field was equal to zero.  This patch removes the check
that was being incorrectly applied to all of the instructions.

The valgrind bugzilla for this issue is 348334.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3148

10 years agoBug #348247. Fix SUBQ 0, long long sub/cmp, then O (overflow) case.
Mark Wielaard [Wed, 27 May 2015 12:33:41 +0000 (12:33 +0000)] 
Bug #348247. Fix SUBQ 0, long long sub/cmp, then O (overflow) case.

Fix 64bit right shift, should have been 63 bit. This caused some bad
jno jumps detecting overflow where there was none.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3147

10 years agoCleanups to allow compilation with -Wold-style-declaration.
Florian Krohm [Sat, 16 May 2015 16:16:37 +0000 (16:16 +0000)] 
Cleanups to allow compilation with -Wold-style-declaration.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3146

10 years agoImprove the error messages for the PPC platform to be more clear when Valgrind detec...
Carl Love [Wed, 29 Apr 2015 20:37:29 +0000 (20:37 +0000)] 
Improve the  error messages for the PPC platform to be more clear when Valgrind detects that
the underlying hardware doesn't have the needed capability.  A number of the checks for DFP
support were going to "decode_failure" instead of "decode_noDFP". These issues are also fixed.

The commit is for Bugzilla 338095

git-svn-id: svn://svn.valgrind.org/vex/trunk@3145

10 years agoRemove VexGuestTILEGXStateAlignment as the guest state size of any architecture
Florian Krohm [Mon, 27 Apr 2015 14:24:48 +0000 (14:24 +0000)] 
Remove VexGuestTILEGXStateAlignment as the guest state size of any architecture
must satisfy the LibVEX_GUEST_STATE_ALIGN requirement. So use that instead.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3144

10 years agoAdd support for the TEXASRU register. This register contains information on
Carl Love [Wed, 22 Apr 2015 16:15:41 +0000 (16:15 +0000)] 
Add support for the TEXASRU register.  This register contains information on
transactional memory instruction summary information.  This register contains
the upper 32-bits of the transaction information.  Note, the valgrind
implementation of transactional memory instructions is limited.  Currently, the
contents of the TEXASRU register will always return 0.  The lower 64-bits of
the trasnaction information in the TEXASR register will contain the failure
information as setup by Valgrind.

This commit contains the changes needed to support the TEXASRU register on
PPC64.

This support requires changing the value of MAX_REG_WRITE_SIZE in
memcheck/mc_main.c from 1696 to 1712.  The change is made in the corresponding
valgrind commit.

This patch addresses Bugzilla 346474

git-svn-id: svn://svn.valgrind.org/vex/trunk@3143

10 years agoAdd spec rules for EQ, MI, PL, GT and LE after COPY. These result
Julian Seward [Tue, 21 Apr 2015 14:51:02 +0000 (14:51 +0000)] 
Add spec rules for EQ, MI, PL, GT and LE after COPY.  These result
from floating point comparisons.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3139

10 years agoFix for an error in the stq, stqcx, lqarx and lq instructions with LE.
Carl Love [Mon, 20 Apr 2015 23:34:33 +0000 (23:34 +0000)] 
Fix for an error in the stq, stqcx, lqarx and lq instructions with LE.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3138

10 years agoAdd support for the lbarx, lharx, stbcx and sthcs instructions.
Carl Love [Fri, 17 Apr 2015 23:42:40 +0000 (23:42 +0000)] 
Add support for the lbarx, lharx, stbcx and sthcs instructions.

The instructions are part of the ISA 2.06 but were not implemented
in all versions of hardware.  The four instructions are all supported
in ISA 2.07.  The instructions were put under the ISA 2.07 category
of supported instructions in this patch.

The bugzilla for this issue is 346324.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3137

10 years agoThe vbpermq for Powerpc64 big endian has the same issue as the little
Carl Love [Thu, 16 Apr 2015 23:17:22 +0000 (23:17 +0000)] 
The vbpermq for Powerpc64 big endian has the same issue as the little
endian support.  Bugzilla 346270 was reopened to include the BE issue.

The bugzilla for the issue is 346270.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3136

10 years agoThe following regression tests failures occur on PPC64 little endian only.
Carl Love [Thu, 16 Apr 2015 17:09:09 +0000 (17:09 +0000)] 
The following regression tests failures occur on PPC64 little endian only.

The regression test none/tests/jm_vec/isa_2_07 has failures on the lxsiwax and
lxsiwzx instructions. They are loads and the the results are correct for
big endian but not little endian. The little endian result matches the
expected big endian result.

The regresssion test none/tests/test_isa_2_07_part2 has a failure with the
vbpermq instruction. The little endian result matches the expected result for
big endian. The upper and lower 64 bits of the result are not swapped correctly
for little endian.

This commit fixes these issues.

The bugzilla for the issue is 346270.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3134

10 years agoAdd Iop_Add8, Iop_Add16 and other 8 or 16 bit ALU Iop
Zhi-Gang Liu [Wed, 15 Apr 2015 03:11:38 +0000 (03:11 +0000)] 
Add Iop_Add8, Iop_Add16 and other 8 or 16 bit ALU Iop
in the host_tilegx_isel.c

They were removed during the code review. But without
them, the memcheck's vbit-test failed. So, simply add
them back.

-This line, and those below, will be ignored--

M    host_tilegx_isel.c

git-svn-id: svn://svn.valgrind.org/vex/trunk@3133

10 years agoRemoved "extern"
Zhi-Gang Liu [Wed, 15 Apr 2015 02:16:37 +0000 (02:16 +0000)] 
Removed "extern"

Delete extern in front of function TILEGXInstr *TILEGXInstr_Acas(.)
in host_tilegx_defs.c.

By: Zhi-Gang Liu

git-svn-id: svn://svn.valgrind.org/vex/trunk@3132

10 years agoRemoved #if __tilegx__ ... #endif in guest_tilegx_toIR.c
Zhi-Gang Liu [Wed, 15 Apr 2015 02:05:01 +0000 (02:05 +0000)] 
Removed #if __tilegx__  ... #endif in guest_tilegx_toIR.c

Also eliminated several gcc warning message for this file.

By: Zhi-Gang Liu
zhg.liu@gmail.com

git-svn-id: svn://svn.valgrind.org/vex/trunk@3131

10 years agoFix the evCheck assertion for TileGX
Zhi-Gang Liu [Wed, 15 Apr 2015 01:15:31 +0000 (01:15 +0000)] 
Fix the evCheck assertion for TileGX

Quote from Philippe's original email.
"When guest = amd64 and host = TILEGX, the
libvexmultiarch_test asserts in TILEGX code:
vex: priv/host_tilegx_defs.c:2361 (emit_TILEGXInstr):
Assertion `evCheckSzB_TILEGX() ==
(UChar*)p - (UChar*)p0' failed."

This patch make sure that evCheck always emits
exact 80 bytes instruction stream.

By: Zhi-Gang Liu
zhg.liu@gmail.com

git-svn-id: svn://svn.valgrind.org/vex/trunk@3130

10 years agoRemove unused function "lshift".
Julian Seward [Mon, 13 Apr 2015 11:33:29 +0000 (11:33 +0000)] 
Remove unused function "lshift".

git-svn-id: svn://svn.valgrind.org/vex/trunk@3128

10 years agoVEX side for revision 15084 (multi arch testing)
Philippe Waroquiers [Sat, 11 Apr 2015 14:32:53 +0000 (14:32 +0000)] 
VEX side for revision 15084 (multi arch testing)

git-svn-id: svn://svn.valgrind.org/vex/trunk@3125

10 years agoAdd a port to Linux/TileGx. Zhi-Gang Liu (zliu@tilera.com)
Julian Seward [Fri, 10 Apr 2015 12:27:40 +0000 (12:27 +0000)] 
Add a port to Linux/TileGx.  Zhi-Gang Liu (zliu@tilera.com)
VEX aspects.

See bug 339778 - Linux/TileGx platform support to Valgrind

git-svn-id: svn://svn.valgrind.org/vex/trunk@3124

10 years agoFix a typo in the example given in the comment
Philippe Waroquiers [Thu, 9 Apr 2015 22:13:29 +0000 (22:13 +0000)] 
Fix a typo in the example given in the comment

git-svn-id: svn://svn.valgrind.org/vex/trunk@3123

10 years agox86 front and back ends: track vex r3120, which changed the type of
Julian Seward [Tue, 7 Apr 2015 09:36:35 +0000 (09:36 +0000)] 
x86 front and back ends: track vex r3120, which changed the type of
Iop_Sqrt64Fx2 and Iop_Sqrt32Fx4.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3122

10 years agoamd64 front and back ends: track the change of type of Iop_Sqrt32Fx4
Julian Seward [Tue, 7 Apr 2015 09:07:51 +0000 (09:07 +0000)] 
amd64 front and back ends: track the change of type of Iop_Sqrt32Fx4
and Iop_Sqrt64Fx2 as introduced in r3120, in which they acquired a
rounding-mode argument.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3121

10 years agoarm64: implement FSQRT 2d_2d, 4s_4s, 2s_2s
Julian Seward [Mon, 6 Apr 2015 19:34:03 +0000 (19:34 +0000)] 
arm64: implement FSQRT 2d_2d, 4s_4s, 2s_2s
AFAICS this completes the AArch64 SIMD implementation, except for the
crypto instructions.

This changes the type of Iop_Sqrt64x2 and Iop_Sqrt32x4 so as to take a
rounding mode argument.  This will (temporarily, of course) break all
of the other targets that implement vector fsqrt.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3120

10 years agoarm64: add support for the following insns. This completes support
Julian Seward [Mon, 6 Apr 2015 14:49:05 +0000 (14:49 +0000)] 
arm64: add support for the following insns.  This completes support
for conversion instructions.

SCVTF d_d_imm, s_s_imm
UCVTF d_d_imm, s_s_imm
FCVTZS d_d_imm, s_s_imm
FCVTZU d_d_imm, s_s_imm
FCVTXN s_d
SCVTF d_d, s_s
UCVTF d_d, s_s
SCVTF {2d_2d,4s_4s,2s_2s}_imm
UCVTF {2d_2d,4s_4s,2s_2s}_imm
FCVTZS {2d_2d,4s_4s,2s_2s}_imm
FCVTZU {2d_2d,4s_4s,2s_2s}_imm
FCVTXN 2s/4s_2d
FCVTZ{S,U} {w,x}_{s,x}_#fbits

git-svn-id: svn://svn.valgrind.org/vex/trunk@3119

10 years agoTweak STATIC_ASSERT such that there is no warning about an unused
Florian Krohm [Sat, 4 Apr 2015 18:43:11 +0000 (18:43 +0000)] 
Tweak STATIC_ASSERT such that there is no warning about an unused
variable when used at block scope.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3118

10 years agoAdd the standard end of the file marker used elsewhere
Philippe Waroquiers [Wed, 1 Apr 2015 20:18:26 +0000 (20:18 +0000)] 
Add the standard end of the file marker used elsewhere

git-svn-id: svn://svn.valgrind.org/vex/trunk@3116

10 years agoImprove comments, add the copyright notice
Philippe Waroquiers [Wed, 1 Apr 2015 20:05:50 +0000 (20:05 +0000)] 
Improve comments, add the copyright notice

git-svn-id: svn://svn.valgrind.org/vex/trunk@3115

10 years agoThis patch reduces the size of all tools by about 2MB of text
Philippe Waroquiers [Tue, 31 Mar 2015 23:01:57 +0000 (23:01 +0000)] 
This patch reduces the size of all tools by about 2MB of text
(depending on the arch).

This has as advantages:
1. somewhat faster build/link time (very probably neglectible)
2. somewhat faster tool startup (probably neglectible for most users,
   but regression tests are helped by this)
3. a gain in memory of about 10MB

The valgrind tools are making the assumption that host and guest
are the same. So, no need to drag the full set of archs when
linking a tool.
The VEX library is nicely split in arch independent and arch dependent
objects. Only main_main.c is dragging the various arch specific files.
So, main_main.c (the main entry point of the VEX library) is compiled
only for the current guest/host arch.

The disadvantage of the above is that the VEX lib cannot be used
anymore with host and guest different, while VEX is able to do that
(i.e. does not make the assumption that host and guest are the same).

So, to still allow a VEX user to use the VEX lib in a multi arch setup,
main_main.c is compiled twice:
1. in 'single arch mode', going in the libvex-<arch>-<os>
2. in 'multi arch mode', going in a new lib  libvexmultiarch-<arch>-<os>

A VEX user can choose at link time to link with the main_main
that is multi-arch, by linking with both libs (the multi arch being
the first one).

Here is a small (rubbish crashing) standalone usage of the VEX lib,
first linked in single arch, then linked in multi-arch:

  // file t1.c
  #include <stdio.h>
  #include <libvex.h>
  void main()
  {
     (void)LibVEX_Translate(NULL);
  }

  $ gcc -I Inst/include/valgrind -c -g t1.c
  $ gcc -o t1 t1.o -LInst/lib/valgrind  -lvex-x86-linux -lgcc
  $ gcc -o t1multi t1.o -LInst/lib/valgrind  -lvexmultiarch-x86-linux -lvex-x86-linux -lgcc
  $ size t1 t1multi
     text    data     bss     dec     hex filename
   519393     556 5012188 5532137  5469e9 t1
  2295717    1740 5015144 7312601  6f94d9 t1multi

In a next commit, some regtests will be added to validate that the two libs
are working properly (and that no arch specific symbol is missing when
linking multi-arch)

git-svn-id: svn://svn.valgrind.org/vex/trunk@3113

10 years agoarm64: add support for
Julian Seward [Mon, 30 Mar 2015 18:49:38 +0000 (18:49 +0000)] 
arm64: add support for
FCVT{N,M,A,P,Z}{S,U} 2d_2d, 4s_4s, 2s_2s

git-svn-id: svn://svn.valgrind.org/vex/trunk@3112

10 years agoarm64: add support for
Julian Seward [Mon, 30 Mar 2015 09:01:51 +0000 (09:01 +0000)] 
arm64: add support for
FCVT{N,M,A,P,Z}{S,U} d_d, s_s
FCVTN 4h/8h_4s, 2s/4s_2d
FCVTL 4s_4h/8h, 2d_2s/4s
FCVT Sd, Hn
FCVT Dd, Hn
FCVT Hd, Sn
FCVT Hd, Dn

git-svn-id: svn://svn.valgrind.org/vex/trunk@3111

10 years agoAdd IR level support for 16 bit floating point types (Ity_F16) and add
Julian Seward [Mon, 30 Mar 2015 08:50:27 +0000 (08:50 +0000)] 
Add IR level support for 16 bit floating point types (Ity_F16) and add
four new IROps that use it:
Iop_F16toF64, Iop_F64toF16, Iop_F16toF32, Iop_F32toF16.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3110

10 years agoAdd STATIC_ASSERT. Remove VG__STRING.
Florian Krohm [Sat, 28 Mar 2015 18:48:20 +0000 (18:48 +0000)] 
Add STATIC_ASSERT. Remove VG__STRING.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3109

10 years agomips64: extract correct immediate value for Cavium SEQI and SNEI
Petar Jovanovic [Sat, 28 Mar 2015 01:20:02 +0000 (01:20 +0000)] 
mips64: extract correct immediate value for Cavium SEQI and SNEI

Extract immediate value from bit fields [15:6] instead of [15:0].
This fixes the issue reported in BZ #341997.

Related Valgrind commit - r15043.

Patch by Maran Pakkirisamy.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3108

10 years agoBug 345215 - Performance improvements for the register allocator
Julian Seward [Thu, 26 Mar 2015 07:18:32 +0000 (07:18 +0000)] 
Bug 345215 - Performance improvements for the register allocator

The basic idea is to change the representation of registers (HReg) so
as to give Real registers a unique integer index starting from 0, with
the registers available for allocation numbered consectively from zero
upwards. This allows the register allocator to index into its primary
data structure -- a table tracking the status of each available
register -- using normal array index instead of having to search
sequentially through the table, as now.

It also allows an efficient bitmap-based representation for "set of
Real registers", which is important for the NCODE work.

There are various other perf improvements, most notably in calling
getRegUsage once rather than twice per instruction.

Cost of register allocation is reduced to around 65% ish of what it
previously was. This translates in to speedups close to zero for
compute intensive code up to around 7% for JITing intensive
situations, eg "time perl tests/vg_regtest memcheck/tests/amd64".

git-svn-id: svn://svn.valgrind.org/vex/trunk@3107

10 years agoMinor updates to deal with mips32 and mips64.
Julian Seward [Thu, 26 Mar 2015 07:14:01 +0000 (07:14 +0000)] 
Minor updates to deal with mips32 and mips64.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3106

10 years agoAdd source dependencies, and improve the 'clean' target.
Julian Seward [Thu, 26 Mar 2015 07:12:27 +0000 (07:12 +0000)] 
Add source dependencies, and improve the 'clean' target.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3105

10 years agoAdd z13 (s390).
Florian Krohm [Tue, 17 Mar 2015 13:44:14 +0000 (13:44 +0000)] 
Add z13 (s390).

git-svn-id: svn://svn.valgrind.org/vex/trunk@3104

10 years agor2974 moved the inline definition of LibVEX_Alloc from libvex.h
Florian Krohm [Fri, 13 Mar 2015 12:46:49 +0000 (12:46 +0000)] 
r2974 moved the inline definition of LibVEX_Alloc from libvex.h
to main_util.c because it caused linker problems with ICC.
See comments in BZ #339542.
This change re-enables inlining of that function by adding it
(renamed as LibVEX_Alloc_inline) to main_util.h.
500+ callsites changed accordingly.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3103

10 years agoFix build problems. The code has been bitrotting for some time.
Florian Krohm [Thu, 12 Mar 2015 11:01:12 +0000 (11:01 +0000)] 
Fix build problems. The code has been bitrotting for some time.
Note, that while the file compiles and links, not all IROps are handled.
So there may be runtime problems.
Fixes BZ #345079. Patch by Ivo Raisr (ivosh@ivosh.net).

git-svn-id: svn://svn.valgrind.org/vex/trunk@3102

10 years agoFix two undefined behaviours found by ubsan.
Florian Krohm [Thu, 12 Mar 2015 10:21:29 +0000 (10:21 +0000)] 
Fix two undefined behaviours found by ubsan.
Signed integer overflow in multiplication.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3101

10 years agoFix for bugzilla 343597 - ppc64le: incorrect use of offseof macro
Carl Love [Tue, 10 Mar 2015 18:51:36 +0000 (18:51 +0000)] 
Fix for bugzilla  343597 - ppc64le: incorrect use of offseof macro

Issue found by Florian Krohm who also suggested the fix.  The fix was
made and tested by Carl Love.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3100

10 years agoFix a few undefined behaviours that were found by compiling valgrind
Florian Krohm [Tue, 10 Mar 2015 16:11:58 +0000 (16:11 +0000)] 
Fix a few undefined behaviours that were found by compiling valgrind
with GCC 4.9.2 using -fsanitize=undefined and running the testsuite.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3099

10 years agoFix problems due to generating Neon instructions on non-Neon capable
Julian Seward [Wed, 4 Mar 2015 12:35:54 +0000 (12:35 +0000)] 
Fix problems due to generating Neon instructions on non-Neon capable
hosts:

* iselNeon64Expr, iselNeonExpr: assert that the host is actually
  Neon-capable.

* iselIntExpr_R_wrk, existing cases for Iop_GetElem8x8,
  Iop_GetElem16x4, Iop_GetElem32x2, Iop_GetElem8x16, Iop_GetElem16x8,
  Iop_GetElem32x4:
  Limit these to cases where the host is Neon capable, else we wind up
  generating code which can't run on the host.

* iselIntExpr_R_wrk: add alternative implementation for
  Iop_GetElem32x2 for non-Neon capable hosts.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3098

10 years agoAdd machinery to try and transform A ^ ((A ^ B) & M)
Julian Seward [Fri, 27 Feb 2015 13:33:56 +0000 (13:33 +0000)] 
Add machinery to try and transform A ^ ((A ^ B) & M)
into (A ^ ~M) | (B & M).

The former is MSVC's optimised idiom for bitfield assignment, the
latter is GCC's idiom.  The former causes Memcheck problems because it
doesn't understand that (in this complex case) XORing an undefined
value with itself produces a defined result.

Believed to be working but currently disabled.  To re-enable, change
if (0) to if (1) at line 6651.  Fixes, to some extent, and when
enabled, bug 344382.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3097

10 years agoEnhance the CSE pass so it can common up loads from memory. Disabled
Julian Seward [Fri, 27 Feb 2015 13:22:48 +0000 (13:22 +0000)] 
Enhance the CSE pass so it can common up loads from memory.  Disabled
by default since this is a somewhat dodgy proposition in the presence
of spinloops and racy accesses.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3096

10 years agoTidy up of CSE. Create functions irExpr_to_TmpOrConst,
Julian Seward [Fri, 27 Feb 2015 13:06:43 +0000 (13:06 +0000)] 
Tidy up of CSE.  Create functions irExpr_to_TmpOrConst,
tmpOrConst_to_IRExpr and subst_AvailExpr_TmpOrConst and use them
instead of in-line code.  No functional change.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3095

10 years agofold_Expr: add rules
Julian Seward [Fri, 27 Feb 2015 12:51:22 +0000 (12:51 +0000)] 
fold_Expr: add rules
   Xor8/16/32/64(0,t) ==> t
   Xor8/16/32/64(t,0) ==> t

git-svn-id: svn://svn.valgrind.org/vex/trunk@3094

10 years agoarm64: enable all remaining cases in the
Julian Seward [Tue, 24 Feb 2015 13:23:38 +0000 (13:23 +0000)] 
arm64: enable all remaining cases in the
FCVT{N,P,M,Z,A}{S,U} (scalar, integer) group

git-svn-id: svn://svn.valgrind.org/vex/trunk@3093

10 years agoarm64: implement:
Julian Seward [Tue, 24 Feb 2015 12:21:01 +0000 (12:21 +0000)] 
arm64: implement:
FRECPS  d_d_d, s_s_s
FRSQRTS d_d_d, s_s_s
FRECPE  d_d, s_s
FRSQRTE d_d, s_s
FRECPX  d_d, s_s
FRECPS  2d_2d_2d, 4s_4s_4s, 2s_2s_2s
FRSQRTS 2d_2d_2d, 4s_4s_4s, 2s_2s_2s
FRECPE  2d_2d, 4s_4s, 2s_2s
FRSQRTE 2d_2d, 4s_4s, 2s_2s

git-svn-id: svn://svn.valgrind.org/vex/trunk@3092

10 years agoAdd symbolic constant LibVEX_GUEST_STATE_ALIGN.
Florian Krohm [Fri, 13 Feb 2015 16:25:41 +0000 (16:25 +0000)] 
Add symbolic constant LibVEX_GUEST_STATE_ALIGN.
Use it.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3091