Removed 6 global variables from vg_include.h without even having to add
anything, just by moving VG_(helper_offset)() from vg_from_ucode.c to
vg_main.c.
Factor out differences between VG_(system) and PRE(execve). Required moving
mash_colon_env() from vg_syscalls.c to vg_mylibc.c. Saved 20 lines of code.
Removed cruft from vg_scheduler.c:
� things not used any more, eg. global variables
- removed some things from vg_include.h, making them local -- functions,
variables and macros
- other minor clean-ups
Cleaned up vg_include.h:
- removed various things that are no longer used
- made (module-)local some things that were global
- improved the formatting in places
Removed about 160 lines of code, and non-trivially reduced the number
of global entities.
Restructured the as_*() functions so they are simpler and there is no implicit
global state -- the state is threaded explicitly through via function arguments
and return values. ume.c now has no global variables, which is nice.
Also removed a redundant as_pad() call in stage2's main() which meant
layout_client_space() could be merged with layout_remaining_space().
Also removed a couple of no-longer-used variables and #defines.
Tom Hughes [Thu, 29 Jul 2004 22:40:07 +0000 (22:40 +0000)]
Modify the ipc system call so that only those calls which may block
are treated as blocking.
This fixes bug #86000 because shmat is no longer treated as blocking
and it is therefore no longer possible for two threads to try and use
the same address for the shared memory segment.
Tom Hughes [Thu, 29 Jul 2004 17:44:23 +0000 (17:44 +0000)]
Add support for allowing the POST function for a system call to be called
even when the system call fails, and allow the PRE function to modify the
system call flags.
Also fix nanosleep so that it only marks the returned time as defined
if the system call exited with EINTR due to be interrupted.
Fix the skiplist brokenness Nick found:
- use a simple memset to initialize the next pointer vector
- fix some previously unexercised code as a result of the above
Still haven't verified we're actually getting skipping, but it doesn't
crash with a make regtest.
Er, actually make this test meaningful. It now aborts correctly if you try to
launch stage2 directly, rather than giving an obscure error about the tool
later on.
Tom Hughes [Sun, 25 Jul 2004 15:43:00 +0000 (15:43 +0000)]
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.
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.
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.
Add a bunch of asserts to check the results of calls to system malloc().
Assertions are arguably not the right thing here, but the practice is
widespread and we're not planning on making asserts optional, and it's a lot
better than no checking.
2.1.2 is imminent. I've tried to find all the changes since 2.1.1 and
list them here. (Reading 4 months worth of commit logs is sooo
fascinating :-) Please let me know asap of anything I've forgotten or
been erroneous on.
Tom Hughes [Thu, 15 Jul 2004 23:13:37 +0000 (23:13 +0000)]
Implement support for the async I/O system calls in 2.6 kernels. This
requires padding of the address space around calls to io_setup in order
to constrain the kernel's choice of address for the I/O context.
Based on patch from Scott Smith <scott-kde@gelatinous.com> with various
enhancements, this fixes bug #83060.
This commit fixes things so that the client stack can be easily placed
anywhere, even below the client executable, just by changing a single
assignment to VG_(clstk_end). I haven't actually moved the stack, though.
Merged Valgrind's heap and stack. This has two main advantages:
1. It simplifies various things a bit.
2. Valgrind/tools will run out of memory later than currently in many
circumstances. This is good news esp. for Calltree.
Some things were going in V's 128MB heap, and some were going in V's 128MB map
segment. Now all these things are going into a single 256MB map segment.
stage2 has been moved down to 0xb0000000, the start of the 256MB map segment.
The .so files needed by it are placed at 0xb1000000 (that's the map_base).
This required some bootstrapping at startup for memory -- we need to allocate
memory to create the segments skip-list which lets us allocate memory...
solution was to make the first superblock allocated a special static one.
That's pretty simple and enough to get things going.
Removed vg_glibc.c which wasn't doing anything anyway.
Removed VG_(brk) and associated stuff, made all the things that were calling it
call VG_(mmap)() instead.
Removed VG_(valgrind_mmap_end) which was no longer needed.
Rejigged the startup order a bit as necessary.
Moved an important comment from ume.c to vg_main.c where it should be.
A few changes:
- removed an unnecessary VG_(unmap_range)() call in do_brk() -- the
VG_(munmap)() just before it does it anyway.
- inlined mprotect_segment() and munmap_segment() because it's more concise and
easier to understand that way.
- a couple of minor formatting changes
- added and cleaned up a couple of comments
Removed the 'place-holder' behaviour of VG_(mmap). Previously, VG_(mmap) would
add a segment mapping to the segment skip-list, and then often the caller of
VG_(mmap) would do another one for the same segment, just to change the SF_*
flags. Now VG_(mmap) gets passed the appropriate SF_* flags so it can do it
directly. This results in shorter, simpler code, and less work at runtime.
Also, strengthened checking in VG_(mmap), POST(mmap), POST(mmap2) -- now if the
result is not in the right place, it aborts rather than unmapping and
continuing. This is because if it's not in the right place, something has
gone badly wrong.