-add_includes = -I$(top_builddir)/coregrind -I$(top_srcdir)/coregrind \
+# we need $(top_builddir)/include for when builddir != srcdir, because
+# valgrind.h is generated from valgrind.h.in.
+add_includes = -I$(top_srcdir)/coregrind \
-I$(top_srcdir) \
-I$(top_srcdir)/coregrind/$(VG_ARCH) \
- -I$(top_builddir)/coregrind/$(VG_ARCH) \
-I$(top_srcdir)/coregrind/$(VG_OS) \
-I$(top_srcdir)/coregrind/$(VG_PLATFORM) \
- -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/include/$(VG_ARCH) \
- -I$(top_srcdir)/include/$(VG_OS) \
- -I$(top_srcdir)/include/$(VG_PLATFORM) \
+ -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
-I@VEX_DIR@/pub \
-DVGA_$(VG_ARCH)=1 \
-DVGO_$(VG_OS)=1 \
-## Need $(top_builddir)/include because tool.h is built from tool.h.base;
-## otherwise it will not work if builddir != srcdir.
-add_includes = -I$(top_builddir)/include -I$(top_srcdir)/include \
- -I$(top_srcdir)/include/$(VG_ARCH) \
- -I$(top_srcdir)/include/$(VG_OS) \
- -I$(top_srcdir)/include/$(VG_PLATFORM) \
- -I@VEX_DIR@/pub
+# we need $(top_builddir)/include for when builddir != srcdir, because
+# valgrind.h is generated from valgrind.h.in.
+add_includes = -I$(top_srcdir)/include \
+ -I$(top_builddir)/include \
+ -I@VEX_DIR@/pub \
+ -DVGA_$(VG_ARCH)=1 \
+ -DVGO_$(VG_OS)=1 \
+ -DVGP_$(VG_ARCH)_$(VG_OS)=1
AM_CPPFLAGS = $(add_includes)
AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g @ARCH_TOOL_AM_CFLAGS@
tests/unused/Makefile
include/valgrind.h
include/Makefile
- include/amd64/Makefile
- include/arm/Makefile
- include/x86/Makefile
- include/linux/Makefile
- include/amd64-linux/Makefile
- include/arm-linux/Makefile
- include/x86-linux/Makefile
auxprogs/Makefile
coregrind/Makefile
coregrind/m_aspacemgr/Makefile
#define __AMD64_CORE_ARCH_H
#include "core_arch_asm.h" // arch-specific asm stuff
-#include "tool_arch.h" // arch-specific tool stuff
#include "libvex_guest_amd64.h"
#define __ARM_CORE_ARCH_H
#include "core_arch_asm.h" // arch-specific asm stuff
-#include "tool_arch.h" // arch-specific tool stuff
#include "libvex_guest_arm.h"
#ifndef __CORE_H
#define __CORE_H
-/*
- [This comment is not longer accurate -- we're switching to an easier to
- understand module-based approach, with one or two headers per module,
- rather than having monolithic headers as described. --njn 07-May-2005]
-
- Header hierarchy:
-
- - core C files include core.h
- - core asm files include core_asm.h
- - tool C files include tool.h
- - tool asm files include tool_asm.h
-
- - The hierarchy of the header files themselves is based around the
- following rules:
-
- - core headers include tool headers
- - generic headers include arch/OS/platform headers
- - C headers include asm headers
-
- This gives the following hierarchy (only showing 'arch' headers, not
- 'os' or 'platform' headers), where arrows indicate inclusion, and
- $VG_ARCH==x86:
-
-
- (include/x86/tool_arch_asm.h?) <----- coregrind/x86/core_arch_asm.h
- ^ ^ ^ ^
- / \ / \
- / \ / \
- / \ / \
- include/tool_asm.h <-\---- coregrind/core_asm.h \
- ^ \ ^ \
- \ include/x86/tool_arch.h <--------coregrind/x86/core_arch.h
- \ ^ \ ^
- \ / \ /
- \ / \ /
- \ / \ /
- include/tool.h <------------ coregrind/core.h
-
-
- Note that core.h contains the *declarations* of arch-specific functions
- and variables, which can be used by the core_arch.h file of any
- architecture. (The functions/variables are *defined* within arch/.)
- However, arch-specific macros and types cannot go into core.h, because
- there is no separation between declaration and definition for
- macros/types, so they instead go into $VG_ARCH/core_arch.h.
-
- The tool-specific headers are all in include/ so they can be seen by any
- external tools.
-*/
-
#include "tool.h" // tool stuff
#include "core_arch.h" // arch-specific stuff, eg. x86/core_arch.h
#define __X86_CORE_ARCH_H
#include "core_arch_asm.h" // arch-specific asm stuff
-#include "tool_arch.h" // arch-specific tool stuff
#include "libvex_guest_x86.h"
-SUBDIRS = $(VG_ARCH) $(VG_OS) $(VG_PLATFORM) .
-DIST_SUBDIRS = $(VG_ARCH_ALL) $(VG_OS_ALL) $(VG_PLATFORM_ALL) .
-
EXTRA_DIST = \
valgrind.h.in \
vg_profile.c
incincdir = $(includedir)/valgrind
incinc_HEADERS = \
- basic_types.h \
- tool.h \
- tool_asm.h \
- pub_tool_errormgr.h \
- pub_tool_execontext.h \
- pub_tool_hashtable.h \
- pub_tool_mallocfree.h \
- pub_tool_replacemalloc.h\
- pub_tool_skiplist.h \
- pub_tool_stacktrace.h \
- pub_tool_tooliface.h \
- valgrind.h
+ basic_types.h \
+ tool.h \
+ tool_asm.h \
+ pub_tool_errormgr.h \
+ pub_tool_execontext.h \
+ pub_tool_hashtable.h \
+ pub_tool_mallocfree.h \
+ pub_tool_replacemalloc.h \
+ pub_tool_skiplist.h \
+ pub_tool_stacktrace.h \
+ pub_tool_tooliface.h \
+ valgrind.h \
+ vki-linux.h \
+ vki-amd64-linux.h \
+ vki-x86-linux.h \
+ vki_posixtypes-amd64-linux.h \
+ vki_posixtypes-x86-linux.h
BUILT_SOURCES = valgrind.h
CLEANFILES = valgrind.h
+++ /dev/null
-incincdir = $(includedir)/valgrind/amd64-linux
-
-incinc_HEADERS = \
- vki_arch.h \
- vki_arch_posixtypes.h
+++ /dev/null
-incincdir = $(includedir)/valgrind/amd64
-
-incinc_HEADERS = tool_arch.h
-
+++ /dev/null
-/*--------------------------------------------------------------------*/
-/*--- amd64/tool_arch.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Nicholas Nethercote
- njn@valgrind.org
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __AMD64_TOOL_ARCH_H
-#define __AMD64_TOOL_ARCH_H
-
-
-#define VGA_REGPARM(n) /* */
-
-
-#define VGA_MIN_INSTR_SZB 1
-#define VGA_MAX_INSTR_SZB 16
-
-
-/* How many bytes below the stack pointer are validly addressible?
- On amd64, the answer is: 128.
-*/
-#define VGA_STACK_REDZONE_SZB 128
-
-
-#endif // __AMD64_TOOL_ARCH_H
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
+++ /dev/null
-incincdir = $(includedir)/valgrind/arm
-
-incinc_HEADERS = tool_arch.h
-
+++ /dev/null
-/*--------------------------------------------------------------------*/
-/*--- arm/tool_arch.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Nicholas Nethercote
- njn@valgrind.org
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __ARM_TOOL_ARCH_H
-#define __ARM_TOOL_ARCH_H
-
-/*====================================================================*/
-/*=== Registers, etc ===*/
-/*====================================================================*/
-
-#define VGA_REGPARM(n)
-
-#define VGA_MIN_INSTR_SZB 4
-#define VGA_MAX_INSTR_SZB 4
-
-#endif // __ARM_TOOL_ARCH_H
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/
#include "basic_types.h"
#include "tool_asm.h" /* asm stuff */
-#include "tool_arch.h" /* arch-specific tool stuff */
-#include "vki.h"
#include "pub_tool_errormgr.h" // needed for 'Error', 'Supp'
#include "pub_tool_execontext.h" // needed for 'ExeContext'
#include "libvex.h"
#include "libvex_ir.h"
+#if defined(VGO_linux)
+# include "vki-linux.h"
+#else
+# error Unknown OS
+#endif
+
/*====================================================================*/
/*=== Build options and table sizes. ===*/
/*====================================================================*/
extern void VG_(set_shadow_regs_area) ( ThreadId tid, OffT guest_state_offset,
SizeT size, const UChar* area );
+/*====================================================================*/
+/*=== Arch-specific stuff ===*/
+/*====================================================================*/
+
+/* VGA_STACK_REDZONE_SZB: how many bytes below the stack pointer are validly
+ * addressible? */
+#if defined(VGA_x86)
+# define VGA_REGPARM(n) __attribute__((regparm(n)))
+# define VGA_MIN_INSTR_SZB 1
+# define VGA_MAX_INSTR_SZB 16
+# define VGA_STACK_REDZONE_SZB 0
+#elif defined(VGA_amd64)
+# define VGA_REGPARM(n) /* */
+# define VGA_MIN_INSTR_SZB 1
+# define VGA_MAX_INSTR_SZB 16
+# define VGA_STACK_REDZONE_SZB 128
+#elif defined(VGA_arm)
+# define VGA_REGPARM(n) /* */
+# define VGA_MIN_INSTR_SZB 4
+# define VGA_MAX_INSTR_SZB 4
+# define VGA_STACK_REDZONE_SZB 0
+#else
+# error Unknown platform
+#endif
+
#endif /* __TOOL_H */
/*--------------------------------------------------------------------*/
/*--- AMD64/Linux-specific kernel interface. ---*/
-/*--- amd64-linux/vki_arch.h ---*/
+/*--- vki-amd64-linux.h ---*/
/*--------------------------------------------------------------------*/
/*
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __AMD64_LINUX_VKI_ARCH_H
-#define __AMD64_LINUX_VKI_ARCH_H
+#ifndef __VKI_AMD64_LINUX_H
+#define __VKI_AMD64_LINUX_H
// AMD64 is little-endian.
#define VKI_LITTLE_ENDIAN 1
// And that's it!
//----------------------------------------------------------------------
-#endif // __AMD64_LINUX_VKI_ARCH_H
+#endif // __VKI_AMD64_LINUX_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
-/*--- Linux-specific kernel interface. linux/vki.h ---*/
+/*--- Linux-specific kernel interface. vki-linux.h ---*/
/*--------------------------------------------------------------------*/
/*
Also note that this file contains all the generic header info, ie. that
from linux/include/linux/ *.h. The arch-specific header info, eg. that
- from linux/include/asm-i386/ *.h, is in $PLATFORM/vki_arch.h and
- $PLATFORM/vki_arch_posixtypes.h. (Two files are required to avoid
+ from linux/include/asm-i386/ *.h, is in vki-$PLATFORM.h and
+ vki_posixtypes-$PLATFORM.h. (Two files are required to avoid
circular dependencies between the generic VKI header and the
arch-specific VKI header. It's possible in the future, as more stuff
gets pulled in, that we might have to split files up some more to avoid
definitions, which affects some of them.
*/
-#ifndef __LINUX_VKI_H
-#define __LINUX_VKI_H
+#ifndef __VKI_LINUX_H
+#define __VKI_LINUX_H
//----------------------------------------------------------------------
// Arch-specific POSIX types
//----------------------------------------------------------------------
-#include "vki_arch_posixtypes.h"
+#if defined(VGA_x86)
+# include "vki_posixtypes-x86-linux.h"
+#elif defined(VGA_amd64)
+# include "vki_posixtypes-amd64-linux.h"
+#else
+# error Unknown platform
+#endif
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/linux/compiler.h
// Now the rest of the arch-specific stuff
//----------------------------------------------------------------------
-#include "vki_arch.h"
+#if defined(VGA_x86)
+# include "vki-x86-linux.h"
+#elif defined(VGA_amd64)
+# include "vki-amd64-linux.h"
+#else
+# error Unknown platform
+#endif
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/linux/limits.h
#define VKI_PTRACE_PEEKDATA 2
#define VKI_PTRACE_PEEKUSR 3
-#endif // __LINUX_VKI_H
+#endif // __VKI_LINUX_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
-/*--- x86/Linux-specific kernel interface. x86-linux/vki_arch.h ---*/
+/*--- x86/Linux-specific kernel interface. vki-x86-linux.h ---*/
/*--------------------------------------------------------------------*/
/*
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __X86_LINUX_VKI_ARCH_H
-#define __X86_LINUX_VKI_ARCH_H
+#ifndef __VKI_X86_LINUX_H
+#define __VKI_X86_LINUX_H
// x86 is little-endian.
#define VKI_LITTLE_ENDIAN 1
// And that's it!
//----------------------------------------------------------------------
-#endif // __X86_LINUX_VKI_ARCH_H
+#endif // __VKI_X86_LINUX_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
/*--- AMD64/Linux-specific kernel interface: posix types. ---*/
-/*--- amd64-linux/vki_arch_posixtypes.h ---*/
+/*--- vki_posixtypes-amd64-linux.h ---*/
/*--------------------------------------------------------------------*/
/*
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __AMD64_LINUX_VKI_ARCH_POSIXTYPES_H
-#define __AMD64_LINUX_VKI_ARCH_POSIXTYPES_H
+#ifndef __VKI_POSIXTYPES_AMD64_LINUX_H
+#define __VKI_POSIXTYPES_AMD64_LINUX_H
//----------------------------------------------------------------------
// From linux-2.6.9/include/asm-x86_64/posix_types.h
typedef __vki_kernel_uid_t __vki_kernel_uid32_t;
typedef __vki_kernel_gid_t __vki_kernel_gid32_t;
-#endif // __AMD64_LINUX_VKI_ARCH_POSIXTYPES_H
+#endif // __VKI_POSIXTYPES_AMD64_LINUX_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
/*--- x86/Linux-specific kernel interface: posix types. ---*/
-/*--- x86-linux/vki_arch_posixtypes.h ---*/
+/*--- vki_posixtypes-x86-linux.h ---*/
/*--------------------------------------------------------------------*/
/*
The GNU General Public License is contained in the file COPYING.
*/
-#ifndef __X86_LINUX_VKI_ARCH_POSIXTYPES_H
-#define __X86_LINUX_VKI_ARCH_POSIXTYPES_H
+#ifndef __VKI_POSIXTYPES_X86_LINUX_H
+#define __VKI_POSIXTYPES_X86_LINUX_H
//----------------------------------------------------------------------
// From linux-2.6.8.1/include/asm-i386/posix_types.h
int val[2];
} __vki_kernel_fsid_t;
-#endif // __X86_LINUX_VKI_ARCH_POSIXTYPES_H
+#endif // __VKI_POSIXTYPES_X86_LINUX_H
/*--------------------------------------------------------------------*/
/*--- end ---*/
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-incincdir = $(includedir)/valgrind/x86-linux
-
-incinc_HEADERS = \
- vki_arch.h \
- vki_arch_posixtypes.h
+++ /dev/null
-Makefile
-Makefile.in
+++ /dev/null
-incincdir = $(includedir)/valgrind/x86
-
-incinc_HEADERS = tool_arch.h
-
+++ /dev/null
-/*--------------------------------------------------------------------*/
-/*--- x86/tool_arch.h ---*/
-/*--------------------------------------------------------------------*/
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Nicholas Nethercote
- njn@valgrind.org
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#ifndef __X86_TOOL_ARCH_H
-#define __X86_TOOL_ARCH_H
-
-
-#define VGA_REGPARM(n) __attribute__((regparm(n)))
-
-
-#define VGA_MIN_INSTR_SZB 1
-#define VGA_MAX_INSTR_SZB 16
-
-
-/* How many bytes below the stack pointer are validly addressible?
- On x86, the answer is: none.
-*/
-#define VGA_STACK_REDZONE_SZB 0
-
-
-#endif // __X86_TOOL_ARCH_H
-
-/*--------------------------------------------------------------------*/
-/*--- end ---*/
-/*--------------------------------------------------------------------*/