Commit Graph

89 Commits

Author SHA1 Message Date
Julian Seward
0356d27ca6 Merge in changes from the 2.4.0 line. This basically brings in the
overhaul of the thread support.  Many things are now probably broken,
but at least with --tool=none, simple and not-so-simple threaded and
non-thread programs work.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3265
2005-03-10 23:59:00 +00:00
Julian Seward
2cfb6bc855 On AMD64 it's valid to access up to 128 bytes below %rsp. Or to be
more accurate, on the amd64-linux ABI that is allowable.  Anyway,
parameterise the signal handler so it isn't confused by such accesses.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3252
2005-02-25 02:45:39 +00:00
Julian Seward
f224865e9e Fix enough stuff so it will start up and run for a few bbs on amd64,
before dying.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3230
2005-02-05 18:27:14 +00:00
Julian Seward
efcf1e61ec Complete rewrite (I think this is the 4th incarnation) of translation
table/cache management.  Two main changes.  (1) Translation areas are
recorded using VexGuestExtents, so that Vex is now properly supported
and code deletion works correctly.  (2) Low overhead BB profiling,
enabled by the --profile-flags=<XXXXXXXX> option.  This finds the top
N bbs at exit and shows them, so as to give a basis from which to do
performane tuning.

To support this, the way tt/tc work is changed.  It is still a
sectored arrangement, but now each sector has its own hash table.
This simplifies a lot of things.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3226
2005-01-19 11:55:34 +00:00
Julian Seward
4102989396 Run x86 host with FPU in 53-bit precision mode (non default).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3218
2005-01-10 16:51:14 +00:00
Julian Seward
92896c91a1 Add Valgrind-side support for subarchitecture descriptions, which are
tedious but necessary to support.  Also, get rid of the have_ssestate
variable.  The new valgrind will not work on x86s which do not have at
least fxsave/fxrstor available; this rules all CPUs prior to Pentium
II.  No big deal.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3210
2004-12-21 01:20:49 +00:00
Julian Seward
9e2b15ef84 Move x86-TLS specific stuff out of x86/state.c, back into
x86-linux/tls.c.  Also some other cleanups.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3194
2004-12-13 13:14:05 +00:00
Julian Seward
bf737faf0c Split up the old x86 LDT/GDT handling stuff. Push some of it into
VEX, and clean up the rest of it and push it into
coregrind/x86/state.c.  coregrind/x86-linux/ldt.c is now empty, but I
see that some of the stuff in x86/state.c should really be in
x86-linux/ldt.c.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3193
2004-12-13 10:52:08 +00:00
Julian Seward
2d5d04c3d1 Ensure host CPU is in the state that VEX-generated code expects prior
to running any such code.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3182
2004-12-06 14:23:28 +00:00
Julian Seward
4c5b50284b Set host FPU mode to the default mode expected by VEX generated code.
ToDo: set SSE control word correctly too, and also D flag.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3179
2004-12-04 01:45:56 +00:00
Nicholas Nethercote
ce2585d447 Changed message at the top of files, and the startup message, and the
string in valgrind.pc.in, so that they describe Valgrind as a "dynamic
binary instrumentation framework", and don't mention platforms at all.  

I had to tweak the regtest filters a bit for this.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3178
2004-12-01 14:14:42 +00:00
Nicholas Nethercote
cc7e5987be Un-hardwired x86 as the insn set to be translated. Also moved around
some constants.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3172
2004-11-30 23:39:13 +00:00
Nicholas Nethercote
b4421b93e7 Implemented the dispatch loop for AMD64. Works at least enough to do
through once, failing to find the translation, and falling back to the
scheduler.

Did a couple of minor associated cleanups too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3171
2004-11-30 23:32:01 +00:00
Nicholas Nethercote
c4b75e59c9 Move VG_(have_ssestate) out of core and into coregrind/x86/.
Also fixed up out-of-date comments for run_innerloop.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3167
2004-11-30 17:27:21 +00:00
Nicholas Nethercote
ad1bf0073e Clear a few more AMD64 start-up hurdles:
- implemented VG_(clone)()
- implemented PLATFORM_DO_MMAP()
- implemented VG_(init_thread1state)()  [will need to be updated as the
  Vex AMD64 guest state is updated]
- implemented OYNK, because it's useful

Also a couple of general cleaning up things.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3165
2004-11-30 16:04:58 +00:00
Julian Seward
5f69115af9 Comment-only change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3155
2004-11-30 11:18:57 +00:00
Nicholas Nethercote
decc1ddb43 Implemented jmp_with_stack for AMD64. Cleaned up the
comments/formatting of jmp_with_stack for ARM and x86, too.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3149
2004-11-29 17:59:00 +00:00
Nicholas Nethercote
61fcb2828d Gave VG_(do_syscall)() a more specific prototype:
Int VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord );

to replace the previous:
  
  Int VG_(do_syscall) ( UInt, ... )

Reason being that sometimes you could get incorrect args passed, when
passing 32-bit ints on 64-bit platforms.  I also added macros
VG_(do_syscall[123456]) to make life easier, and converted all the
relevant calls.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3143
2004-11-29 16:49:18 +00:00
Nicholas Nethercote
146a07a91f Remove string "panic_msg_ebp" from x86/dispatch.S and amd64/dispatch.S,
as it is never used.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3138
2004-11-29 14:44:09 +00:00
Nicholas Nethercote
10b4595add Added beginnings of an AMD64 port, so lots of new files and directories.
It compiles, but aborts immediately if you try to run it.

I didn't include ldt.c;  I'm not sure how the LDT is used on AMD64.  It can be
added later if necessary.

While doing this, did some 64-bit cleanness fixes:
- Added necessary intermediate casts to ULong to avoid warnings when converting
  ThreadId to void* and vice versa, in vg_scheduler.c.
- Fixed VALGRIND_NON_SIMD_CALL[0123] to use 'long' as the return type.
- Fixed VALGRIND_PRINTF{,BACKTRACE} to use unsigned longs instead of unsigned
  ints, as needed.
- Converted some offsets in vg_symtab2.h from "Int" to "OffT".
- Made strlen, strncat, etc, use SizeT instead of 'unsigned int' for the length
  parameter.
- Couple of other minor things.

I had to insert some "#ifdef __amd64__" and "#ifndef __amd64__" guards in
places.  In particular, in vg_mylibc.c, some of our syscall wrappers aren't
appropriate for AMD64 because the syscall numbering is a bit different in
places.  This difference will have to be abstracted out somehow.

Also rewrote the sys_fcntl and sys_fcntl64 wrappers, as required for AMD64.

Also moved the ipc wrapper into x86, since it's not applicable for
AMD64.  However, it is applicable (I think) for ARM, so it would be nice
to work out a way to share syscall wrappers between some, but not all,
archs.  Hmm.  Also now using the real IPC constants rather than magic
numbers in the wrapper.

Other non-AMD64-related fixes:
- ARM: fixed syscall table by accounting for the fact that syscall
  numbers don't start at 0, but rather at 0x900000.
- Converted a few places to use ThreadId instead of 'int' or 'Int' for
  thread IDs.
- Added both AMD64 and ARM (which I'd forgotten) entries to valgrind.spec.in.
- Tweaked comments in various places.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3136
2004-11-29 13:54:10 +00:00
Julian Seward
86ef8a5a44 Get rid of all vestiges of translation-chaining, and generally clean
up and paranoidise the translation cache management.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3134
2004-11-28 16:58:05 +00:00
Nicholas Nethercote
9ed618d3c2 Nuke some defunct constants.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3125
2004-11-27 15:28:44 +00:00
Nicholas Nethercote
5cc18c19a2 Moved the variable VGOFF_(m_eip) from x86, and moved it (and its
computation) into the generic core, because it's needed by the dispatch
loop of all archs.  Also renamed it VG_(instr_ptr_offset), which is
clearer.  Since it was the last use of the VGOFF_ prefix, I removed that
prefix.  

Also cleaned up the ARM stubs slightly, by removing some of the copied,
commented-out x86 code which has since fallen out of date with the real
x86 code and was thus misleading.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3123
2004-11-27 14:27:21 +00:00
Nicholas Nethercote
6677759f45 Rename $VG_ARCH/signal.c and $VG_ARCH/signals.c, to make
coregrind/vg_signals.c.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3121
2004-11-27 13:37:33 +00:00
Nicholas Nethercote
e8c0f0e619 Disable core dumps, and remove the previous attempts at factoring out
the arch-specific bits, which were just plain wrong.  This is a problem for a
later day.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3115
2004-11-26 14:07:24 +00:00
Nicholas Nethercote
dc4ad41b16 Rename arch_thread_aux_t --> ThreadArchAux, to match ThreadArchState.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3111
2004-11-26 12:44:19 +00:00
Nicholas Nethercote
3004b39874 Remove now-unnecessary macro.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3099
2004-11-24 18:58:41 +00:00
Nicholas Nethercote
efed8e4671 Removed shadow_regs 'need', because it was being used only trivially in
a couple of places, and is no longer needed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3096
2004-11-24 16:57:16 +00:00
Nicholas Nethercote
398ce0c269 Cleanups, mostly for the baseBlock removal.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3095
2004-11-24 16:43:43 +00:00
Nicholas Nethercote
feb4fbaef5 Removed all uses of register numbers (eg. arch-specific ones like R_EAX, and
arch-neutral ones like R_STACK_PTR).  Where they were used, we now always talk
about an offset into the Vex guest state, and an offset.  As a result,
the shadow register get/set functions had to change.  They now also use
an offset and size, and in an arch-neutral way.

Also, I combined the five the post_reg_write* functions into a single one that
takes a 'CorePart' parameter (plus also a ThreadId).  Also, I added more
arguments (the CorePart, and the ThreadId) to the post_mem_write event, for
consistency with the pre_mem_* events.

Also, I reduced the number of register names that must be specified by each
arch, by factoring out duplication; and shortened their names for the core (eg.
ARCH_STACK_PTR is now STACK_PTR).

Plus some related minor cleanups in syscall wrappers.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3094
2004-11-24 16:30:22 +00:00
Nicholas Nethercote
ef30c84f5f Update comments for the renaming of arch_thread_t.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3092
2004-11-24 10:55:37 +00:00
Julian Seward
3558db91b1 Get rid of baseBlock. Now, when generated code is running, the guest
state pointer points directly at the ThreadState.arch.vex field, thus
updating it in place and avoiding a lot of code (and time-wasting)
which copies stuff back and forth to baseBlock.

Fix zillions of other places in the system where the current thread id
is needed.  It is now passed to all needed places.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3090
2004-11-24 10:44:19 +00:00
Nicholas Nethercote
a228498ff4 Comment-only changes.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3087
2004-11-23 18:19:29 +00:00
Julian Seward
8b477e3dd8 Get rid of the high/low baseblock distinction. Pointless in a way
since baseblock itself will soon enough bite the dust.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3078
2004-11-23 00:50:25 +00:00
Julian Seward
f91c2f24bb Get rid of the machinery for registering helper functions. VEX calls
them directly.




git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3077
2004-11-23 00:40:33 +00:00
Julian Seward
fd3934e1e5 Fix some linking problems which were preventing memcheck from starting.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3069
2004-11-22 20:51:49 +00:00
Julian Seward
b3498dd85c Merge in enough changes from the old Vex tree to make stage2 link, at
least.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3061
2004-11-22 19:01:47 +00:00
Nicholas Nethercote
bfcadc611a Make computations more understandable.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2933
2004-11-04 19:40:59 +00:00
Nicholas Nethercote
64aaf7be92 comment wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2932
2004-11-04 19:39:14 +00:00
Nicholas Nethercote
7b5bf879ea More minor 64-bit cleanness tweaks.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2931
2004-11-04 19:38:14 +00:00
Nicholas Nethercote
b48ba617e0 Don't need to use addr_t anymore, use Addr instead, for consistency.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2897
2004-11-01 18:38:00 +00:00
Nicholas Nethercote
c4cf15dc21 Arch-abstraction:
- Added include/x86-linux/ and include/linux/ subdirectories, with Makefile.am
  files.

- Overhauled the definitions of kernel types.  include/vg_kerneliface.h is now
  three files, include/linux/vki.h, include/x86-linux/vki_arch.h, and
  include/x86-linux/vki_arch_posixtypes.h.  These files separate the
  common/Linux and x86/Linux parts cleanly.  All code is copied verbatim from
  the relevant kernel headers, except that VKI_/vki_ prefixes are added as
  necessary to distinguish them from glibc types.  (This is done consistently,
  unlike previously when some types did not have the prefixes.)

  All code is clearly marked to show which particular header file it came from,
  and the Linux version used.  (I used 2.6.8.1, the most recent stable release,
  for all of them.)

  A few of the types changed;  this is because they changed between the older
  versions of Linux and the current 2.6.8.1.  I checked that all these changes
  were ok with respect to backwards compatibility for our purposes.

- vg_unsafe.h has been removed;  we are no longer including any kernel headers,
  as we have our own copies for everything.  This is because installed kernel
  headers are not reliable, and often cause compilation problems. (bug
  #92420 is a recent example)

- Removed some no-longer-needed header-presence tests from configure.in.

- Some code in the rest of Valgrind was changed to account for some slight
  changes in the names of our VKI_/vki_ kernel constants and types.

- Updated README_MISSING_SYSCALL_OR_IOCTL accordingly.

- Fixed off-by-one error with VKI_GDT_ENTRY_TLS_MAX (merged from stable branch)

The end result is that the kernel types situation should be much clearer, and
similar files can be created relatively easily for other architectures as
necessary.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2884
2004-10-31 18:48:21 +00:00
Nicholas Nethercote
bde2037a6b whoops, unbreak build
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2853
2004-10-26 15:04:39 +00:00
Nicholas Nethercote
4cc49991bd comment wibble
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2847
2004-10-26 11:24:29 +00:00
Nicholas Nethercote
70a543e5a1 Arch-abstraction:
- move some asm things into x86/
- also added a check at the start of init_tt_tc() to make sure that
  VG_CODE_OFFSET is correct.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2846
2004-10-26 11:18:32 +00:00
Nicholas Nethercote
6977665bc5 comment wibbles
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2840
2004-10-25 20:21:47 +00:00
Tom Hughes
9c4b27a325 Actually call VGA_(has_tls) rather than just testing the function
address - this replaces Nick's replacing of the has_tls call with
an inline version.

BUG: 91844


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2832
2004-10-25 16:59:46 +00:00
Nicholas Nethercote
e0794e279c Fix for 91844...
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2827
2004-10-25 11:25:22 +00:00
Nicholas Nethercote
d1f87f21f0 Arch-abstraction:
- Make Helgrind totally arch-agnostic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2815
2004-10-20 10:58:09 +00:00
Nicholas Nethercote
3e21a5a1fd Whoops, syscall.S is platform-specific, and so must go in x86-linux/ rather
than x86/.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2800
2004-10-19 14:23:46 +00:00