aboutsummaryrefslogtreecommitdiff
path: root/include/pub_tool_aspacemgr.h
diff options
context:
space:
mode:
authorsewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2005-09-27 19:20:21 +0000
committersewardj <sewardj@a5019735-40e9-0310-863c-91ae7b9d1cf9>2005-09-27 19:20:21 +0000
commit45f4e7c91119c7d01a59f5e827c67841632c9314 (patch)
treecf3699fede5e2136f3141b32b7d0324a39aa726d /include/pub_tool_aspacemgr.h
parent1df54d2464f181a989638ef4307152482c2ad395 (diff)
downloadvalgrind-45f4e7c91119c7d01a59f5e827c67841632c9314.tar.gz
This commit merges in changes from branches/ASPACEM (specifically,
changes from r4341 through r4787 inclusive). That branch is now dead. Please do not commit anything else to it. For the most part the merge was not troublesome. The main areas of uncertainty are: - build system: I had to import by hand Makefile.core-AM_CPPFLAGS.am and include it in a couple of places. Building etc seems to still work, but I haven't tried building the documentation. - syscall wrappers: Following analysis by Greg & Nick, a whole lot of stuff was moved from -generic to -linux after the branch was created. I think that is satisfactorily glued back together now. - Regtests: although this appears to work, no .out files appear, which is strange, and makes it hard to diagnose regtest failures. In particular memcheck/tests/x86/scalar.stderr.exp remains in a conflicted state. - amd64 is broken (slightly), and ppc32 will be unbuildable. I'll attend to the former shortly. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4789 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'include/pub_tool_aspacemgr.h')
-rw-r--r--include/pub_tool_aspacemgr.h115
1 files changed, 102 insertions, 13 deletions
diff --git a/include/pub_tool_aspacemgr.h b/include/pub_tool_aspacemgr.h
index 92c102f87..51240bb3d 100644
--- a/include/pub_tool_aspacemgr.h
+++ b/include/pub_tool_aspacemgr.h
@@ -31,21 +31,110 @@
#ifndef __PUB_TOOL_ASPACEMGR_H
#define __PUB_TOOL_ASPACEMGR_H
-extern Bool VG_(is_client_addr) (Addr a);
-extern Bool VG_(is_shadow_addr) (Addr a);
-
-extern void *VG_(shadow_alloc)(UInt size);
-
-extern Bool VG_(is_addressable)(Addr p, SizeT sz, UInt prot);
-
-/* Calls into the core used by leak-checking */
-
-/* Calls "add_rootrange" with each range of memory which looks like a
- plausible source of root pointers. This is very Memcheck-specific --
- it's used in leak detection.
+//--------------------------------------------------------------
+// Definition of address-space segments
+
+/* Describes segment kinds. */
+typedef
+ enum {
+ SkFree, // unmapped space
+ SkAnonC, // anonymous mapping belonging to the client
+ SkAnonV, // anonymous mapping belonging to valgrind
+ SkFileC, // file mapping belonging to the client
+ SkFileV, // file mapping belonging to valgrind
+ SkResvn // reservation
+ }
+ SegKind;
+
+/* Describes how a reservation segment can be resized. */
+typedef
+ enum {
+ SmLower, // lower end can move up
+ SmFixed, // cannot be shrunk
+ SmUpper // upper end can move down
+ }
+ ShrinkMode;
+
+/* Describes a segment. Invariants:
+
+ kind == SkFree:
+ // the only meaningful fields are .start and .end
+
+ kind == SkAnon{C,V}:
+ // smode==SmFixed
+ // there's no associated file:
+ dev==ino==foff = 0, fnidx == -1
+ // segment may have permissions
+
+ kind == SkFile{C,V}:
+ // smode==SmFixed
+ moveLo == moveHi == NotMovable, maxlen == 0
+ // there is an associated file
+ // segment may have permissions
+
+ kind == SkResvn
+ // the segment may be resized if required
+ // there's no associated file:
+ dev==ino==foff = 0, fnidx == -1
+ // segment has no permissions
+ hasR==hasW==hasX==anyTranslated == False
+
+ Also: anyTranslated==True is only allowed in SkFileV and SkAnonV
+ (viz, not allowed to make translations from non-client areas)
*/
-extern void VG_(find_root_memory)(void (*add_rootrange)(Addr addr, SizeT sz));
+typedef
+ struct {
+ SegKind kind;
+ /* Extent (SkFree, SkAnon{C,V}, SkFile{C,V}, SkResvn) */
+ Addr start; // lowest address in range
+ Addr end; // highest address in range
+ /* Shrinkable? (SkResvn only) */
+ ShrinkMode smode;
+ /* Associated file (SkFile{C,V} only) */
+ UWord dev;
+ UWord ino;
+ ULong offset;
+ Int fnIdx; // file name table index, if name is known
+ /* Permissions (SkAnon{C,V}, SkFile{C,V} only) */
+ Bool hasR;
+ Bool hasW;
+ Bool hasX;
+ Bool hasT; // True --> translations have (or MAY have)
+ // been taken from this segment
+ Bool isCH; // True --> is client heap (SkAnonC ONLY)
+ /* Admin */
+ Bool mark;
+ }
+ NSegment;
+
+
+/* Collect up the start addresses of all non-free, non-resvn segments.
+ The interface is a bit strange in order to avoid potential
+ segment-creation races caused by dynamic allocation of the result
+ buffer *starts.
+
+ The function first computes how many entries in the result
+ buffer *starts will be needed. If this number <= nStarts,
+ they are placed in starts[0..], and the number is returned.
+ If nStarts is not large enough, nothing is written to
+ starts[0..], and the negation of the size is returned.
+
+ Correct use of this function may mean calling it multiple times in
+ order to establish a suitably-sized buffer. */
+extern Int VG_(am_get_segment_starts)( Addr* starts, Int nStarts );
+
+
+// See pub_core_aspacemgr.h for description.
+extern NSegment* VG_(am_find_nsegment) ( Addr a );
+
+// See pub_core_aspacemgr.h for description.
+extern Bool VG_(am_is_valid_for_client) ( Addr start, SizeT len,
+ UInt prot );
+
+// See pub_core_aspacemgr.h for description.
+/* Really just a wrapper around VG_(am_mmap_anon_float_valgrind). */
+extern void* VG_(am_shadow_alloc)(SizeT size);
#endif // __PUB_TOOL_ASPACEMGR_H