Julian Seward [Tue, 17 Oct 2006 02:21:55 +0000 (02:21 +0000)]
Merge r6216:
Fix all the places where gcc complains about casts from pointers
(presumably 64 bit) to integers of different size (in this case,
32-bit int). This makes it compile cleanly on 64-bit AIX and also
means it doesn't crash :-)
Julian Seward [Tue, 17 Oct 2006 02:08:26 +0000 (02:08 +0000)]
Merge r6217 (also comment cosmetics):
Use 'ctr' rather than 'lr' for indirect jumps, so as not to trash the
branch predictor(s) for returns from generated code. Makes a big
difference on ppc970 (and POWER4).
Julian Seward [Tue, 17 Oct 2006 01:52:05 +0000 (01:52 +0000)]
Merge r6149:
Generalise the machinery developed for function intercepts/wrapping
ppc64-linux, in which we have to deal with the big extra complexity
resulting from TOC pointers. This generalises it to work in 32-bit
mode too.
Add helpers to deal with AIX stack redzones.
Track VG_(am_find_nsegment) constness change and other minor
changes to the m_aspacemgr interface.
(All platforms): use the new VexMiscInfo structure to tell VEX about
host and guest ABI conventions.
This module could do with further tidying up and documentation.
Julian Seward [Tue, 17 Oct 2006 01:51:24 +0000 (01:51 +0000)]
Merge r6148:
Minor adjustments to the scheduler, mostly cosmetic.
- rename VG_(kill_thread) to VG_(get_thread_out_of_syscall), which
is what it actually does.
- Remove 'semaphore' terminology in places and use 'lock' instead.
- Give an extra 'HChar* who' arg to VG_(set_running) and
VG_(set_sleeping), which is printed when --trace-sched=yes.
This makes it easier to make sense of lock ownership changes
from the debug output.
- various other improvements to debug printing
- add a kludge to encourage the AIX scheduler to switch threads
more often when more than one is runnable (am not claiming to
understand this); otherwise CPU starvation can appear to happen
- more assertions in sema.c (the pipe-based lock); cycle the token
through 'A' to 'Z' to make strace/truss output more understandable;
fix longstanding bug wherein sema_down() tries to read two bytes
even though sema_up only writes one.
Julian Seward [Tue, 17 Oct 2006 01:48:41 +0000 (01:48 +0000)]
Merge r6142:
Minor enhancements, including dealing with 6-digit PIDs, dealing with
object names of the form "foo.a(bar.o)", and removing debuglog level
zero output.
Julian Seward [Tue, 17 Oct 2006 01:47:30 +0000 (01:47 +0000)]
Merge r6140 (some of):
- track SysRes changes
- track VG_(am_find_nsegment) const-ness change
- increase number of client syscall args supported from 6 to 8
- simplify type SyscallStatus. Simply hold a copy of the SysRes
for the syscall rather than have this be a data structure
incorporating something very similar to the fields of a SysRes,
and more besides. Change various macros in priv_types_n_macros.h
to match.
- syswrap-main.c: instantiate the various impedance-matching
functions for AIX.
Julian Seward [Tue, 17 Oct 2006 01:41:17 +0000 (01:41 +0000)]
Merge r6134:
Accumulate statistics about the number of searches in the errors and
suppressions lists, and rearrange the suppressions list when searching
to reduce cost of future searches.
Julian Seward [Tue, 17 Oct 2006 01:39:30 +0000 (01:39 +0000)]
Merge r6132:
Minor changes for redirection on AIX. The only significant change is
that it now checks for, warns about and disallows, attempts to
redirect to, or wrap with, a function for which no TOC pointer can be
found, since that would be really asking for trouble (a segfault).
Julian Seward [Tue, 17 Oct 2006 01:37:10 +0000 (01:37 +0000)]
Merge r6129:
Changes to support XCOFF:
- allow modules to have 'member names' as well as file names. A member
name is a "foo.o" name inside a "bar.a"; necessary as AIX
keeps all its dynamic libraries in .a files.
- rename the type RiLoc to DiLoc (this holds a line number indication).
No idea why it was called RiLoc in the first place.
Julian Seward [Tue, 17 Oct 2006 01:36:37 +0000 (01:36 +0000)]
Merge r6128:
Interface changes for m_debuginfo:
- new fn VG_(di_aix5_notify_segchange) to notify XCOFF loads/unloads
- new fn VG_(lookup_symbol_SLOW) for looking up the address of a fn
given its name and soname
Julian Seward [Tue, 17 Oct 2006 01:31:58 +0000 (01:31 +0000)]
Merge r6123:
Extensions for unwinding stacks on ppc32-aix5 and ppc64-aix5. Also,
extend the mechanism developed for ppc64-linux for fishing return
addresses out of the thread's redirection-stack when needed.
Julian Seward [Tue, 17 Oct 2006 01:30:47 +0000 (01:30 +0000)]
Merge r6120:
Get rid of VG_(sigtimedwait) and replace it a simpler version,
VG_(sigtimedwait_zero), which polls for signals and returns
immediately. AIX doesn't have a sigtimedwait syscall, so in that case
try and implement VG_(sigtimedwait_zero) using various other signal
syscalls.
Julian Seward [Tue, 17 Oct 2006 01:28:10 +0000 (01:28 +0000)]
Merge r6112:
Changes resulting from porting to AIX5:
- Auxiliary primary map handling has been redone, so that the
performance penalty for hitting memory above the magic 32G limit is
much reduced, and also the number of usable maps is limited only by
how much memory is available. The current code has been tested on
64-bit AIX for processes up to about 8GB in size.
The auxiliary primary maps are now stored in an OSet, "auxmap_L2".
However, looking up in an OSet for each memory reference is
expensive. So the OSet is 'fronted' by 24-entry array which holds
pointers to the 24 most recently used auxiliary primary maps.
Accesses to this array are made faster by incrementally rearranging
it on every lookup (if the requested map is found in the array, it
is moved one element closer to the start of the array).
Logically speaking, auxmap_L1 is a cache of auxmap_L2. The L2-L1
relationship is one of inclusion; iow L2 is not a victim cache.
There is extensive new sanity check code for these structures.
- Along with the auxmap changes are semi-fast cases in mc_LOADVn_slow
and mc_STOREVn_slow. These catch naturally aligned, word-size loads
which fall into addressible memory, and handle them directly rather
than in a byte-by-byte fashion.
- Fix longstanding error with alignment checks in
{new,die}_mem_stack_N. Previously, these checked the alignment of
the new SP value without taking the stack redzone size into account.
This is only safe if the redzone size is 8-aligned. The right thing
to do is check alignment after adding on the redzone size.
- Add a new mechanism which allows specification, on the command line,
of address ranges which memcheck is to 'ignore'. Meaning that it
regards all writes to those ranges as acceptable and all reads from
those ranges as acceptable and returning initialised data. This is
done without disturbing the existing finally-balanced bitmap
machinery. Instead, in mc_record_address_error, just ignore the
error if the address falls inside an ignored-range.
There is a new command-line flag --ignore-ranges= to specify
the address ranges. Currently up to 4 non-overlapping ranges may
be specified.
This kind of thing is useful if you want to do some strange thing
like map a high-performance network card into memory and can't be
bothered to tell memcheck about it through the official channels
(intercepting syscalls/ioctls and telling aspacem about them.)
Julian Seward [Tue, 17 Oct 2006 01:23:07 +0000 (01:23 +0000)]
Merge r6102/6103:
A new module ("Initial Image"), whose purpose is to set up the
client's initial memory and register state before running it. On
Linux this does all the stack/auxv/envp stuff which was previously
done in m_main. On AIX5 the kernel prepares the process' initial
image, so there's nothing to be done there. But LD_PRELOAD doesn't
work on AIX5, so m_initimg sets up the client so as to start by
running a short bit of code which gets the kernel to load in the core
and tool preloads and then start the client.
As a result of this, m_main gets a lot shorter and cleaner.
Julian Seward [Tue, 17 Oct 2006 00:56:43 +0000 (00:56 +0000)]
Merge r6086:
Makefile.am changes for AIX5. Almost all boilerplate stuff fitting in
with the existing factorisation scheme. The only change of interest
is that configure.in now generates automake symbols of name
VGP_platform and VGO_os, whereas previously it just made VG_platform
which was a bit inconsistent with the VGP/VGO/VGA scheme used in C
code.
Julian Seward [Sat, 14 Oct 2006 19:26:10 +0000 (19:26 +0000)]
Create a new module, m_vki, and move all knowledge about the kernel
interface, except for the syscall numbers, into that. Mostly this
means moving include/vki-*.h to include/vki/vki-*.h.
include/pub_tool_basics.h previously dragged in the entire kernel
interface. I've done away with that, so that modules which need to
see the kernel interface now have to include pub_{core,tool}_vki.h
explicitly. This is why there are many modified .c files -- they have
all acquired an extra #include line.
This certainly breaks all platforms except x86. Will fix shortly.
Julian Seward [Sat, 14 Oct 2006 15:51:32 +0000 (15:51 +0000)]
Create a new module, m_vkiscnums, and move all the system call numbers
into that. Mostly this means moving vki_unistd-<plat>.h to
include/vki/vki-scnums-<plat>.h.
This updates the automatic detection of cache parameters
for x86 and amd64 according to revision 21 of
Intels x86 Architecture Software Developer Manual, Volume 2a.
Julian Seward [Thu, 5 Oct 2006 17:59:23 +0000 (17:59 +0000)]
A memory pool update from Graydon Hoare.
Here's an update to the mempool move / change client requests and sanity
checking. The following changes are present:
- Added one more (hopefully last) client request, a predicate to
test whether a mempool anchor address is currently tracked.
It turns out mozilla's arena-using code is sufficiently inconsistent
in its assumptions that it's very difficult to phrase the valgrind
client-request annotations without this request. Namely: sometime
arena-init and arena-free operations are assumed to be idempotent.
- Fixed a very rapid tool-memory leak in the mempool sanity check
routine. The previous version of the patch I posted would use all
memory even on my Very Beefy Test Machine within ~15 minutes of
browsing with firefox.
- Added a little logging code to print the counts of pools and chunks
active every ~10000 sanity checks, when running with -v.