]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
8 years agoThe mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
Carl Love [Mon, 13 Mar 2017 20:10:40 +0000 (20:10 +0000)] 
The mask64 value, in file VEX/priv/guest_ppc_toIR.c is missing the
HWCAPS bit for ISA3.0.

bugzilla 377478

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

8 years agomips: emulate LL/SC w/ guest_LLaddr and guest_LLdata
Petar Jovanovic [Mon, 13 Mar 2017 17:50:25 +0000 (17:50 +0000)] 
mips: emulate LL/SC w/ guest_LLaddr and guest_LLdata

Improve LL/SC emulation with introduction of LLaddr and LLdata in the
guest state. LLaddr gets invalidated when the threads switch.

More info at KDE #344524. This patch should fix the issue.

Currently, this is effective for Cavium boards only.

Patch by Maran Pakkirisamy.

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

8 years agoPowerPC: Fix incorrect register pair check for lxv, stxv, stxsd, stxssp, lxsd,
Carl Love [Fri, 10 Mar 2017 20:07:09 +0000 (20:07 +0000)] 
PowerPC:  Fix incorrect register pair check for lxv, stxv, stxsd, stxssp, lxsd,
lxssp instructions

The lfdpx, stdpx, lfdp and stfdp instructions work on a register pair.  The
register pair test must only be applied to these instructions in the
dis_fp_pair() function.

bugzilla 377427

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

8 years agoMinor refactoring for assignedOnce_Stmt().
Ivo Raisr [Wed, 1 Mar 2017 18:44:21 +0000 (18:44 +0000)] 
Minor refactoring for assignedOnce_Stmt().
No functional change.
n-i-bz

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

8 years agoFix incorrect variable type (IRTemp->IRType)
Ivo Raisr [Mon, 27 Feb 2017 10:16:50 +0000 (10:16 +0000)] 
Fix incorrect variable type (IRTemp->IRType)
n-i-bz

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

8 years agoPush some spec rules for amd64 that have been sitting around for a while:
Julian Seward [Tue, 21 Feb 2017 15:08:28 +0000 (15:08 +0000)] 
Push some spec rules for amd64 that have been sitting around for a while:

  amd64g_calculate_condition:
    S and NS after SUBW
    Z and NZ after SHRQ
    NZ after SHRL (Z after SHRL was already present)

  amd64g_calculate_rflags_c:
    C after ADDQ
    C after ADDL

At least the first 5 reduce the Memcheck noise level from running
optimised code compiled by Clang.

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

8 years agomips64: do correct 32-bit comparison for Iop_CmpNE32
Petar Jovanovic [Mon, 13 Feb 2017 16:15:24 +0000 (16:15 +0000)] 
mips64: do correct 32-bit comparison for Iop_CmpNE32

Make sure that we take into account 32-bit size of values in comparison
on MIPS64-platforms. This is done either by sign extending these values
before comparison or sign extending xored values (depending on what
comparison we do). This should avoid false-positives like the one
reported in BZ #341481.

Patch based on code provided by Crestez Dan Leonard and Tamara Vlahovic.

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

8 years agoAdd comment about HINT instructions.
Tom Hughes [Sat, 11 Feb 2017 10:46:57 +0000 (10:46 +0000)] 
Add comment about HINT instructions.

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

8 years agoHandle unknown HINT instructions on aarch64 by ignoring them. BZ#376279.
Tom Hughes [Sat, 11 Feb 2017 10:44:29 +0000 (10:44 +0000)] 
Handle unknown HINT instructions on aarch64 by ignoring them. BZ#376279.

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

8 years agoFix non-mips build breakage from VEX r3300
Tom Hughes [Sat, 11 Feb 2017 10:40:48 +0000 (10:40 +0000)] 
Fix non-mips build breakage from VEX r3300

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

8 years agomips: rewrite mips_irgen_load_and_add32|64 and code around it
Petar Jovanovic [Fri, 10 Feb 2017 17:58:40 +0000 (17:58 +0000)] 
mips: rewrite mips_irgen_load_and_add32|64 and code around it

Make sure that mips_irgen_load_and_add32 gets both expected value and
new value, so the function code makes more sense and does load/store in
a atomic way.

Minor renaming and code style issues added too.

Patch by Tamara Vlahovic.

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

8 years agox86: Recognize the SS segment prefix on x86. Bug 344139 comment 4.
Julian Seward [Fri, 20 Jan 2017 10:01:42 +0000 (10:01 +0000)] 
x86: Recognize the SS segment prefix on x86.  Bug 344139 comment 4.
Patch from Sebastian Lackner, sebastian@fds-team.de.

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

8 years agoSmall comment fix: point at the correct file name
Philippe Waroquiers [Fri, 20 Jan 2017 09:59:05 +0000 (09:59 +0000)] 
Small comment fix: point at the correct file name

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

8 years agoImplement:
Julian Seward [Wed, 18 Jan 2017 15:02:55 +0000 (15:02 +0000)] 
Implement:
  VCVT{A,N,P,M}{.F32 d_d, .F32 q_q}
  VRINT{A,N,P,M,X,Z}{.F32 d_d, .F32 q_q}

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

8 years agoImplement V{MAX,MIN}NM{.F32 d_d_d, .F32 q_q_q}.
Julian Seward [Mon, 16 Jan 2017 07:15:04 +0000 (07:15 +0000)] 
Implement V{MAX,MIN}NM{.F32 d_d_d, .F32 q_q_q}.

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

8 years agodis_neon_data_3same: don't silently accept invalid instructions. Instead,
Julian Seward [Mon, 16 Jan 2017 05:14:24 +0000 (05:14 +0000)] 
dis_neon_data_3same: don't silently accept invalid instructions.  Instead,
"return False" for any instruction not accepted by this function.  Also,
add a few switch default backstops.

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

8 years agoImplement VRINTX.F64.F64 d_d, VRINTX.F32.F32 s_s.
Julian Seward [Sun, 15 Jan 2017 18:25:18 +0000 (18:25 +0000)] 
Implement VRINTX.F64.F64 d_d, VRINTX.F32.F32 s_s.

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

8 years agoImplement
Julian Seward [Fri, 13 Jan 2017 17:58:57 +0000 (17:58 +0000)] 
Implement
  V{MIN,MAX}NM.F64 Dd, Dn, Dm
  V{MIN,MAX}NM.F32 Sd, Sn, Sm

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

8 years agoImplement:
Julian Seward [Fri, 13 Jan 2017 12:51:29 +0000 (12:51 +0000)] 
Implement:
  VRINT{Z,R}.F64.F64 d_d, VRINT{Z,R}.F32.F32 s_s
  VCVT{A,N,P,M}{.S32,.U32}{.F64,.F32}

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

8 years agoImplement VRINT{A,N,P,M}.F64 d_d, VRINT{A,N,P,M}.F32 s_s.
Julian Seward [Thu, 12 Jan 2017 14:37:58 +0000 (14:37 +0000)] 
Implement VRINT{A,N,P,M}.F64 d_d, VRINT{A,N,P,M}.F32 s_s.

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

8 years agoImplement ARMv8 VSEL<c>.F64 d_d_d, VSEL<c>.F32 s_s_s.
Julian Seward [Thu, 12 Jan 2017 11:21:08 +0000 (11:21 +0000)] 
Implement ARMv8 VSEL<c>.F64 d_d_d, VSEL<c>.F32 s_s_s.

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

8 years agoFix assertion failure in decode_V8_instruction. Fixes #372794.
Julian Seward [Tue, 10 Jan 2017 16:05:14 +0000 (16:05 +0000)] 
Fix assertion failure in decode_V8_instruction.  Fixes #372794.

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

8 years agoconst IRExpr arguments for matchIRExpr()
Ivo Raisr [Fri, 23 Dec 2016 12:38:57 +0000 (12:38 +0000)] 
const IRExpr arguments for matchIRExpr()
Fixes BZ#373938

Gist of the changes is really just:
- Bool matchIRExpr ( MatchInfo* mi, IRExpr* p, IRExpr* e );
+ Bool matchIRExpr ( MatchInfo* mi, const IRExpr* p, const IRExpr* e );

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

8 years agoRename BBPTR to GSPTR as it denotes guest state pointer only
Ivo Raisr [Fri, 16 Dec 2016 21:20:30 +0000 (21:20 +0000)] 
Rename BBPTR to GSPTR as it denotes guest state pointer only
Fixes BZ#373555.

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

8 years agomips: small changes in VexGuestMIPS{32|64}State structs
Petar Jovanovic [Wed, 7 Dec 2016 16:19:26 +0000 (16:19 +0000)] 
mips: small changes in VexGuestMIPS{32|64}State structs

Move host_EvC_FAILADDR and host_EvC_COUNTER fields to the top of the
structure, similar to other architectures.

This fixes

none/tests/libvexmultiarch_test          (stderr)

on some MIPS platforms, as it avoids internal X86/AMD code generator
asserts.

Minor stylish changes included too.

Patch by Aleksandra Karadzic.

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

8 years agoFix xxsel parsing error, update.
Carl Love [Mon, 7 Nov 2016 19:58:19 +0000 (19:58 +0000)] 
Fix xxsel parsing error, update.

Commit 3284 listed Bugzilla 148000 which is incorrect.

Tweeked comments so the file VEX/priv/guest_ppc_toIR.c can be committed again.

The correct bugzilla is 372185.

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

8 years agoFix xxsel parsing error.
Carl Love [Mon, 7 Nov 2016 19:41:30 +0000 (19:41 +0000)] 
Fix xxsel parsing error.

The xxsel instruction uses part of the standard opc2 field to specify
a additional operand or other values.  A subset of the field is used for
the actual opcode.  The masking and array lookup was getting confused by
bits in the the additional operand field.  The arrays were split so only
the opcodes that should be found for a given mask is in the array.  This
also speeds up the search as you are not searching through values that
cannot match.  The small groups of opcodes for a couple of the masks are
now done in a case statement as that is probably faster then doing an array
look up.

Bugzilla 148000

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

8 years agoAllow early writeback of SP base register in "strd rD, [sp, #-16]" so
Julian Seward [Wed, 19 Oct 2016 16:57:11 +0000 (16:57 +0000)] 
Allow early writeback of SP base register in "strd rD, [sp, #-16]" so
as to avoid Memcheck complaining about writes below SP.  Previously
this was allowed only for the #-8 case.  n-i-bz.

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

8 years agoCVTPI2PS: Only switch to MMX mode if the source is a MMX register.
Julian Seward [Wed, 19 Oct 2016 16:01:01 +0000 (16:01 +0000)] 
CVTPI2PS: Only switch to MMX mode if the source is a MMX register.
(for both x86 and amd64 front ends)
Fixes #357059.

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

8 years agoAccept redundant REX prefixes for {minsd,maxsd} m128, xmm. Fixes #357932.
Julian Seward [Wed, 19 Oct 2016 15:37:54 +0000 (15:37 +0000)] 
Accept redundant REX prefixes for {minsd,maxsd} m128, xmm.  Fixes #357932.
Patch from axel.carl.mueller@gmail.com.

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

8 years agoFix two cases of PPCAvFpOp vs PPCFpOp enum confusion, as spotted
Julian Seward [Wed, 19 Oct 2016 07:41:35 +0000 (07:41 +0000)] 
Fix two cases of PPCAvFpOp vs PPCFpOp enum confusion, as spotted
by Clang-3.8.

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

8 years agoFix incorrect register-number constraint check for LDAEX{,B,H,D}
Julian Seward [Wed, 19 Oct 2016 07:39:22 +0000 (07:39 +0000)] 
Fix incorrect register-number constraint check for LDAEX{,B,H,D}
introduced in r3248.  Spotted by Clang-3.8.

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

8 years ago Fix PPC BE in 32-bit mode.
Carl Love [Tue, 18 Oct 2016 15:52:09 +0000 (15:52 +0000)] 
 Fix PPC BE in 32-bit mode.

The 64-bit compares are not supported in 32-bit mode.  Change the 64-bit
compares to 32-bit compares when doing byte compares.  Add routine for
doing V128 GT compare using 32-bit compares.

The clean caller support was missing for 32-bit mode

Update the expected output file jm_vec_isa_2_07.stdout.exp

Bugzilla 371128

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

8 years agomips64: fix error introduced by r3262
Petar Jovanovic [Thu, 13 Oct 2016 13:53:50 +0000 (13:53 +0000)] 
mips64: fix error introduced by r3262

There was a typo in r3262 that caused a regression in the following two
tests:

none/tests/mips64/load_store_unaligned   (stdout)
none/tests/mips64/load_store_unaligned   (stderr)

This change fixes it.

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

8 years agomips: fix incorrect implementation of luxc1/suxc1 instructions
Petar Jovanovic [Wed, 12 Oct 2016 15:25:45 +0000 (15:25 +0000)] 
mips: fix incorrect implementation of luxc1/suxc1 instructions

Support correct execution of luxc1 and suxc1 instructions on MIPS32
and MIPS64 platforms with the respect for FPU mode.

Patch by Aleksandra Karadzic.

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

8 years agomips: allow VEX to be compiled for soft-float
Petar Jovanovic [Wed, 12 Oct 2016 15:02:10 +0000 (15:02 +0000)] 
mips: allow VEX to be compiled for soft-float

Force "hardfloat" mode for inline assembly that uses FPU instructions,
but pop original mode at the end of the assembly.

This should allow Valgrind to be compiled as a soft-float binary, but
that executable should be used for soft-float systems only.

Related issue - BZ#351282.

Patch by Aleksandar Rikalo.

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

8 years agoISA 3.0 BE fixes for various new instructions
Carl Love [Fri, 7 Oct 2016 22:53:52 +0000 (22:53 +0000)] 
ISA 3.0 BE fixes for various new instructions

This is an additional commit to fix issues found with the
new Power ISA 3.0 instructions for BE mode.  The instructions
fixed in this patch include: lxvl, lxvx, lxvwsx, lxvh8x, lxvh16x,
stxvx, stxvh8x, stxvh16x, lxsibzx, lxsihzx, xscvqpdp, xscvqpdp0,
xvcvsphp.

Bugzilla 369175

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

8 years agos390: support RISBLG/RISBHG, MVCIN, LDE/LDER
Christian Borntraeger [Fri, 7 Oct 2016 07:07:10 +0000 (07:07 +0000)] 
s390: support RISBLG/RISBHG, MVCIN, LDE/LDER

patch by Andreas Arnez

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

8 years agomips: remove support for mfc0/dmfc0
Petar Jovanovic [Thu, 6 Oct 2016 13:54:12 +0000 (13:54 +0000)] 
mips: remove support for mfc0/dmfc0

Remove support for mfc0/dmfc0, as these instructions are privileged
instructions and Valgrind cannot execute these.

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

8 years agoRelax the overly-restrictive implementation of
Julian Seward [Thu, 6 Oct 2016 05:25:58 +0000 (05:25 +0000)] 
Relax the overly-restrictive implementation of

  (T3) SUB{S}.W Rd, Rn, Rm, {shift}

in the case where Rn=SP, to allow |shift| values of 0,1,2,3
instead of just 0.  Fixes #354274.  Patch from dimitry@google.com.

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

8 years agomips64: support for fp32 mode
Petar Jovanovic [Tue, 4 Oct 2016 14:27:18 +0000 (14:27 +0000)] 
mips64: support for fp32 mode

Support for FP32 emulation on MIPS64 platforms
(including prctl(GET/SET_FP_MODE) syscalls).

Patch by Aleksandar Rikalo.

Implements the remaining parts for BZ #366079.

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

8 years agoFix rounding mode check and instruction stxvl
Carl Love [Mon, 3 Oct 2016 15:30:46 +0000 (15:30 +0000)] 
Fix rounding mode check and instruction stxvl

In BE mode, the function FPU_rounding_mode_isOdd() has the assert
  vassert(mode->Iex.Const.con->Ico.U8 == 0x8);
The value was set using mkU32 but in BE mode the U8 maps to the upper
bits in the memory location not the lower bits.  The comparison was
fixed by changing the .U8 to .U32 to be consistent with how the field
was set.

The stxvl instruction called the 64-bit NOT not the 128-bit NOT when
calculating the store_val.

The stxvx instruction the temp word values were initialized I32 not I64.
Not sure why this wasn't caught on LE.

bugzilla  369175

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

8 years agoFix for clean helpers on BE
Carl Love [Mon, 3 Oct 2016 15:27:31 +0000 (15:27 +0000)] 
Fix for clean helpers on BE

This patch adds the missing fnptr_to_fnentry() wrapper call for the
clean helpers introduced in the ISA 3.0 support.

bugzilla  369175

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

8 years agoImplement AMD FMA4 instructions. Bug #369000.
Mark Wielaard [Mon, 19 Sep 2016 12:41:19 +0000 (12:41 +0000)] 
Implement AMD FMA4 instructions. Bug #369000.

Original patch by p4plus2@gmail.com.

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

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