mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
From: Ian Campbell <Ian.Campbell@citrix.com> Under Xen the toolstack is responsible for managing the domains in the system, e.g. creating, destroying, and otherwise manipulating them. To do this it uses a number of ioctls on the /proc/xen/privcmd device. Most of these (the MMAPBATCH ones) simply set things up such that a subsequenct mmap call will map the desired guest memory. Since valgrind has no way of knowing what the memory contains we assume that it is all initialised (to do otherwise would require valgrind to be observing the complete state of the system and not just the given process). The most interesting ioctl is XEN_IOCTL_PRIVCMD_HYPERCALL which allows the toolstack to make arbitrary hypercalls. Although the mechanism here is specific to the OS of the guest running the toolstack the hypercalls themselves are defined solely by the hypervisor. Therefore I have split support for this ioctl into a part in syswrap-linux.c which handles the ioctl itself and passes things onto a new syswrap-xen.c which handles the specifics of the hypercalls themselves. Porting this to another OS should just be a matter of wiring up syswrap-$OS.c to decode the ioctl and call into syswrap-xen.c. In the future we may want to split this into syswrap-$ARCH-xen.c but for now this is x86 only. The hypercall coverage here is pretty small but is enough to get reasonable(-ish) results out of the xl toolstack when listing, creating and destroying domains. One issue is that the hypercalls which are exlusively used by the toolstacks (as opposed to those used by guest operating systems) are not considered a stable ABI, since the hypervisor and the lowlevel tools are considered a matched pair. This covers the sysctl and domctl hypercalls which are a fairly large chunk of the support here. I'm not sure how to solve this without invoking a massive amount of duplication. Right now this targets the Xen unstable interface (which will shortly be released as Xen 4.2), perhaps I can get away with deferring this problem until the first change . On the plus side the vast majority of hypercalls are not of interest to the toolstack (they are used by guests) so we can get away without implementing them. Note: a hypercall only reads as many words from the ioctl arg struct as there are actual arguments to that hypercall and the toolstack only initialises the arguments which are used. However there is no space in the DEFN_PRE_TEMPLATE prototype to allow this to be communicated from syswrap-xen.c back to syswrap-linux.c. Since a hypercall can have at most 5 arguments I have hackily stolen ARG8 for this purpose. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12963
Release notes for Valgrind
~~~~~~~~~~~~~~~~~~~~~~~~~~
If you are building a binary package of Valgrind for distribution,
please read README_PACKAGERS. It contains some important information.
If you are developing Valgrind, please read README_DEVELOPERS. It contains
some useful information.
For instructions on how to build/install, see the end of this file.
If you have problems, consult the FAQ to see if there are workarounds.
Executive Summary
~~~~~~~~~~~~~~~~~
Valgrind is a framework for building dynamic analysis tools. There are
Valgrind tools that can automatically detect many memory management
and threading bugs, and profile your programs in detail. You can also
use Valgrind to build new tools.
The Valgrind distribution currently includes six production-quality
tools: a memory error detector, two thread error detectors, a cache
and branch-prediction profiler, a call-graph generating cache abd
branch-prediction profiler, and a heap profiler. It also includes
three experimental tools: a heap/stack/global array overrun detector,
a different kind of heap profiler, and a SimPoint basic block vector
generator.
Valgrind is closely tied to details of the CPU, operating system and to
a lesser extent, compiler and basic C libraries. This makes it difficult
to make it portable. Nonetheless, it is available for the following
platforms:
- X86/Linux
- AMD64/Linux
- PPC32/Linux
- PPC64/Linux
- ARM/Linux
- x86/MacOSX
- AMD64/MacOSX
- S390X/Linux
- MIPS32/Linux
Note that AMD64 is just another name for x86_64, and Valgrind runs fine
on Intel processors. Also note that the core of MacOSX is called
"Darwin" and this name is used sometimes.
Valgrind is licensed under the GNU General Public License, version 2.
Read the file COPYING in the source distribution for details.
However: if you contribute code, you need to make it available as GPL
version 2 or later, and not 2-only.
Documentation
~~~~~~~~~~~~~
A comprehensive user guide is supplied. Point your browser at
$PREFIX/share/doc/valgrind/manual.html, where $PREFIX is whatever you
specified with --prefix= when building.
Building and installing it
~~~~~~~~~~~~~~~~~~~~~~~~~~
To install from the Subversion repository :
0. Check out the code from SVN, following the instructions at
http://www.valgrind.org/downloads/repository.html.
1. cd into the source directory.
2. Run ./autogen.sh to setup the environment (you need the standard
autoconf tools to do so).
3. Continue with the following instructions...
To install from a tar.bz2 distribution:
4. Run ./configure, with some options if you wish. The only interesting
one is the usual --prefix=/where/you/want/it/installed.
5. Run "make".
6. Run "make install", possibly as root if the destination permissions
require that.
7. See if it works. Try "valgrind ls -l". Either this works, or it
bombs out with some complaint. In that case, please let us know
(see www.valgrind.org).
Important! Do not move the valgrind installation into a place
different from that specified by --prefix at build time. This will
cause things to break in subtle ways, mostly when Valgrind handles
fork/exec calls.
The Valgrind Developers
Description
Languages
C
94.6%
Assembly
1.7%
C++
1.1%
Makefile
0.6%
Perl
0.5%
Other
1.4%