Commit Graph

148 Commits

Author SHA1 Message Date
Nicholas Nethercote
e0e17fab32 Increase the size of M_VG_ERRTXT from 512B to 4KB, increasing the size of C++
names that can be demangled.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2787
2004-10-18 15:47:18 +00:00
Nicholas Nethercote
ba210a6364 Arch-abstraction step: renamed "vg_include.h" as "core.h".
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2643
2004-09-01 23:58:16 +00:00
Nicholas Nethercote
5b829e7c84 Made cpu-feature detection simpler -- got rid of the confusing global state,
put it all into static state within a single function.  Also, now the callers
of get_cpu_features() don't have to worry about whether it's been called
before.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2572
2004-08-06 17:06:14 +00:00
Nicholas Nethercote
a545bc15cc Tweaked sanity-checking: made function naming more consistent, removed
unnecessarily global functions from vg_include.h, etc.

Also tweaked printing of malloc stats.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2562
2004-08-03 23:14:00 +00:00
Tom Hughes
e1cc11b7c6 Move the decoding of SFENCE out of the SSE only part of disInstr as it
exists on Athlon's that have MMXEXT support and those don't have SSE state
so won't decode it where it was.

CCMAIL: 85947-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2524
2004-07-25 15:43:00 +00:00
Julian Seward
9837ea2f4b Fix scary bug causing mis-identification of SSE stores vs loads.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2517
2004-07-20 23:49:22 +00:00
Julian Seward
ff1439fd06 Fix extremely obscure bug in xadd picked up by QEMU's test suite. The
(almost useless) instruction "xadd %reg,%reg" gave the wrong answer
due to a subtlety of the order in which the destination registers are
PUTted to.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2513
2004-07-20 12:24:53 +00:00
Julian Seward
d6c41529d5 gcc sometimes generates "sbbl %reg,%reg" to convert the carry flag
into 0 or -1 in reg.  This has no actual dependency on reg, but
memcheck can't see that, and so will yelp if reg contains garbage.  A
simple fix is to put zero into reg before we start, zapping any
undefinedness it might otherwise contain.

Hopefully fixes #84978 (unconfirmed)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2512
2004-07-20 11:42:24 +00:00
Nicholas Nethercote
3462634d9a Support FBLD, FBSTP. Patch courtesy of Jani Monoses.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2492
2004-07-17 10:01:51 +00:00
Tom Hughes
3561ea08ca Added VG_(cpuid) to replace the various bits of inline assembler used
to query the CPU characteristics as the use of four implicit registers
causes havoc when GCC tries to inline and optimise the assembler.

Fix to bug #79696.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2421
2004-06-16 20:51:45 +00:00
Nicholas Nethercote
d4834c9c77 Added "repne movs", not official but seems to occur. Also restructured the
rep/repe/repne cases to use a switch instead of if/else, as it's cleaner.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2398
2004-06-02 14:48:16 +00:00
Nicholas Nethercote
9c5e009c05 When printing code and an insane instruction is encountered, ugly-print (giving
full details) it as well as pretty-printing it.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2375
2004-04-18 15:20:43 +00:00
Nicholas Nethercote
ff7adfacc8 Introduce uWiden, similar to uCCall, uCond, etc.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2374
2004-04-18 12:23:02 +00:00
Nicholas Nethercote
5c07d8623b Added comment clarifying RDTSC.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2370
2004-04-16 22:21:18 +00:00
Tom Hughes
307c5c2187 Fixed decoding of x87 instructions to handle those taking 16 bit
integer arguments.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2339
2004-03-27 18:03:26 +00:00
Tom Hughes
57b01439e0 Move the handling of PSHUFW from the SSE code to the MMX code so that
it will work on older Athlons which only have MMXEXT support.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2319
2004-03-15 16:43:58 +00:00
Tom Hughes
56a515fc49 Treat INT with an operand other than 0x80 as an undefined instruction.
CCMAIL: 76839-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2291
2004-03-06 12:53:24 +00:00
Tom Hughes
67f9196d17 Add support for 16 bit pushes and pops of segment registers to
fix bug #76762.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2288
2004-03-04 23:36:58 +00:00
Nicholas Nethercote
fcad29e364 Patch from Tom Hughes:
Patch to ignore REP prefixes on single byte RET instructions.

(REP RET is apparently faster than RET on AMD K7/K8)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2257
2004-02-22 16:56:28 +00:00
Nicholas Nethercote
4c8ecb23c3 Heroic patch from Tom Hughes:
This patch adds translation tests for most of the basic x86 instructions and
  fixes a few missing/broken instructions to work properly.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2242
2004-02-11 23:33:29 +00:00
Jeremy Fitzhardinge
7f79e2ad88 Rearrange CPUID again. Moved most of the helper logic into C, since
the assember was getting fiddly.  It now masks out only the undefined
or unimplemented parts of the feature set bits, so it now passes through
all the non-ISA-related feature bits to clients.

It also leaves the vendor ID string unmolested, so that clients can
extract vendor-specific information like extended brand strings and
cache/TLB configuration info.

It does, however, implement some Valgrind-specific requests at 0xd8000000,
though at present the only functionality is the ValgrindVCPU signature.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2236
2004-01-26 21:11:51 +00:00
Nicholas Nethercote
a00c960da2 Made code more concise. In particular:
- introduced DIS() and DIP() macros to shorten debug printing

  - introduce jmp_lit(), jcc_lit(), jmp_treg() for common UCode sequences

  - replace many unnecessary dis?dis_buf:NULL tests with dis_buf, by
    changing the tests in disAMode()

Overall, reduced code size by about 230 lines.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2234
2004-01-26 17:14:17 +00:00
Jeremy Fitzhardinge
daa694d0ac Virtualize CPUID. Rather than just using the host CPU's CPUID,
we now completely virtualize it.  The feature flags returned are the
intersection of the set the CPU supports, and the set of flags Valgrind
supports.  This turns out to be a small number of features, like FPU,
TSC, MMX, SSE, SSE2, FXSR.  All mention of things which are only useful
to kernel-mode code are also suppressed.  This CPUID doesn't support
any extended feature flags, or extended CPUID operations.  It returns a
vendor string of "ValgrindVCPU".

If the host CPU doesn't support CPUID, then we make sure we treat it as
an illegal instruction (I'm not sure if we handle the eflags bit toggle
test right).  This is because the CPUID helper doesn't actually use the
cpuid instruction in all cases, so it may succeed where the host CPU
wouldn't (other instructions which depend on feature flags will end up
generating those instructions, so they'll endup generating a SIGILL if
client code uses them on a CPU which doesn't support them).


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2225
2004-01-25 02:38:29 +00:00
Jeremy Fitzhardinge
357883e70a Fix bug 73219. This adds a general mechanism for querying the host CPU's
capabilities, and uses it to see if it has SSE/SSE2/fxsave support before
trying to use fxsave at startup.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2221
2004-01-23 23:09:01 +00:00
Nicholas Nethercote
c756c590cf Convert "skin" to "tool" in various places; almost entirely within comments,
nothing that will affect code.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2217
2004-01-21 15:08:04 +00:00
Nicholas Nethercote
35d8a28ba8 Patch to add support for the alternate MOVQ encoding, from Tom Hughes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2212
2004-01-20 22:28:26 +00:00
Nicholas Nethercote
5630025b84 Patch from Tom Hughes, for bug 72643:
Patch to improve SSE/SS2 support

  This patch should implement most of the missing SSE/SSE2 opcodes. About
  the only ones it doesn't do are the MASKMOVxxx ones as they are quite
  horrible and involved an implicit reference to EDI so I need to think
  about them a bit more.

  The patch also includes a set of tests for the MMX/SSE/SSE2 opcodes to
  validate that they have the same effect under valgrind as they do when
  run normally. In one or two cases this wasn't actually the case even
  for some of the implemented opcodes, so I fixed those as well ;-)


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2202
2004-01-19 19:14:18 +00:00
Dirk Mueller
3ebf4df7ec yet another SSE insn (rsqrtss)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2194
2004-01-07 19:07:02 +00:00
Julian Seward
cafeef8e48 Support for FXSAVE/FXRSTOR (Tom Hughes). Fixes #71180.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2183
2004-01-04 23:30:55 +00:00
Nicholas Nethercote
07b8e3438b Updated copyright dates for 2004. Also added a couple of missing headers and
footers to some new files.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2177
2004-01-04 16:43:23 +00:00
Dirk Mueller
2ca3af3479 movntpd/movntps support (patch by Tom Hughes)
CCMAIL: 69782-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2160
2004-01-02 22:50:04 +00:00
Dirk Mueller
6be7c55829 implement cmpxchg8b, patch by Tom Hughes.
CCMAIL: 69688-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2154
2004-01-02 22:42:29 +00:00
Jeremy Fitzhardinge
863238a720 Make rep; nop (pause) yield the thread. Based on a patch by Tom Hughes;
I added a test case and cleaned up vg_dispatch.S while I was about it.
CCMAIL: 69529-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2129
2003-12-18 09:06:09 +00:00
Jeremy Fitzhardinge
918c3a7b7e This jumbo-checkin is the Full Virtualization checkin. This eliminates
Valgrind's dependency on the dynamic linker for getting started, and
instead takes things into its own hands.

This checkin doesn't add much in the way of new functionality, but it
is the basis for all future work on Valgrind.  It allows us much more
flexibility in implementation, and well as increasing the reliability
of Valgrind by protecting it more from its clients.

This patch requires some changes to tools to update them to the changes
in the tool API, but they are straightforward.  See the posting "Heads
up: Full Virtualization" on valgrind-developers for a more complete
description of this change and its effects on you.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2118
2003-12-16 02:05:15 +00:00
Nicholas Nethercote
aebec6c2be Patch from Tom Hughes:
This patch extends the SFENCE support that is already present to include
  support for LFENCE and MFENCE as well. It also stops CLFLUSH being mistaken
  for SFENCE by checking the top two bits of the MODRM byte.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2087
2003-12-02 15:25:39 +00:00
Nicholas Nethercote
4b71b93e45 Factor out repeated code for LOOP{E,NE}
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2072
2003-11-28 09:44:21 +00:00
Nicholas Nethercote
5d8ce040fe Fixed up REP-prefix handling majorly. Factored out *lots* of repetitive code,
so much so that the file is now 280 lines shorter.  This despite me also adding
support for LOOP{E,NE} (thanks to Abhijit Menon-Sen).  Also added support for
CMPS[lw], which was missing.  Adding more REP-prefix instructions in the future
will now be much easier.

As part of this, I moved the D-flag fetch outside of the REP loops.  This might
make programs that use REP prefixes a lot go faster.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2068
2003-11-27 16:15:17 +00:00
Nicholas Nethercote
3bbbbfc461 Fix comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2065
2003-11-27 09:30:28 +00:00
Dirk Mueller
23d88489ff add prefetch(w) support - the 3dnow! version of it. doesn't hurt
supporting and its very easy.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2056
2003-11-20 20:45:51 +00:00
Dirk Mueller
99bec54aa3 SHUFPD support
MERGE TO STABLE
CCMAIL: 68588-done@bugs.kde.org


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2050
2003-11-19 22:02:08 +00:00
Dirk Mueller
84dac350b5 add CVTPD2PS support, based on patch by Josef Weidendorfer
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2044
2003-11-19 17:00:58 +00:00
Nicholas Nethercote
450e4bc293 Move var declarations to start of block, for older versions of gcc.
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1985
2003-11-03 11:12:02 +00:00
Nicholas Nethercote
9c8cc2ba2b Implemented PUSH/POP %{FS,GS}, and PUSH %CS (Nb: there is no POP %CS). Based
on patches from Adam Gundy and Tom Hughes.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1982
2003-11-02 17:00:23 +00:00
Julian Seward
660e549669 Add SQRTSS: square root of scalar float
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1959
2003-10-19 22:08:20 +00:00
Julian Seward
e188968404 Implement UNPCKLPS and UNPCKHPS
and improve  UNPCKLPD.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1958
2003-10-19 18:26:36 +00:00
Julian Seward
195939592a SSE/SSE2 fixes needed to run the entire test suite of the GNU
Scientific Library (gsl-1.4) compiled with Intel Icc 7.1 20030307Z '-g
-O -xW'.  I think this gives pretty good coverage of SSE/SSE2 floating
point instructions, or at least the subset emitted by Icc.  So far
tested on memcheck and nulgrind; addrcheck and cachesim still testing.

MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1955
2003-10-19 08:18:52 +00:00
Dirk Mueller
e2a630288e ucomisd support
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1953
2003-10-18 17:04:24 +00:00
Julian Seward
3e0dbf2e57 Implement MOVNTDQ (a SSE/SSE2 insn)
MERGE TO STABLE


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1947
2003-10-17 21:50:30 +00:00
Jeremy Fitzhardinge
d4fea78014 Implement repe scas.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1929
2003-10-14 22:17:19 +00:00
Jeremy Fitzhardinge
bab09402f1 This creates a new UInstr for multiply. This is mainly so that memcheck
can treat it like add and generate partially-defined results of multiply
with partially defined arguments.  It may also speed things up a bit,
if they use lots of multiplies.

This change only deals with signed "new style" multiplies.  That the x86
has two quite different kinds of multiply instructions: the "old-style"
signed and unsigned multiply which uses fixed registers (eax:edx) and
generates a result twice the size of the arguments, and the newer signed
multiple which takes general addressing modes.  It seems that gcc always
(almost always?) generates the new signed multiply instructions, except
for byte-sized multiplies.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1925
2003-10-14 21:49:11 +00:00