]> git.ipfire.org Git - thirdparty/valgrind.git/log
thirdparty/valgrind.git
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

10 years agoRemove an unused macro (which also had undefined behaviours).
Florian Krohm [Mon, 9 Feb 2015 23:21:07 +0000 (23:21 +0000)] 
Remove an unused macro (which also had undefined behaviours).

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

10 years agoImplement FP instructions:
Julian Seward [Mon, 9 Feb 2015 09:07:47 +0000 (09:07 +0000)] 
Implement FP instructions:
  FMOV (vector, immediate, single precision)
  FRINTN 2d_2d, 4s_4s, 2s_2s
  FRINTM 2d_2d, 4s_4s, 2s_2s
  FRINTP 2d_2d, 4s_4s, 2s_2s
  FRINTZ 2d_2d, 4s_4s, 2s_2s
  FRINTA 2d_2d, 4s_4s, 2s_2s
  FRINTX 2d_2d, 4s_4s, 2s_2s
  FRINTI 2d_2d, 4s_4s, 2s_2s
  FRINTN d_d, s_s

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

10 years agoImplement all remaining FP multiple style instructions:
Julian Seward [Sun, 8 Feb 2015 18:24:38 +0000 (18:24 +0000)] 
Implement all remaining FP multiple style instructions:
  FMULX d_d_d, s_s_s
  FMLA d_d_d[], s_s_s[]
  FMLS d_d_d[], s_s_s[]
  FMUL  d_d_d[], s_s_s[]
  FMULX d_d_d[], s_s_s[]
  FMULX 2d_2d_2d, 4s_4s_4s, 2s_2s_2s
  FMULX 2d_2d_d[], 4s_4s_s[], 2s_2s_s[]
The FMULX variants are currently handed the same as FMUL.  This is a
kludge that will have to be fixed at some point.

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

10 years agoImplement all remaining FP min/max style instructions:
Julian Seward [Sun, 8 Feb 2015 12:08:56 +0000 (12:08 +0000)] 
Implement all remaining FP min/max style instructions:
  {FMAXMNV,FMINMNV,FMAXV,FMINV} s_4s
  {FMAXNMP,FMINNMP,FMAXP,FMINP} d_2d, s_2s
  {FMAXNM,FMINNM,FMAX,FMIN} 2d_2d_2d, 4s_4s_4s, 2s_2s_2s
  {FMAXNMP,FMINNMP,FMAXP,FMINP} 2d_2d_2d, 4s_4s_4s, 2s_2s_2s

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

10 years agoImplement all remaining FP compare instructions:
Julian Seward [Sat, 7 Feb 2015 21:09:47 +0000 (21:09 +0000)] 
Implement all remaining FP compare instructions:
{FCMEQ,FCMGE,FCMGT,FACGE,FACGT} d_d_d, s_s_s
{FCMEQ,FCMGE,FCMGT,FACGE,FACGT} d_d_#0.0, s_s_#0.0
{FCMEQ,FCMGE,FCMGT,FACGE,FACGT} 2d_2d_#0.0, 4s_4s_#0.0, 2s_2s_#0.0
{FCCMP,FCCMPE} s_s, d_d

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

10 years agoEnable FCVTMU Xd,Sn. Fixes #343332.
Julian Seward [Thu, 5 Feb 2015 15:22:30 +0000 (15:22 +0000)] 
Enable FCVTMU Xd,Sn.  Fixes #343332.

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

10 years agoMake a very minor change to the LibVEX_Translate interface (sub-arg of
Julian Seward [Thu, 5 Feb 2015 12:53:20 +0000 (12:53 +0000)] 
Make a very minor change to the LibVEX_Translate interface (sub-arg of
needs_self_check) which allows VEX's user to selectively override, on
a per-translation basis, the default precise-exception control setting
that is specified in VexControl::iropt_register_updates.  Fix up
plumbing inside iropt so as to used passed-in values rather than the
default one.

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

10 years agoFix bug 343802. We need to handle one more special case in the spechelper
Christian Borntraeger [Thu, 5 Feb 2015 11:05:10 +0000 (11:05 +0000)] 
Fix bug 343802. We need to handle one more special case in the spechelper

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

10 years agoguest_amd64_spechelper:
Julian Seward [Wed, 4 Feb 2015 19:05:13 +0000 (19:05 +0000)] 
guest_amd64_spechelper:
* add spec rules for B and NB after SUBB
* number (in comments) some existing cases.

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

10 years agodis_VMASKMOV: create per-lane transfer/no-transfer guard expressions
Julian Seward [Tue, 3 Feb 2015 18:01:41 +0000 (18:01 +0000)] 
dis_VMASKMOV: create per-lane transfer/no-transfer guard expressions
that are more Memcheck-friendly.  No functional change.

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

10 years agoFix hwcaps validity checking for x86.
Florian Krohm [Thu, 29 Jan 2015 15:21:47 +0000 (15:21 +0000)] 
Fix hwcaps validity checking for x86.
Capabilities  x86-mmxext-sse1-sse2-sse3-lzcnt were rejected as invalid.

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

10 years agoppIRStoreG: print braces around guarded section, so as to be more
Julian Seward [Wed, 28 Jan 2015 12:03:26 +0000 (12:03 +0000)] 
ppIRStoreG: print braces around guarded section, so as to be more
consistent with other guarded-IR printing.  No functional change.

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

10 years agoImplement AVX-1 conditional vector stores: VMASKMOVP{D,S} xmm/ymm to memory.
Julian Seward [Wed, 28 Jan 2015 11:49:12 +0000 (11:49 +0000)] 
Implement AVX-1 conditional vector stores: VMASKMOVP{D,S} xmm/ymm to memory.
Fixes #335785.

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

10 years agoUse IR conditional stores (IRStoreG) to implement AVX-2 conditional
Julian Seward [Wed, 28 Jan 2015 10:52:36 +0000 (10:52 +0000)] 
Use IR conditional stores (IRStoreG) to implement AVX-2 conditional
vector stores, VPMASKMOV{D,Q} xmm/ymm to memory.

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

10 years agoChange AMD64Instr_CMov64 so that the source can only be a register
Julian Seward [Tue, 27 Jan 2015 23:35:58 +0000 (23:35 +0000)] 
Change AMD64Instr_CMov64 so that the source can only be a register
instead of register-or-memory (an AMD64RM).  This avoids duplicating
conditional load functionality introduced in r3075 via
AMD64Instr_CLoad and in practice has no effect on the quality of the
generated code.

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

10 years agoAMD64 front end: translate AVX2 PMASKMOV load instructions (vector
Julian Seward [Tue, 27 Jan 2015 23:17:02 +0000 (23:17 +0000)] 
AMD64 front end: translate AVX2 PMASKMOV load instructions (vector
conditional loads) using IR conditional load statements IRLoadG rather
than the previous rather ingenious hack.

AMD64 back end:
* Add instruction selection etc for 32- and 64-bit conditional loads (IRLoadG)
* Handle dirty helper calls that return a value and that are conditional.  These
  result from Memcheck's instrumentation of IRLoadGs.

No functional change.  This is a cleanup as part of supporting AVX2
PMASKMOV loads and stores by using the existing IR facilities for
conditional loads and stores.

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

10 years agoAdd ILGop_Ident64 to enum type IRLoadGOp so as to make it
Julian Seward [Tue, 27 Jan 2015 23:09:23 +0000 (23:09 +0000)] 
Add ILGop_Ident64 to enum type IRLoadGOp so as to make it
possible to represent 64 bit conditional loads in IR.

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

10 years agoFix an assert. Unbreak build on 32-bit platforms.
Florian Krohm [Wed, 21 Jan 2015 10:38:18 +0000 (10:38 +0000)] 
Fix an assert. Unbreak build on 32-bit platforms.

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

10 years agoAdd an assert to check that we're getting the expected alignment.
Florian Krohm [Tue, 20 Jan 2015 21:37:06 +0000 (21:37 +0000)] 
Add an assert to check that we're getting the expected alignment.

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

10 years agoThe size of an event check never depends on the endianess
Florian Krohm [Sat, 10 Jan 2015 16:10:58 +0000 (16:10 +0000)] 
The size of an event check never depends on the endianess
of the host. Remove parameter.

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

10 years agoClean up a few leftovers from the AIX port which no longer exists.
Florian Krohm [Thu, 8 Jan 2015 20:45:42 +0000 (20:45 +0000)] 
Clean up a few leftovers from the AIX port which no longer exists.

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

10 years agoRemove the definitons of Ptr_to_ULong and ULong_to_Ptr.
Florian Krohm [Wed, 7 Jan 2015 20:14:48 +0000 (20:14 +0000)] 
Remove the definitons of Ptr_to_ULong and ULong_to_Ptr.
A cast to Addr replaces the former and the latter wasn't used.

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

10 years agoThe following two lines of code always convert the 64-bit pointer to a 32-bit
Carl Love [Tue, 6 Jan 2015 19:47:51 +0000 (19:47 +0000)] 
The following two lines of code always convert the 64-bit pointer to a 32-bit
pointer.

 target = toUInt( Ptr_to_ULong(h_calc_BCDtoDPB ) );

    and

 target = toUInt( Ptr_to_ULong( h_calc_DPBtoBCD ) );

The toUInt() should only be used if we are running in 32-bit mode.  The lines
were changed to only convert the pointer to 32-bit if running in 32-bit mode.

There is no bugzilla for this issue.  It was noticed by Florian Krohm.

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

10 years agoFix assert
Philippe Waroquiers [Tue, 6 Jan 2015 15:15:07 +0000 (15:15 +0000)] 
Fix assert
   vex: priv/guest_generic_bb_to_IR.c:224 (bb_to_IR): Assertion `vex_control.guest_max_insns < 100' failed.
caused by giving --vex-guest-max-insns=100
100 should be allowed as described by --help-debug:
    --vex-guest-max-insns=<1..100>         [50]

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

10 years agoFixed missing ULL on constants per compiler warnings:
Carl Love [Mon, 5 Jan 2015 18:34:01 +0000 (18:34 +0000)] 
Fixed missing ULL on constants per compiler warnings:

gcc -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -I../VEX/pub -DVGA_x86=1 -DVGO_linux=1 -DVGP_x86_linux=1 -DVGPV_x86_linux_vanilla=1 -Ipriv  -m32 -mpreferred-stack-boundary=2 -O2 -g -Wall -Wcast-align -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-long-long -Wcast-qual -Wwrite-strings -Wformat -Wformat-security -fno-stack-protector -fno-strict-aliasing -fno-builtin  -fomit-frame-pointer -Wbad-function-cast -Wcast-qual -fstrict-aliasing  -MT priv/libvex_x86_linux_a-guest_ppc_toIR.o -MD -MP -MF priv/.deps/libvex_x86_linux_a-guest_ppc_toIR.Tpo -c -o priv/libvex_x86_linux_a-guest_ppc_toIR.o `test -f 'priv/guest_ppc_toIR.c' || echo './'`priv/guest_ppc_toIR.c
priv/guest_ppc_toIR.c: In function ‘dis_vx_load’:
priv/guest_ppc_toIR.c:15333: warning: integer constant is too large for ‘long’ type
priv/guest_ppc_toIR.c:15334: warning: integer constant is too large for ‘long’ type

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

10 years agoFix an incorrect truncation of an address value to 32 bits.
Florian Krohm [Mon, 5 Jan 2015 14:24:54 +0000 (14:24 +0000)] 
Fix an incorrect truncation of an address value to 32 bits.
Never heard anyone complain about it, so probably a rare case.

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

10 years agoChange remaining use of Addr64 in the VEX API to Addr. The reduces
Florian Krohm [Sun, 4 Jan 2015 17:20:19 +0000 (17:20 +0000)] 
Change remaining use of Addr64 in the VEX API to Addr. The reduces
the size of VexGuestExtent to 20 bytes on a 32-bit platform.
Change prototypes of x86g_dirtyhelper_loadF80le and
x86g_dirtyhelper_storeF80le to give the address in the parameter
list type Addr. Likewise for amd64g_dirtyhelper_loadF80le and
amd64g_dirtyhelper_storeF80le.
Update switchback.c - but not tested.

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

10 years agoChange the IMark statement. The address is now type Addr and the
Florian Krohm [Fri, 2 Jan 2015 17:32:21 +0000 (17:32 +0000)] 
Change the IMark statement. The address is now type Addr and the
length is unsigned.

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

10 years agoThe length of a disassemnled insn is always positive.
Florian Krohm [Fri, 2 Jan 2015 14:40:59 +0000 (14:40 +0000)] 
The length of a disassemnled insn is always positive.
Make DisResult::len an UInt.

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

10 years agoGive DisResult::continueAt Addr type.
Florian Krohm [Fri, 2 Jan 2015 13:34:15 +0000 (13:34 +0000)] 
Give DisResult::continueAt Addr type.

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

10 years agoMake VexTranslateArgs::guest_bytes_addr an Addr value. Fix ripple.
Florian Krohm [Fri, 2 Jan 2015 11:44:12 +0000 (11:44 +0000)] 
Make VexTranslateArgs::guest_bytes_addr an Addr value. Fix ripple.

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

10 years agoSynch compiler flags with those in valgrind's Makefile.all.am.
Florian Krohm [Thu, 1 Jan 2015 18:38:15 +0000 (18:38 +0000)] 
Synch compiler flags with those in valgrind's Makefile.all.am.
Add -std=gnu99.

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

10 years agoIt has long been assumed that host and guest architectures
Florian Krohm [Wed, 31 Dec 2014 12:09:38 +0000 (12:09 +0000)] 
It has long been assumed that host and guest architectures
are the same - even though the initial design goal was likely
different allowing a cross-valgrind of sorts. But as Julian
put it:
But it's been 12+ years and I've never once heard any mention of
such a thing.  So perhaps it's time to give up on that one.

Now let's take advantage of this decision and tighten up the VEX
API using Addr instead of Addr64. As a first step move the definition
of Addr into VEX proper and change the chase_into_ok callback
accordingly.

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

10 years agoAs a library, VEX should not export the offsetof and vg_alignof
Florian Krohm [Mon, 29 Dec 2014 22:18:58 +0000 (22:18 +0000)] 
As a library, VEX should not export the offsetof and vg_alignof
macros. The latter isn't even used by VEX.
Move them to pub_tool_basics.h.
offsetof also goes to VEX's private header main_util.h.

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

10 years agoAdd a missing header file.
Florian Krohm [Mon, 29 Dec 2014 21:05:37 +0000 (21:05 +0000)] 
Add a missing header file.

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

10 years agoChange a few prototypes to use SizeT.
Florian Krohm [Mon, 29 Dec 2014 20:22:26 +0000 (20:22 +0000)] 
Change a few prototypes to use SizeT.
Also, offsetof returns a SizeT value.

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

10 years agoAdd type SizeT (moved here from valgrind's pub_tool_basics.h).
Florian Krohm [Mon, 29 Dec 2014 19:05:37 +0000 (19:05 +0000)] 
Add type SizeT (moved here from valgrind's pub_tool_basics.h).
Enhance vprintf_wrk to print such values (%zu, %zx, %zX).

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

10 years agoRemove a few dead assignments.
Florian Krohm [Wed, 24 Dec 2014 12:38:52 +0000 (12:38 +0000)] 
Remove a few dead assignments.

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

10 years agoAudit a buffer.
Florian Krohm [Tue, 23 Dec 2014 11:05:03 +0000 (11:05 +0000)] 
Audit a buffer.

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

10 years agoFix 197259 Unsupported arch_prtctl PR_SET_GS option
Philippe Waroquiers [Tue, 16 Dec 2014 23:57:51 +0000 (23:57 +0000)] 
Fix 197259  Unsupported arch_prtctl PR_SET_GS option

On amd64, We handle GS similar to FS, i.e. consider it is constant.
Note that FS is not always 0 on linux. It looks rather to be constant
in all threads, and is zero in the main thread.
As values for FS and/or GS differs between platforms (linux or darwin),
FS_CONST and GS_CONST are used.

Note that we cannot easily test that the value of GS or FS is the
expected one, as the value might not be set at the begin of execution
but only set after prctl has been executed.

So, we just hope that effectively GS and FS are constant.
Some trials to set GS to other values that the expected
constant value on linux was causing a SEGV.
So, it looks like this is all effectively protected.

In summary: we were counting somewhat on the luck for FS,
we now similarly count on luch for GS

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

10 years agoRemove quote.txt and newline.txt as they are no longer needed.
Florian Krohm [Mon, 15 Dec 2014 21:55:16 +0000 (21:55 +0000)] 
Remove quote.txt and newline.txt as they are no longer needed.
Once upon a time those files were used to construct a
header file vex_svnversion.h but that more hassle than it
was worth and eventually it got nuked.

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

10 years agoTweak a format specifier. Remove a redundant assert.
Florian Krohm [Mon, 15 Dec 2014 21:07:37 +0000 (21:07 +0000)] 
Tweak a format specifier. Remove a redundant assert.

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

10 years agoMore constification.
Florian Krohm [Mon, 15 Dec 2014 18:58:07 +0000 (18:58 +0000)] 
More constification.

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

10 years agoRemove some debugging code that was accidentally checked in
Florian Krohm [Wed, 10 Dec 2014 22:11:33 +0000 (22:11 +0000)] 
Remove some debugging code that was accidentally checked in
in r3038

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

10 years agoToday this is what happens when we encounter hwcaps we cannot handle:
Florian Krohm [Wed, 10 Dec 2014 16:10:24 +0000 (16:10 +0000)] 
Today this is what happens when we encounter hwcaps we cannot handle:

vex: priv/main_main.c:329 (LibVEX_Translate): Assertion
`are_valid_hwcaps(VexArchAMD64, vta->archinfo_host.hwcaps)' failed.

Running with -d offers this much enlightenment:

--7732:1:main     ... arch = AMD64, hwcaps = INVALID

Not a good base for a bug report...

With this change, the user experience will be smoewhat better, e.g.:

VEX: Support for AVX2 requires AVX capabilities
     Found: amd64-cx16-rdtscp-sse3-avx2
Cannot continue. Good-bye

Specifically, the patch decouples showing hwcaps and deciding their validity.
show_hwcaps_<ARCH> reports the hwcaps it finds. It never returns NULL.
check_hwcaps checks the hwcaps for feasibility and does not return in case
VEX cannot deal with them.
The function are_valid_hwcaps no longer exists.

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

10 years agoNew function vfatal which should be used for user messages
Florian Krohm [Wed, 10 Dec 2014 16:08:09 +0000 (16:08 +0000)] 
New function vfatal which should be used for user messages
to indicate a situation that can legitimately occur but that
we cannot handle today. The function does not return.

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

10 years agoFix incorrect implementation of AESKEYGENASSIST in the case where
Julian Seward [Tue, 9 Dec 2014 21:01:28 +0000 (21:01 +0000)] 
Fix incorrect implementation of AESKEYGENASSIST in the case where
the two registers are the same.  Fixes #341698.

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

10 years agoUpdate x86 decoder as per advise from Julian.
Florian Krohm [Tue, 9 Dec 2014 20:09:42 +0000 (20:09 +0000)] 
Update x86 decoder as per advise from Julian.

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

10 years agoThe long displacement facility is now required. There were a
Florian Krohm [Mon, 8 Dec 2014 14:01:33 +0000 (14:01 +0000)] 
The long displacement facility is now required. There were a
few spots in the code where this was assumed implicitly.
Ugly fixes were possible, but requiring this facility is not
unreasonable as it has been around sind 2003. So let's just
do this.

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

10 years agoExport s390_host_hwcaps in LibVEX_Translate, so we can use it in
Florian Krohm [Mon, 8 Dec 2014 12:42:26 +0000 (12:42 +0000)] 
Export s390_host_hwcaps in LibVEX_Translate, so we can use it in
are_valid_hwcaps.

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

10 years agoAdd a few more asserts. Fix a function prototype.
Florian Krohm [Sat, 6 Dec 2014 20:24:08 +0000 (20:24 +0000)] 
Add a few more asserts. Fix a function prototype.

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

10 years agoDFP insns should cause an emulation failure if the host cannot
Florian Krohm [Sat, 6 Dec 2014 16:34:48 +0000 (16:34 +0000)] 
DFP insns should cause an emulation failure if the host cannot
execute them. Previously, they caused a failing assertion
which was incorrect.

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

10 years agoEncountering a PFPO insn in a client program while running on a host
Florian Krohm [Fri, 5 Dec 2014 18:55:39 +0000 (18:55 +0000)] 
Encountering a PFPO insn in a client program while running on a host
that does not have that insn now causes an emulation error.
Previously, it caused a failing assertion which was incorrect.

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

10 years agoFix some verbiage.
Florian Krohm [Fri, 5 Dec 2014 18:28:29 +0000 (18:28 +0000)] 
Fix some verbiage.

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

10 years agomips64: add support for Cavium BBIT032 and BBIT132
Petar Jovanovic [Wed, 26 Nov 2014 23:47:08 +0000 (23:47 +0000)] 
mips64: add support for Cavium BBIT032 and BBIT132

This patch adds support for two Cavium specific instructions:
- BBIT032 (Branch on Bit Clear Plus 32), and
- BBIT132 (Branch on Bit Set Plus 32).

Missing support reported in BZ #339288.

Patch by Maran Pakkirisamy.

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

10 years agoImplement FRINTI d_d, s_s.
Julian Seward [Tue, 25 Nov 2014 17:42:52 +0000 (17:42 +0000)] 
Implement FRINTI d_d, s_s.

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

10 years agoImplement RORV x_x_x, w_w_w
Julian Seward [Tue, 25 Nov 2014 17:27:32 +0000 (17:27 +0000)] 
Implement RORV x_x_x, w_w_w

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

10 years agoImplement CLS x_x, w_w
Julian Seward [Tue, 25 Nov 2014 15:51:07 +0000 (15:51 +0000)] 
Implement CLS x_x, w_w

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

10 years agoarm64: implement "BRK #imm16".
Julian Seward [Tue, 25 Nov 2014 12:17:53 +0000 (12:17 +0000)] 
arm64: implement "BRK #imm16".

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

10 years agoAdd function s390_isel_amode_b12_b20 to compile an expression into an
Florian Krohm [Sat, 22 Nov 2014 20:10:21 +0000 (20:10 +0000)] 
Add function s390_isel_amode_b12_b20 to compile an expression into an
amode that is either S390_AMODE_B12 or S390_AMODE_B20. This is needed
for compare-and-swap insns. As we're currently not generating amodes
using an index register, there was never a problem.
This change future-proofs the code.
Also add a few more asserts for amodes in the s390_insns supporting
translation chaining.
Fixes BZ #269360.

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

10 years agoRemove dead code.
Florian Krohm [Fri, 21 Nov 2014 21:40:45 +0000 (21:40 +0000)] 
Remove dead code.

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

10 years agoThis change was triggered by BZ #247974 which suggested to include
Florian Krohm [Thu, 20 Nov 2014 15:08:56 +0000 (15:08 +0000)] 
This change was triggered by BZ #247974 which suggested to include
VEX/test_main.* in the tarball. We don't want to do that because those
files are really just scaffolding for developers to play with and not
meant for general consumption (and are also bitrotting ATM). Therefore,
this patch moves them to the "useful" subdirectory and adds a crude
Makefile there to build the executable.
Makefile-gcc updated accordingly.

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

10 years agoarm64: enable FCVT{A,N}S X,S.
Julian Seward [Thu, 20 Nov 2014 11:30:41 +0000 (11:30 +0000)] 
arm64: enable FCVT{A,N}S X,S.

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

10 years agoImplement {S,U}CVTF (scalar, fixedpt).
Julian Seward [Thu, 20 Nov 2014 10:14:06 +0000 (10:14 +0000)] 
Implement {S,U}CVTF (scalar, fixedpt).

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

10 years agoImplement VFPv4 VFNMA, VFNMS d_d and s_s variants (not that
Julian Seward [Wed, 19 Nov 2014 16:07:28 +0000 (16:07 +0000)] 
Implement VFPv4 VFNMA, VFNMS d_d and s_s variants (not that
there are any other variants).  Fixes #340807.

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

10 years agoFix stupid bug introduced in r2993, which causes many simple scalar
Julian Seward [Mon, 17 Nov 2014 14:16:56 +0000 (14:16 +0000)] 
Fix stupid bug introduced in r2993, which causes many simple scalar
floating point instructions to ignore their operands and return zero.  Sigh.

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

10 years agoImplement arm64 insns:
Julian Seward [Mon, 17 Nov 2014 11:21:21 +0000 (11:21 +0000)] 
Implement arm64 insns:
ADDP s_2s, d_2d
FADDP 2d_2d_2d, 4s_4s_4s, 2s_2s_2s
FMAX d_d, s_s
FMIN d_d, s_s
FMAXNM d_d, s_s (not really correct)
FMINNM d_d, s_s (not really correct)
FCVT{A,N}S W,D

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

10 years agoImplement "fcvtpu w, s". n-i-bz.
Julian Seward [Sat, 15 Nov 2014 22:24:18 +0000 (22:24 +0000)] 
Implement "fcvtpu w, s".  n-i-bz.

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

10 years agoImplement fcsel d_d, s_s. Fixes #340856.
Julian Seward [Sat, 15 Nov 2014 16:07:14 +0000 (16:07 +0000)] 
Implement fcsel d_d, s_s.  Fixes #340856.

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

10 years agoAdd detection of old ppc32 magic instructions from bug 278808.
Mark Wielaard [Thu, 13 Nov 2014 14:29:03 +0000 (14:29 +0000)] 
Add detection of old ppc32 magic instructions from bug 278808.

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

10 years agoAdd a nasty temporary kludge to CPUID that allows 64-bit MacOSX 10.10
Julian Seward [Tue, 11 Nov 2014 12:49:21 +0000 (12:49 +0000)] 
Add a nasty temporary kludge to CPUID that allows 64-bit MacOSX 10.10
(Yosemite) to run, until such time as XSAVE and XRSTOR are implemented.
Detailed in the comments.  All other targets should be unaffected.

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

10 years agoFix incorrect decoding of AVX2 insns:
Julian Seward [Fri, 7 Nov 2014 10:08:21 +0000 (10:08 +0000)] 
Fix incorrect decoding of AVX2 insns:
  VPBROADCASTB xmm, xmm
  VPBROADCASTB xmm, ymm
  VPBROADCASTW xmm, xmm
  VPBROADCASTW xmm, ymm
Fixes #340725.

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

10 years agoBug 340632 arm64: unhandled instruction fcvtas
Mark Wielaard [Tue, 4 Nov 2014 15:30:42 +0000 (15:30 +0000)] 
Bug 340632 arm64: unhandled instruction fcvtas

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

10 years agoHandle all DSB/DMB/ISB variants. Fixes #340033.
Julian Seward [Fri, 31 Oct 2014 10:25:19 +0000 (10:25 +0000)] 
Handle all DSB/DMB/ISB variants.  Fixes #340033.

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

10 years agoImplement PRFM (immediate). Fixes #335713.
Julian Seward [Thu, 30 Oct 2014 23:56:10 +0000 (23:56 +0000)] 
Implement PRFM (immediate).  Fixes #335713.

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

10 years agoImplement FCVTAS W_S and FCVTAU W_S. Fixes #340509.
Julian Seward [Thu, 30 Oct 2014 23:10:45 +0000 (23:10 +0000)] 
Implement FCVTAS W_S and FCVTAU W_S.  Fixes #340509.

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

10 years agoImplement
Julian Seward [Thu, 30 Oct 2014 16:36:53 +0000 (16:36 +0000)] 
Implement
FMLA 2d_2d_d[], 4s_4s_s[], 2s_2s_s[]
FMLS 2d_2d_d[], 4s_4s_s[], 2s_2s_s[]
Fixes #339938 and its dup, #339950.

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

10 years agoImplement fcvtmu x_d. Fixes #339927.
Julian Seward [Thu, 30 Oct 2014 15:54:53 +0000 (15:54 +0000)] 
Implement fcvtmu x_d.  Fixes #339927.

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

10 years agoImplement frintx d_d and s_s. Fixes #339926.
Julian Seward [Thu, 30 Oct 2014 15:37:16 +0000 (15:37 +0000)] 
Implement frintx d_d and s_s.  Fixes #339926.

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

10 years agoTweak to allow the use of this Makefile with the ICC compiler.
Florian Krohm [Wed, 29 Oct 2014 13:53:11 +0000 (13:53 +0000)] 
Tweak to allow the use of this Makefile with the ICC compiler.
Patch by Gregory Czajkowski <gregczajkowski@yahoo.com>.
Related to BZ #339542.

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

10 years ago* add a missing extra m-reg check for some LD/ST vector cases
Julian Seward [Mon, 27 Oct 2014 09:29:48 +0000 (09:29 +0000)] 
* add a missing extra m-reg check for some LD/ST vector cases

* implement
  LD1/ST1 (multiple 1-elem structs to/from 2 regs
  LD1/ST1 (multiple 1-elem structs to/from 3 regs
  LD1/ST1 (multiple 1-elem structs to/from 4 regs
  LD1R (single structure, replicate)
  LD2R (single structure, replicate)
  LD3R (single structure, replicate)
  LD4R (single structure, replicate)
  LD1/ST1 (single structure, to/from one lane)
  LD2/ST2 (single structure, to/from one lane)
  LD3/ST3 (single structure, to/from one lane)
  LD4/ST4 (single structure, to/from one lane)

I believe this completes the implementation of load and store
instructions for AArch64 ARMv8.

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

10 years agoCompanion patch of valgrind r14664.
Florian Krohm [Sat, 25 Oct 2014 20:10:30 +0000 (20:10 +0000)] 
Companion patch of valgrind r14664.

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

10 years agoMemove unused macro. Should have been part of r2955.
Florian Krohm [Thu, 23 Oct 2014 13:52:05 +0000 (13:52 +0000)] 
Memove unused macro. Should have been part of r2955.

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

10 years agoImplement SIMD (de)interleaving loads/stores:
Julian Seward [Wed, 22 Oct 2014 13:52:51 +0000 (13:52 +0000)] 
Implement SIMD (de)interleaving loads/stores:
  LD1/ST1 (multiple 1-elem structs to/from 1 reg
  LD2/ST2 (multiple 2-elem structs to/from 2 regs
  LD3/ST3 (multiple 3-elem structs to/from 3 regs
  LD4/ST4 (multiple 4-elem structs to/from 4 regs
Also:
  LDNP, STNP  (load/store vector pair, non-temporal)

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

10 years agoBug 339858 arm64 recognize dmb sy. Data Memory Barrier full SYstem variant.
Mark Wielaard [Sat, 11 Oct 2014 19:13:35 +0000 (19:13 +0000)] 
Bug 339858 arm64 recognize dmb sy. Data Memory Barrier full SYstem variant.

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

10 years agoMerge the memory allocation bits from libvex.h into main_util.c.
Florian Krohm [Sat, 11 Oct 2014 14:48:38 +0000 (14:48 +0000)] 
Merge the memory allocation bits from libvex.h into main_util.c.
This is to avoid linkage problems due to unresolved symbols for
some compilers. See also valgrind r14600 and BZ #339542.

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

10 years agoThis patch makes the needed changes to the lxvw4x for Little Endian.
Carl Love [Thu, 9 Oct 2014 21:08:25 +0000 (21:08 +0000)] 
This patch makes the needed changes to the lxvw4x for Little Endian.
The data was being loaded in the Big Endian data order for most
cases.  The code in host_ppc_isel.c was changed to do a right
shift and to permute the hi and lo registers in the other order
to ensure the data was always loaded in BE order.  The lxvw4x
emulation in guest_ppc_toIR.c was changed to permute the data from
the BE order to LE order when running on an LE system.

bugzilla 339433

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

10 years agomips: add a missing break
Petar Jovanovic [Thu, 9 Oct 2014 01:19:34 +0000 (01:19 +0000)] 
mips: add a missing break

Add a missing break found by IBM's BEAM checker and reported by Florian.

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

10 years agomips: use putDReg/getDReg for ceil.l.d
Petar Jovanovic [Thu, 9 Oct 2014 01:01:57 +0000 (01:01 +0000)] 
mips: use putDReg/getDReg for ceil.l.d

For better clarity and consistency, use putDReg/getDReg instead of
putFReg/getFReg for ceil.l.d.
Non-functional change.

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

10 years agoConstification part 5.
Florian Krohm [Wed, 8 Oct 2014 08:54:44 +0000 (08:54 +0000)] 
Constification part 5.
Constify ppXXXInstr, getRegUsage_XXXInstr, isMove_XXXInstr, emit_XXXInstr,
and iselSB_XXX.

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