99 Commits

Author SHA1 Message Date
Nicholas Nethercote
bb4598350e Obsoleted three client requests that were still hanging around from the old
libpthread implementation: USERREQ__READ_MILLISECOND_TIMER, USERREQ__MALLOC,
USERREQ__FREE.

As a consequence, all the PTHREQ macros (eg. VGA_PTHREQ_RET,
SET_PTHREQ_RETVAL) could be removed.  And VG_(tl_malloc_called_by_scheduler)
has been renamed VG_(tl_malloc_called_deliberately) to reflect how its role
has changed.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3438
2005-03-26 03:50:14 +00:00
Nicholas Nethercote
66b2b7d5ad Use "VGA_" prefix more consistently.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3434
2005-03-26 00:32:29 +00:00
Nicholas Nethercote
cb6c8b4bd2 Use "VGA_" prefix more consistently for arch-specific things.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3433
2005-03-26 00:18:45 +00:00
Nicholas Nethercote
0f0863110d Rename some arch-specific macros to use the more consistent "VGA_" prefix.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3432
2005-03-26 00:04:03 +00:00
Julian Seward
9d7b4d9ae2 Mucho buggering about jmp_with_stack and its kin. Jeez. Now the
amd64 version is broken again.  Writing code with undocumented
assumptions should be a firable offense.  At the very least.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3402
2005-03-22 01:55:35 +00:00
Julian Seward
973f90f068 Partially unbreak sigcontextings -- hopefully enough that self hosting
works.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3365
2005-03-15 14:48:45 +00:00
Nicholas Nethercote
ba91df6db8 Remove the alignment arg from VG_(arena_calloc)() and VG_(arena_realloc)(),
because it was always being set to VG_MIN_ALLOC_SZB, and so was just one
more thing to get wrong, as well as exposing VG_MIN_ALLOC_SZB to more places
than necessary.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3340
2005-03-13 14:56:31 +00:00
Nicholas Nethercote
05fe123a9e Update copyright notice for 2005 on all relevant files. Don't bother trying
to be selective about it.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3303
2005-03-12 16:22:54 +00:00
Julian Seward
3286b17553 No longer needed. Bye!
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3299
2005-03-12 14:40:38 +00:00
Nicholas Nethercote
29cc7c8a6c Remove dead functions: VG_(set_arg_and_bogus_ret), VG_(thread_initial_stack).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3294
2005-03-12 05:48:06 +00:00
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