]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
8 years agoImplement arm32 v8 insns: LDAEX{,B,H,D}, STLEX{,B,H,D}
Julian Seward [Thu, 1 Sep 2016 13:08:10 +0000 (13:08 +0000)] 
Implement arm32 v8 insns: LDAEX{,B,H,D}, STLEX{,B,H,D}
(load-acquire exclusive, store-release exclusive)

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

8 years agoImplement ARMv8 insns: LDA, LDAB, LDAH, STL, STLB, STLH.
Julian Seward [Sun, 28 Aug 2016 16:16:27 +0000 (16:16 +0000)] 
Implement ARMv8 insns: LDA, LDAB, LDAH, STL, STLB, STLH.

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

8 years agoAdd a dummy initialisation and a dummy path to avoid warnings with gcc -Og.
Julian Seward [Fri, 19 Aug 2016 11:47:59 +0000 (11:47 +0000)] 
Add a dummy initialisation and a dummy path to avoid warnings with gcc -Og.
Neither are actually necessary, but gcc's flow analysis at -Og is weaker than
at -O or above and so it produces false warnings here.   No functional change.

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

8 years agoPower PC Add support for ISA 3.0, part 5, fix
Carl Love [Wed, 17 Aug 2016 00:28:33 +0000 (00:28 +0000)] 
Power PC Add support for ISA 3.0, part 5, fix

Fix for  the xscvdphp instruction added in vex commit 3244.

Bugzilla 364948

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

8 years agoPower PC Add support for ISA 3.0, part 5
Carl Love [Mon, 15 Aug 2016 21:53:20 +0000 (21:53 +0000)] 
Power PC Add support for ISA 3.0, part 5

Added support for the
cnttz, cnttz., cnttzd, cnttzd., vctzb, vctzh, vctzw,
vctzd, xscvhpdp, xscvdphp, xvcvhpsp, xvcvsphpv,
xsrqpi, xsrqpix, xsrqpxp, xsaddqp, xsaddqpo, xsmulqp,
xsmulqpo, xsmaddqp, xsmaddqpo, xsmsubqp, xsmsubqpo,
xsnmaddqp, xsnmaddqpo, xsnmsubqp, xsnmsubqpo, xssubqp,
xssubqpo, xsdivqp, xsdivqpo, xssqrtqp, xssqrtqpo,
xscvqpuwz, xscvudqp, xscvqpswz, xscvsdqp, xscvqpudz,
xscvqpdp, xscvqpdpo, xscvdpqp, xscvqpsdz, vmul10cuq,
vmul10ecuq, vmul10uq, vmul10euq, bcdctsq, bcdcfsq
instructions.

Most of these instructions required adding a new Iop as they could not
be emulated with existing Iops.  In some cases, some of the above instrctions
could be emulated using another instruction from the above list.

Most of the instructions add support for 128-bit instructions.  There are a
number of helper functions that check a values for zero, infinity, NaN, etc.
for various sizes.  The new 128-bit instructions require a new version of these
existing functions for a 128-bit operand.  Rather then adding another size
specific version of these functions, the existing size specific functions were
replaced with a single function that takes the size of operand to be operated
on.  There are some additional helper functions that are added to support
the size independent version of these functions.

Note this is the last of the 5 patches required to complete the ISA 3.0
support.

Bugzilla 364948

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

8 years agomips32: extend the current fp-mode code to support fpxx features
Petar Jovanovic [Wed, 10 Aug 2016 14:33:21 +0000 (14:33 +0000)] 
mips32: extend the current fp-mode code to support fpxx features

Part of the changes to support FPXX mode for MIPS32.

Patch by Aleksandar Rikalo <Aleksandar.Rikalo@imgtec.com>

Related issue BZ #366079.

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

8 years agoImplement VMULL.P64.
Julian Seward [Sun, 7 Aug 2016 23:33:48 +0000 (23:33 +0000)] 
Implement VMULL.P64.

dis_neon_data_3diff: don't mistakenly recognise VMULL.P64 as a plain
VMUL due to inadequate checking for the VMULL.P64 case.

Fix ARM decoding of SHA1SU1, SHA256SU0, SHA1H introduced in r3241.

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

8 years agoImplement SHA1C, SHA1M, SHA1P, SHA1SU0, SHA256H2, SHA256H, SHA256SU1,
Julian Seward [Sun, 7 Aug 2016 16:42:37 +0000 (16:42 +0000)] 
Implement SHA1C, SHA1M, SHA1P, SHA1SU0, SHA256H2, SHA256H, SHA256SU1,
SHA1H, SHA1SU1, SHA256SU0.

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

9 years agoFix UBSAN reported complaints about left shifts of signed values
Julian Seward [Sat, 6 Aug 2016 13:04:32 +0000 (13:04 +0000)] 
Fix UBSAN reported complaints about left shifts of signed values
in the arm32 front and back ends.

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

9 years agoReduce the number of IR sanity checks from 4 per block to 2 per block.
Julian Seward [Fri, 5 Aug 2016 15:02:48 +0000 (15:02 +0000)] 
Reduce the number of IR sanity checks from 4 per block to 2 per block.
Also relax assertion checking in the register allocator.

Together with valgrind r15927 this reduces per-block JITting cost by 10%-15%.

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

9 years agoFix two invalid signed left shifts picked up by ubsan.
Julian Seward [Fri, 5 Aug 2016 10:34:15 +0000 (10:34 +0000)] 
Fix two invalid signed left shifts picked up by ubsan.

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

9 years agoImplement CRC32{B,H,W,X} and CRC32C{B,H,W,X}. Fixes #366344.
Julian Seward [Thu, 4 Aug 2016 09:13:11 +0000 (09:13 +0000)] 
Implement CRC32{B,H,W,X} and CRC32C{B,H,W,X}.  Fixes #366344.

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

9 years ago* Add infrastructure for decoding (32-bit) ARMv8 instructions.
Julian Seward [Wed, 3 Aug 2016 11:55:33 +0000 (11:55 +0000)] 
* Add infrastructure for decoding (32-bit) ARMv8 instructions.

* Use this to implement AESE, AESD, AESMC, AESIMC.

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

9 years agoarm32 backend stuff needed to support IR artefacts resulting from
Julian Seward [Wed, 3 Aug 2016 11:53:11 +0000 (11:53 +0000)] 
arm32 backend stuff needed to support IR artefacts resulting from
guest support of 32-bit V8 crypto instructions:

* add new pseudo-instruction ARMin_VXferQ, to move values between
  two D regs and a Q reg, in either direction.  Use this to implement
  Iop_64HLtoV128 much more efficiently than before, and to implement
  Iop_V128HIto64 and Iop_V128to64.

* Generate code for helper calls in which have four or more
  (32-bit) word-sized arguments and a V128 return value.
  These require passing arguments on the stack.

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

9 years agoAdd infrastructure for detection of 32-bit ARMv8 capable CPUs (VEX side).
Julian Seward [Wed, 3 Aug 2016 11:41:24 +0000 (11:41 +0000)] 
Add infrastructure for detection of 32-bit ARMv8 capable CPUs (VEX side).

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

9 years agodis_neon_data_3same: for the case A==12, don't silently produce invalid IR
Julian Seward [Thu, 28 Jul 2016 08:23:37 +0000 (08:23 +0000)] 
dis_neon_data_3same: for the case A==12, don't silently produce invalid IR
which then causes the sanity checker to abort the run.  Instead synthesise
a SIGILL in the normal way.

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

9 years agoImplement PMULL 1q,1d,1d and PMULL2 1q,2d,2d. n-i-bz.
Julian Seward [Sun, 24 Jul 2016 18:58:21 +0000 (18:58 +0000)] 
Implement PMULL 1q,1d,1d and PMULL2 1q,2d,2d.  n-i-bz.

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

9 years agoFix grammatically nonsensical comments. No functional change.
Julian Seward [Sun, 24 Jul 2016 16:56:22 +0000 (16:56 +0000)] 
Fix grammatically nonsensical comments.  No functional change.

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

9 years agoEnable PCMPxSTRx cases 0x62 and 0x72, and reformat the associated
Julian Seward [Sun, 24 Jul 2016 11:40:07 +0000 (11:40 +0000)] 
Enable PCMPxSTRx cases 0x62 and 0x72, and reformat the associated
switch statements a bit more consistently.  Fixes #353384 and #353727.

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

9 years agoIf an instruction can't be decoded, print the first 10 bytes at RSP
Julian Seward [Wed, 20 Jul 2016 17:01:55 +0000 (17:01 +0000)] 
If an instruction can't be decoded, print the first 10 bytes at RSP
rather than 8.  8 is not enough to disambiguate the instruction in
some situations, in particular where there is a control immediate byte
at the end of the instruction.

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

9 years agoEnable PCMPxSTRx cases 0x70 and 0x19. Fixes #359952.
Julian Seward [Wed, 20 Jul 2016 16:35:55 +0000 (16:35 +0000)] 
Enable PCMPxSTRx cases 0x70 and 0x19.  Fixes #359952.

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

9 years agoImplement CLREX. Fixes #359838.
Julian Seward [Tue, 19 Jul 2016 07:05:34 +0000 (07:05 +0000)] 
Implement CLREX.  Fixes #359838.

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

9 years agodis_pc_relative, case 0x002: remove a path that cannot be taken. That
Julian Seward [Tue, 19 Jul 2016 05:32:50 +0000 (05:32 +0000)] 
dis_pc_relative, case 0x002: remove a path that cannot be taken.  That
stops gcc -Og complaining.  It complains because at that relatively
low level of optimisation, its flow analysis is apparently too weak to
see that the removed path cannot be taken and so it complains
(wrongly) about a possibly uninitialised use of |result|.  No
functional change.

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

9 years agoImplement: SHA1C SHA1H SHA1M SHA1P SHA1SU0 SHA1SU1 SHA256H2 SHA256H
Julian Seward [Mon, 18 Jul 2016 06:33:52 +0000 (06:33 +0000)] 
Implement: SHA1C SHA1H SHA1M SHA1P SHA1SU0 SHA1SU1 SHA256H2 SHA256H
SHA256SU0 SHA256SU1.  Fixes #357338.

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

9 years agoImplement arm64 instructions: AESE AESD AESMC AESIMC. n-i-bz.
Julian Seward [Fri, 15 Jul 2016 10:31:34 +0000 (10:31 +0000)] 
Implement arm64 instructions: AESE AESD AESMC AESIMC.  n-i-bz.

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

9 years agoFix n-i-bz amd64: memcheck false positive with shr %edx
Philippe Waroquiers [Tue, 12 Jul 2016 20:49:05 +0000 (20:49 +0000)] 
Fix n-i-bz amd64: memcheck false positive with shr %edx

False positive analysis and fix by Julian.

Thanks

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

9 years agoPower PC Add support for ISA 3.0, part 4
Carl Love [Wed, 29 Jun 2016 18:06:15 +0000 (18:06 +0000)] 
Power PC Add support for ISA 3.0, part 4

Added support to emulate the setb, cmprb, cmpeqb, dtstsfi,
dtstsfiq, dtstsfq, dtstsfiq, xscmpexpdp, xsxexpd, xsxsigdp,
xststdcsp, xststdcdp, xvtstdcsp, xvxsigdp, xsiexpdp, xvxexpdp,
xvxsigdp, xvxexpsp, xvxsigsp, xvtstdcdp, xvxsigdp, wait, addpcis
instructions.

bugzilla 363858

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

9 years agoFix mtfsfi usage of W bit. (isa2.05,ppc64)
Carl Love [Mon, 13 Jun 2016 17:27:03 +0000 (17:27 +0000)] 
Fix mtfsfi usage of W bit. (isa2.05,ppc64)

Fix mtfsfi usage of W bit.
The Wbit field was added in ISA 2.05, allowing updates to the 'other'
half of the 64-bit FPSCR field.
Logic and Support for that bit is in place, but a 'reserved field
must contain zeros' check was not updated, preventing the desired
path from being taken.

Bugzilla 362894

Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
Patch reviewed and verified by: Carl Love <cel@ibm.com>

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

9 years agoPower PC Add support for ISA 3.0, part 3
Carl Love [Wed, 1 Jun 2016 18:12:31 +0000 (18:12 +0000)] 
Power PC Add support for ISA 3.0, part 3

Added support to emulate lxsd, lxssp, lxv, stxsd, stxssp, and stxv
xscpsgnqp, xscmpoqp, xscmpuqp, xscmpexpqp, xststdcqp, xsabsqp,
xsxexpqp, xsnabsqp, xsnegqp, xsxsigqp, xsiexpqp, xsxexpdp, xsxsigdp,
xscmpexpdp, xststdcdp, xsiexpdp, xsxtdcsp, xvxexpdp, xvxexpsp,
xvxsigdp, xvxsigsp, xviexpsp, xviexpdp, xvtstdcsp, xvtstdcdp
instructions.

valgrind bugzilla 362329

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

9 years agomips: allow building code with -mfpxx
Petar Jovanovic [Sat, 21 May 2016 00:05:34 +0000 (00:05 +0000)] 
mips: allow building code with -mfpxx

Some recent GCC-based toolchains and Debian as a distribution enable the
flag -mpfxx by default. -mfpxx implies -mno-odd-spreg, so use of odd-
numbered single-precision floating-point registers has to be avoided in
Valgrind inline assembly in that case.

Patch by James Cowgill.

It fixes BZ #348924.

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

9 years agoPower PC Fix V bit error in 128-bit BCD add and subtract instructions
Carl Love [Tue, 26 Apr 2016 19:52:56 +0000 (19:52 +0000)] 
Power PC  Fix V bit error in 128-bit BCD add and subtract instructions

The original code was using the bcdadd / bcdsub instruction on the operand
shadow bits to calculate the shadow bits for the result.  This introduced
non-zero bits shadow bits in the result.   The shadow bits for these
instructions should be set to all valid or all invalid.  If one of the
argument shadow bits was one, then all of the shadow bits of the result should
be one.  Otherwise the result shadow bits should be zero.

This patch fixes the above bug in memcheck/mc_translate.c

Fixing the above bug broke the v-bit test.  The issue is the v-bit tester
assumes the shadow bits for the operands of a given Iop can be set to one
for testing purposes.  The implementation of the bcdadd and bcdsub was passing
a constant value for the variable ps.  The ps value is an argument to the
instruction that specifies how to set the sign code of the result.  The
implementation of the instructions was changed to issue the instruction with
ps=0.  Then the result of the instruction is updated in the VEX code if ps=1.
This changed also results in cleaning up the vbit test code.

This patch also fixes the issues with the v-bit test program.

Bugzilla 360035

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

9 years agoPower PC Add support for ISA 3.0, part 2
Carl Love [Tue, 26 Apr 2016 17:31:47 +0000 (17:31 +0000)] 
Power PC Add support for ISA 3.0, part 2

Added support to emulate the lxvl, stxvl,  vcmpneb, vcmpnezb,
vcmpneh, vcmpnezh, vcmpnew, vcmpnezw, vctzlsbb, vclzlsbb,
vextublx, vextuhlx, vextuhrx, vextuhlx, vextuwrx, vextuwlx,
vextsb2w, vextsh2w, vextsb2d, vextsh2d, vextsw2d, vnegw,
vnegd, vrlwnm, vrlwmi, vrldnm, vrldmi, vprtybw, vprtybd,
vprtybq, vbpermd, lxsibzx, lxsihzx, stxsibx, stxsihx instructions.

valgrind bugzilla 359767

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

9 years agoBug 361226 VEX part: s390x: risbgn (EC59) not implemented
Christian Borntraeger [Thu, 7 Apr 2016 18:54:53 +0000 (18:54 +0000)] 
Bug 361226 VEX part:  s390x: risbgn (EC59) not implemented

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

9 years agoPower PC Add test suite support for ISA 3.0, part 1, fixes
Carl Love [Wed, 30 Mar 2016 20:07:03 +0000 (20:07 +0000)] 
Power PC Add test suite support for ISA 3.0, part 1, fixes

This commit fixes a couple of compiler warnings found by the nightly
regression tests.  This is a fix to VEX commit 3214.

valgrind bugzilla 359767

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

9 years agoPower PC Add support for ISA 3.0, part 1
Carl Love [Tue, 29 Mar 2016 21:27:20 +0000 (21:27 +0000)] 
Power PC Add support for ISA 3.0, part 1

The Floating-point condition code bits FPCC is bits[15:12] of the FPSCR.
The instructions fcmpu, fcmpo, dcmpu, dcmpq, dtstdc, dtstdcq, xscmpodq
and xscmpudq set the FPCC bits in addition to the BE field of the CC
register.  This support is needed by the ISA 3.0 instructions to be added.

Added support to emulate the modsw, moduw, modsd, modud, extswsli,
maddld, maddhd, maaddhdu, xxperm, xxpermr, vabsdub, vabsduh, vabsduw,
mtvsrws, xxextractuw, xxinsertw, xxspltib, xxbrh, xxbrw, xxbrd, xxbrq,
vpermr, vextractub, vextractuh, vextractuw, vextractd, vinsertb, vinserth,
vinsertw, vinsertd, lxvwsx, stxvb16x, stxvx, lxvb16x, lxvh8x, lxvx
instructions.

valgrind bugzilla 359767

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

9 years agoMake isZeroU handle the V256 case. Fixes #356393.
Julian Seward [Mon, 21 Mar 2016 19:29:20 +0000 (19:29 +0000)] 
Make isZeroU handle the V256 case.  Fixes #356393.

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

9 years agoarm64: implement LDPSW. Fixes #360425. Initial patch+investigation by Mark Wielaard.
Julian Seward [Tue, 15 Mar 2016 14:24:56 +0000 (14:24 +0000)] 
arm64: implement LDPSW.  Fixes #360425.  Initial patch+investigation by Mark Wielaard.

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

9 years agomips: allow execution of mfhc1 and mthc1 for fp32 mode
Petar Jovanovic [Mon, 22 Feb 2016 16:16:59 +0000 (16:16 +0000)] 
mips: allow execution of mfhc1 and mthc1 for fp32 mode

MTHC1 and MFHC1 should be allowed for any MIPS32R2 compatible core, not only
for cores with FPU unit in fp64 mode.

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

9 years agos390: Implement popcnt insn. Part of fixing BZ #359289.
Florian Krohm [Wed, 17 Feb 2016 19:57:01 +0000 (19:57 +0000)] 
s390: Implement popcnt insn. Part of fixing BZ #359289.
Patch by Andreas Arnez (arnez@linux.vnet.ibm.com)

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

9 years ago128bit modulo and carry instruction fix
Carl Love [Tue, 16 Feb 2016 21:20:24 +0000 (21:20 +0000)] 
128bit modulo and carry instruction fix

This patch fixes an issue with caculating the carry to the next 32-bit
chunk for the 128-bit add and subract instructions: vaddcuq, vadduqm,
vsubcuq, vsubuqm, vaddecuq, vaddeuqm, vsubecuq, vsubeuqm

Valgrind Bugzilla 359472

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

9 years agos390: Add machine model z13s
Florian Krohm [Tue, 16 Feb 2016 21:14:47 +0000 (21:14 +0000)] 
s390: Add machine model z13s

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

9 years agoHandle missing FCOM case on amd64.
Tom Hughes [Wed, 3 Feb 2016 10:14:18 +0000 (10:14 +0000)] 
Handle missing FCOM case on amd64.

Patch from Mark Harris on BZ#212352.

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

9 years agoHandle shift amounts 0..31. It is unclear why the shift amounts
Florian Krohm [Sun, 29 Nov 2015 15:20:43 +0000 (15:20 +0000)] 
Handle shift amounts 0..31.  It is unclear why the shift amounts
were initially restricted to 0..3.

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

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

9 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