From: Julian Seward Date: Sat, 14 Oct 2006 19:26:10 +0000 (+0000) Subject: Create a new module, m_vki, and move all knowledge about the kernel X-Git-Tag: svn/VALGRIND_3_3_0~650 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae8215b3ac35f6002bc277d683e83ec86a5b3dec;p=thirdparty%2Fvalgrind.git 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. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@6225 --- diff --git a/auxprogs/valgrind-listener.c b/auxprogs/valgrind-listener.c index 4bd3edc379..133cff1052 100644 --- a/auxprogs/valgrind-listener.c +++ b/auxprogs/valgrind-listener.c @@ -46,6 +46,8 @@ #include "pub_core_basics.h" #include "pub_core_libcassert.h" // For VG_BUGS_TO +#include "pub_core_vki.h" // Avoids warnings from + // pub_core_libcfile.h #include "pub_core_libcfile.h" // For VG_CLO_DEFAULT_LOGPORT diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 6d6838703f..92c3c7cbcf 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -30,6 +30,7 @@ */ #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_debuginfo.h" #include "pub_tool_libcbase.h" #include "pub_tool_libcassert.h" diff --git a/callgrind/global.h b/callgrind/global.h index 335de14618..96d3f251c0 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -8,6 +8,7 @@ #define CLG_GLOBAL #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_debuginfo.h" #include "pub_tool_libcbase.h" #include "pub_tool_libcassert.h" diff --git a/coregrind/Makefile.am b/coregrind/Makefile.am index 8d216b3928..b2b0bf5c45 100644 --- a/coregrind/Makefile.am +++ b/coregrind/Makefile.am @@ -108,6 +108,7 @@ noinst_HEADERS = \ pub_core_transtab.h \ pub_core_transtab_asm.h \ pub_core_ume.h \ + pub_core_vki.h \ pub_core_vkiscnums.h \ m_coredump/priv_elf.h \ m_debuginfo/priv_storage.h \ @@ -162,6 +163,7 @@ COREGRIND_SOURCES_COMMON = \ m_translate.c \ m_transtab.c \ m_ume.c \ + m_vki.c \ m_vkiscnums.c \ m_aspacemgr/aspacemgr.c \ m_debuginfo/storage.c \ diff --git a/coregrind/launcher.c b/coregrind/launcher.c index 30ed02d9ef..ab24345e2e 100644 --- a/coregrind/launcher.c +++ b/coregrind/launcher.c @@ -46,6 +46,8 @@ #include #include "pub_core_debuglog.h" +#include "pub_core_vki.h" // Avoids warnings from + // pub_core_libcfile.h #include "pub_core_libcproc.h" // For VALGRIND_LIB, VALGRIND_LAUNCHER #include "pub_core_ume.h" diff --git a/coregrind/m_aspacemgr/aspacemgr.c b/coregrind/m_aspacemgr/aspacemgr.c index 0e857cd134..28c8a46fcf 100644 --- a/coregrind/m_aspacemgr/aspacemgr.c +++ b/coregrind/m_aspacemgr/aspacemgr.c @@ -35,6 +35,7 @@ minimal set of imports. */ #include "pub_core_basics.h" // types +#include "pub_core_vki.h" #include "pub_core_debuglog.h" // VG_(debugLog) diff --git a/coregrind/m_clientstate.c b/coregrind/m_clientstate.c index 2db9299300..fd16cffd8c 100644 --- a/coregrind/m_clientstate.c +++ b/coregrind/m_clientstate.c @@ -31,6 +31,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_clientstate.h" /*-----------------------------------------------------------------*/ diff --git a/coregrind/m_commandline.c b/coregrind/m_commandline.c index c4637f35a5..2d1a83fec5 100644 --- a/coregrind/m_commandline.c +++ b/coregrind/m_commandline.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcassert.h" #include "pub_core_libcbase.h" #include "pub_core_libcfile.h" diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index 814026b699..87fad6f2f2 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_aspacemgr.h" #include "pub_core_libcbase.h" #include "pub_core_machine.h" diff --git a/coregrind/m_coredump/coredump-x86-linux.c b/coregrind/m_coredump/coredump-x86-linux.c index 754df98cc4..ed2f95f956 100644 --- a/coregrind/m_coredump/coredump-x86-linux.c +++ b/coregrind/m_coredump/coredump-x86-linux.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcbase.h" #include "pub_core_coredump.h" #include "pub_core_threadstate.h" diff --git a/coregrind/m_debugger.c b/coregrind/m_debugger.c index 7122be85a1..ae30646bb4 100644 --- a/coregrind/m_debugger.c +++ b/coregrind/m_debugger.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_clientstate.h" #include "pub_core_debugger.h" diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c index d4d34f10e2..23256ac321 100644 --- a/coregrind/m_debuginfo/debuginfo.c +++ b/coregrind/m_debuginfo/debuginfo.c @@ -35,6 +35,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_debuginfo.h" /* self */ #include "pub_core_demangle.h" diff --git a/coregrind/m_debuginfo/readelf.c b/coregrind/m_debuginfo/readelf.c index e3318e6b71..49c0c1a1df 100644 --- a/coregrind/m_debuginfo/readelf.c +++ b/coregrind/m_debuginfo/readelf.c @@ -35,6 +35,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcbase.h" #include "pub_core_libcprint.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index 2fb30f4728..cb71883bc0 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" // For VG_N_THREADS #include "pub_core_debugger.h" #include "pub_core_debuginfo.h" diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index 5e4c5ed05b..1f50fedebe 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index ec455841f5..37bdb07779 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcfile.h" diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 118cad1e3e..e425590405 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_debuglog.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_libcproc.c b/coregrind/m_libcproc.c index 16efd4da1e..b3d17472eb 100644 --- a/coregrind/m_libcproc.c +++ b/coregrind/m_libcproc.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcprint.h" diff --git a/coregrind/m_libcsignal.c b/coregrind/m_libcsignal.c index 39c81cdb96..9e11ed0457 100644 --- a/coregrind/m_libcsignal.c +++ b/coregrind/m_libcsignal.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" #include "pub_core_libcsignal.h" diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c index f0d66301d5..357fbdbd5f 100644 --- a/coregrind/m_machine.c +++ b/coregrind/m_machine.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_libcassert.h" #include "pub_core_libcbase.h" diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 4bb7eea482..207c4edf0b 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_clientstate.h" #include "pub_core_aspacemgr.h" diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index f607eeb038..d1bd9d13fb 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -30,6 +30,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_debuglog.h" #include "pub_core_libcbase.h" #include "pub_core_aspacemgr.h" diff --git a/coregrind/m_replacemalloc/vg_replace_malloc.c b/coregrind/m_replacemalloc/vg_replace_malloc.c index 4d1783c8c9..6d6800a9e1 100644 --- a/coregrind/m_replacemalloc/vg_replace_malloc.c +++ b/coregrind/m_replacemalloc/vg_replace_malloc.c @@ -45,6 +45,7 @@ ------------------------------------------------------------------ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" // VKI_EINVAL, VKI_ENOMEM, VKI_PAGE_SIZE #include "pub_core_clreq.h" // for VALGRIND_INTERNAL_PRINTF, // VALGRIND_NON_SIMD_CALL[12] #include "pub_core_debuginfo.h" // needed for pub_core_redir.h :( diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index c2f4333b8a..6788b29bc2 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -58,6 +58,8 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" +#include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_clreq.h" // for VG_USERREQ__* @@ -81,7 +83,6 @@ #include "pub_core_tooliface.h" #include "pub_core_translate.h" // For VG_(translate)() #include "pub_core_transtab.h" -#include "pub_core_vkiscnums.h" #include "priv_sema.h" /* #include "pub_core_debuginfo.h" */ // DEBUGGING HACK ONLY diff --git a/coregrind/m_scheduler/sema.c b/coregrind/m_scheduler/sema.c index a50e0d0965..bc9fc6924c 100644 --- a/coregrind/m_scheduler/sema.c +++ b/coregrind/m_scheduler/sema.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_libcassert.h" #include "pub_core_libcfile.h" #include "pub_core_libcproc.h" // For VG_(gettid)() diff --git a/coregrind/m_sigframe/sigframe-x86-linux.c b/coregrind/m_sigframe/sigframe-x86-linux.c index a6a50d16b0..6f90460c53 100644 --- a/coregrind/m_sigframe/sigframe-x86-linux.c +++ b/coregrind/m_sigframe/sigframe-x86-linux.c @@ -30,6 +30,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" /* find_segment */ #include "pub_core_libcbase.h" diff --git a/coregrind/m_signals.c b/coregrind/m_signals.c index 3ca1398688..5aabb68e12 100644 --- a/coregrind/m_signals.c +++ b/coregrind/m_signals.c @@ -80,6 +80,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_debuglog.h" #include "pub_core_threadstate.h" #include "pub_core_clientstate.h" diff --git a/coregrind/m_stacktrace.c b/coregrind/m_stacktrace.c index c502a3f5a3..d7d9d165fe 100644 --- a/coregrind/m_stacktrace.c +++ b/coregrind/m_stacktrace.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_debuginfo.h" #include "pub_core_aspacemgr.h" // For VG_(is_addressable)() diff --git a/coregrind/m_syscall.c b/coregrind/m_syscall.c index 2514069f19..721dafaa73 100644 --- a/coregrind/m_syscall.c +++ b/coregrind/m_syscall.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_syscall.h" /* --------------------------------------------------------------------- diff --git a/coregrind/m_syswrap/syswrap-generic.c b/coregrind/m_syswrap/syswrap-generic.c index 3812e19631..19a694e323 100644 --- a/coregrind/m_syswrap/syswrap-generic.c +++ b/coregrind/m_syswrap/syswrap-generic.c @@ -29,6 +29,8 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" +#include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_debuginfo.h" // VG_(di_notify_*) #include "pub_core_aspacemgr.h" @@ -55,8 +57,6 @@ #include "priv_types_n_macros.h" #include "priv_syswrap-generic.h" -#include "pub_core_vkiscnums.h" /* for the __NR_* constants */ - /* Returns True iff address range is something the client can plausibly mess with: all of it is either already belongs to the diff --git a/coregrind/m_syswrap/syswrap-linux-variants.c b/coregrind/m_syswrap/syswrap-linux-variants.c index a4cdcca314..d805d1f8ab 100644 --- a/coregrind/m_syswrap/syswrap-linux-variants.c +++ b/coregrind/m_syswrap/syswrap-linux-variants.c @@ -46,6 +46,7 @@ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_debuginfo.h" // VG_(di_notify_*) diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index de5e7371d2..cd46345747 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -29,6 +29,8 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" +#include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_aspacemgr.h" #include "pub_core_debuginfo.h" // VG_(di_notify_*) @@ -53,7 +55,6 @@ #include "priv_syswrap-generic.h" #include "priv_syswrap-linux.h" -#include "pub_core_vkiscnums.h" /* for the __NR_* constants */ // Run a thread from beginning to end and return the thread's // scheduler-return-code. diff --git a/coregrind/m_syswrap/syswrap-main.c b/coregrind/m_syswrap/syswrap-main.c index a2fb0cacf8..cc0da7d105 100644 --- a/coregrind/m_syswrap/syswrap-main.c +++ b/coregrind/m_syswrap/syswrap-main.c @@ -30,6 +30,8 @@ #include "libvex_guest_offsets.h" #include "pub_core_basics.h" +#include "pub_core_vki.h" +#include "pub_core_basics.h" #include "pub_core_threadstate.h" #include "pub_core_libcbase.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c b/coregrind/m_syswrap/syswrap-x86-linux.c index a782af15d6..26a0d9b8be 100644 --- a/coregrind/m_syswrap/syswrap-x86-linux.c +++ b/coregrind/m_syswrap/syswrap-x86-linux.c @@ -34,6 +34,8 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" +#include "pub_core_vkiscnums.h" #include "pub_core_threadstate.h" #include "pub_core_debuginfo.h" // VG_(di_notify_mmap) #include "pub_core_aspacemgr.h" @@ -58,8 +60,6 @@ #include "priv_syswrap-linux-variants.h" /* decls of linux variant wrappers */ #include "priv_syswrap-main.h" -#include "pub_core_vkiscnums.h" /* for the __NR_* constants */ - /* --------------------------------------------------------------------- clone() handling diff --git a/coregrind/m_threadmodel.c b/coregrind/m_threadmodel.c index 6e3c64f3a0..e7d3a09f88 100644 --- a/coregrind/m_threadmodel.c +++ b/coregrind/m_threadmodel.c @@ -61,6 +61,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_errormgr.h" #include "pub_core_execontext.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_threadstate.c b/coregrind/m_threadstate.c index a5d0891b1b..1c4633eb7d 100644 --- a/coregrind/m_threadstate.c +++ b/coregrind/m_threadstate.c @@ -29,6 +29,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_threadstate.h" #include "pub_core_libcassert.h" diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index baf254196c..63dbb2057d 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -30,6 +30,7 @@ */ #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_aspacemgr.h" #include "pub_core_machine.h" // VG_(fnptr_to_fnentry) diff --git a/coregrind/m_ume.c b/coregrind/m_ume.c index 4ff5953d7b..8151267baf 100644 --- a/coregrind/m_ume.c +++ b/coregrind/m_ume.c @@ -38,6 +38,7 @@ // included ahead of the glibc ones. This fix is a kludge; the right // solution is to entirely remove the glibc dependency. #include "pub_core_basics.h" +#include "pub_core_vki.h" #include "pub_core_aspacemgr.h" // various mapping fns #include "pub_core_debuglog.h" #include "pub_core_libcbase.h" diff --git a/coregrind/m_vki.c b/coregrind/m_vki.c new file mode 100644 index 0000000000..7cd88e7aae --- /dev/null +++ b/coregrind/m_vki.c @@ -0,0 +1,43 @@ + +/*--------------------------------------------------------------------*/ +/*--- Notional "implementation" for m_vki. ---*/ +/*--- m_vki.c ---*/ +/*--------------------------------------------------------------------*/ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2006-2006 OpenWorks LLP + info@open-works.co.uk + + 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. +*/ + +#include "pub_core_basics.h" +#include "pub_core_vki.h" /* self */ + +/* We have pub_{core,tool}_vki.h. This is the matching implementation + for that interface. In fact there is no implementation, as the + sole purpose of the module is to export types and constants + describing the kernel interface, so this file is empty. */ + + +/*--------------------------------------------------------------------*/ +/*--- end m_vki.c ---*/ +/*--------------------------------------------------------------------*/ diff --git a/coregrind/pub_core_vki.h b/coregrind/pub_core_vki.h new file mode 100644 index 0000000000..38999bb561 --- /dev/null +++ b/coregrind/pub_core_vki.h @@ -0,0 +1,50 @@ + +/*--------------------------------------------------------------------*/ +/*--- Top level for kernel interface declarations. ---*/ +/*--- pub_core_vki.h ---*/ +/*--------------------------------------------------------------------*/ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2000-2006 Julian Seward + jseward@acm.org + Copyright (C) 2005-2006 Nicholas Nethercote + njn@valgrind.org + Copyright (C) 2006-2006 OpenWorks LLP + info@open-works.co.uk + + 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 __PUB_CORE_VKI_H +#define __PUB_CORE_VKI_H + +/* Most unfortunately, all the kernel decls are visible to tools. Not + really necessary, but to avoid this would require some tedious + refactoring of the sources. Anyway, we live with this kludge, and + that means the only thing to be done here is ... */ + +#include "pub_tool_vki.h" + +#endif // __PUB_CORE_VKI_H + +/*--------------------------------------------------------------------*/ +/*--- end ---*/ +/*--------------------------------------------------------------------*/ diff --git a/helgrind/hg_main.c b/helgrind/hg_main.c index 897b2adc68..9c3a3fa00e 100644 --- a/helgrind/hg_main.c +++ b/helgrind/hg_main.c @@ -43,6 +43,7 @@ // fundamentals in each case. #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_threadstate.h" #include "pub_tool_aspacemgr.h" #include "pub_tool_debuginfo.h" diff --git a/include/Makefile.am b/include/Makefile.am index 0331635c95..eaa615eb35 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -30,11 +30,16 @@ incinc_HEADERS = \ pub_tool_tooliface.h \ pub_tool_vkiscnums.h \ valgrind.h \ - vki-linux.h \ - vki-amd64-linux.h \ - vki-ppc32-linux.h \ - vki-ppc64-linux.h \ - vki-x86-linux.h \ + vki/vki-linux.h \ + vki/vki-amd64-linux.h \ + vki/vki-ppc32-linux.h \ + vki/vki-ppc64-linux.h \ + vki/vki-x86-linux.h \ + vki/vki-linux.h \ + vki/vki-posixtypes-amd64-linux.h \ + vki/vki-posixtypes-ppc32-linux.h \ + vki/vki-posixtypes-ppc64-linux.h \ + vki/vki-posixtypes-x86-linux.h \ vki/vki-scnums-amd64-linux.h \ vki/vki-scnums-ppc32-linux.h \ vki/vki-scnums-ppc64-linux.h \ diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h index 0e8ab27e2b..3b4b8eaf61 100644 --- a/include/pub_tool_basics.h +++ b/include/pub_tool_basics.h @@ -52,13 +52,6 @@ // For varargs types #include -// Kernel types. Might as well have them here, they're used so broadly -// (eg. in pub_core_threadstate.h). -#if defined(VGO_linux) -# include "vki-linux.h" -#else -# error Unknown OS -#endif /* --------------------------------------------------------------------- builtin types diff --git a/include/pub_tool_vki.h b/include/pub_tool_vki.h new file mode 100644 index 0000000000..25573fb2d7 --- /dev/null +++ b/include/pub_tool_vki.h @@ -0,0 +1,62 @@ + +/*--------------------------------------------------------------------*/ +/*--- Top level for kernel interface declarations. ---*/ +/*--- pub_tool_vki.h ---*/ +/*--------------------------------------------------------------------*/ + +/* + This file is part of Valgrind, a dynamic binary instrumentation + framework. + + Copyright (C) 2000-2006 Julian Seward + jseward@acm.org + Copyright (C) 2005-2006 Nicholas Nethercote + njn@valgrind.org + Copyright (C) 2006-2006 OpenWorks LLP + info@open-works.co.uk + + 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. +*/ + +/* This file defines types and constants for the kernel interface, and to + make that clear everything is prefixed VKI_/vki_. + + This file is merely a top-level "steering" file, which pulls in the + correct bits for the relevant platform. You should not directly + #include any file in include/vki; instead #include only this one or + pub_core_vki.h. +*/ + +#ifndef __PUB_TOOL_VKI_H +#define __PUB_TOOL_VKI_H + +#if defined(VGO_linux) +# include "vki/vki-linux.h" +#elif defined(VGP_ppc32_aix5) +# include "vki/vki-ppc32-aix5.h" +#elif defined(VGP_ppc64_aix5) +# include "vki/vki-ppc64-aix5.h" +#else +# error Unknown Plat/OS +#endif + +#endif // __PUB_TOOL_VKI_H + +/*--------------------------------------------------------------------*/ +/*--- end pub_tool_vki.h ---*/ +/*--------------------------------------------------------------------*/ diff --git a/include/vki-amd64-linux.h b/include/vki/vki-amd64-linux.h similarity index 100% rename from include/vki-amd64-linux.h rename to include/vki/vki-amd64-linux.h diff --git a/include/vki-linux.h b/include/vki/vki-linux.h similarity index 99% rename from include/vki-linux.h rename to include/vki/vki-linux.h index 7066709a0b..007ff201a4 100644 --- a/include/vki-linux.h +++ b/include/vki/vki-linux.h @@ -57,6 +57,21 @@ definitions, which affects some of them. */ +/* The structure is (aiui, jrs 20060504): + + #include plat-specific posix types (vki-posixtypes-ARCH-linux.h) + + Lots more types, structs, consts, in this file + + #include other plat-specific stuff (vki-ARCH-linux.h) + + Even more types, structs, consts, in this file + + The system call numbers are dealt with by + pub_{core,tool}_vkiscnums.h, not via pub_{core,tool}_vki.h, which + is what this file is part of. +*/ + #ifndef __VKI_LINUX_H #define __VKI_LINUX_H @@ -65,13 +80,13 @@ //---------------------------------------------------------------------- #if defined(VGA_x86) -# include "vki_posixtypes-x86-linux.h" +# include "vki-posixtypes-x86-linux.h" #elif defined(VGA_amd64) -# include "vki_posixtypes-amd64-linux.h" +# include "vki-posixtypes-amd64-linux.h" #elif defined(VGA_ppc32) -# include "vki_posixtypes-ppc32-linux.h" +# include "vki-posixtypes-ppc32-linux.h" #elif defined(VGA_ppc64) -# include "vki_posixtypes-ppc64-linux.h" +# include "vki-posixtypes-ppc64-linux.h" #else # error Unknown platform #endif @@ -2121,8 +2136,6 @@ struct vki_serial_icounter_struct { int reserved[9]; }; -#endif // __VKI_LINUX_H - //---------------------------------------------------------------------- // From linux-2.6.16/include/linux/vt.h //---------------------------------------------------------------------- @@ -2172,6 +2185,8 @@ struct vki_vt_consize { #define VKI_VT_LOCKSWITCH 0x560B /* disallow vt switching */ #define VKI_VT_UNLOCKSWITCH 0x560C /* allow vt switching */ +#endif // __VKI_LINUX_H + /*--------------------------------------------------------------------*/ /*--- end ---*/ /*--------------------------------------------------------------------*/ diff --git a/include/vki_posixtypes-amd64-linux.h b/include/vki/vki-posixtypes-amd64-linux.h similarity index 97% rename from include/vki_posixtypes-amd64-linux.h rename to include/vki/vki-posixtypes-amd64-linux.h index 6a0ab3f62c..0c7bf61a2f 100644 --- a/include/vki_posixtypes-amd64-linux.h +++ b/include/vki/vki-posixtypes-amd64-linux.h @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------*/ /*--- AMD64/Linux-specific kernel interface: posix types. ---*/ -/*--- vki_posixtypes-amd64-linux.h ---*/ +/*--- vki-posixtypes-amd64-linux.h ---*/ /*--------------------------------------------------------------------*/ /* diff --git a/include/vki_posixtypes-ppc32-linux.h b/include/vki/vki-posixtypes-ppc32-linux.h similarity index 92% rename from include/vki_posixtypes-ppc32-linux.h rename to include/vki/vki-posixtypes-ppc32-linux.h index a4117ea040..59da11018e 100644 --- a/include/vki_posixtypes-ppc32-linux.h +++ b/include/vki/vki-posixtypes-ppc32-linux.h @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------*/ /*--- PPC32/Linux-specific kernel interface: posix types. ---*/ -/*--- vki_posixtypes-ppc32-linux.h ---*/ +/*--- vki-posixtypes-ppc32-linux.h ---*/ /*--------------------------------------------------------------------*/ /* @@ -29,8 +29,8 @@ The GNU General Public License is contained in the file COPYING. */ -#ifndef __PPC32_LINUX_VKI_ARCH_POSIXTYPES_H -#define __PPC32_LINUX_VKI_ARCH_POSIXTYPES_H +#ifndef __VKI_POSIXTYPES_PPC32_LINUX_H +#define __VKI_POSIXTYPES_PPC32_LINUX_H //---------------------------------------------------------------------- // From linux-2.6.9/include/asm-ppc/posix_types.h @@ -61,7 +61,7 @@ typedef struct { int val[2]; } __vki_kernel_fsid_t; -#endif // __PPC32_LINUX_VKI_ARCH_POSIXTYPES_H +#endif // __VKI_POSIXTYPES_PPC32_LINUX_H /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki_posixtypes-ppc64-linux.h b/include/vki/vki-posixtypes-ppc64-linux.h similarity index 93% rename from include/vki_posixtypes-ppc64-linux.h rename to include/vki/vki-posixtypes-ppc64-linux.h index d9d38cbc40..a4c5a0d2f2 100644 --- a/include/vki_posixtypes-ppc64-linux.h +++ b/include/vki/vki-posixtypes-ppc64-linux.h @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------*/ /*--- PPC64/Linux-specific kernel interface: posix types. ---*/ -/*--- vki_posixtypes-ppc64-linux.h ---*/ +/*--- vki-posixtypes-ppc64-linux.h ---*/ /*--------------------------------------------------------------------*/ /* @@ -29,8 +29,8 @@ The GNU General Public License is contained in the file COPYING. */ -#ifndef __PPC64_LINUX_VKI_ARCH_POSIXTYPES_H -#define __PPC64_LINUX_VKI_ARCH_POSIXTYPES_H +#ifndef __VKI_POSIXTYPES_PPC64_LINUX_H +#define __VKI_POSIXTYPES_PPC64_LINUX_H //---------------------------------------------------------------------- // From linux-2.6.13/include/asm-ppc64/posix_types.h @@ -68,7 +68,7 @@ typedef struct { int val[2]; } __vki_kernel_fsid_t; -#endif // __PPC64_LINUX_VKI_ARCH_POSIXTYPES_H +#endif // __VKI_POSIXTYPES_PPC64_LINUX_H /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki_posixtypes-x86-linux.h b/include/vki/vki-posixtypes-x86-linux.h similarity index 97% rename from include/vki_posixtypes-x86-linux.h rename to include/vki/vki-posixtypes-x86-linux.h index 6d0e551374..23f9831c05 100644 --- a/include/vki_posixtypes-x86-linux.h +++ b/include/vki/vki-posixtypes-x86-linux.h @@ -1,7 +1,7 @@ /*--------------------------------------------------------------------*/ /*--- x86/Linux-specific kernel interface: posix types. ---*/ -/*--- vki_posixtypes-x86-linux.h ---*/ +/*--- vki-posixtypes-x86-linux.h ---*/ /*--------------------------------------------------------------------*/ /* diff --git a/include/vki-ppc32-linux.h b/include/vki/vki-ppc32-linux.h similarity index 99% rename from include/vki-ppc32-linux.h rename to include/vki/vki-ppc32-linux.h index 8e9afa4781..827e13268e 100644 --- a/include/vki-ppc32-linux.h +++ b/include/vki/vki-ppc32-linux.h @@ -7,7 +7,7 @@ This file is part of Valgrind, a dynamic binary instrumentation framework. - Copyright (C) 2005 Julian Seward + Copyright (C) 2005-2006 Julian Seward jseward@acm.org This program is free software; you can redistribute it and/or @@ -28,8 +28,8 @@ The GNU General Public License is contained in the file COPYING. */ -#ifndef __PPC32_LINUX_VKI_ARCH_H -#define __PPC32_LINUX_VKI_ARCH_H +#ifndef __VKI_PPC32_LINUX_H +#define __VKI_PPC32_LINUX_H // ppc32 is big-endian. #define VKI_BIG_ENDIAN 1 @@ -912,7 +912,7 @@ struct vki_shminfo64 { // And that's it! //---------------------------------------------------------------------- -#endif // __PPC32_LINUX_VKI_ARCH_H +#endif // __VKI_PPC32_LINUX_H /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki-ppc64-linux.h b/include/vki/vki-ppc64-linux.h similarity index 99% rename from include/vki-ppc64-linux.h rename to include/vki/vki-ppc64-linux.h index afb865e19e..4f1882bad3 100644 --- a/include/vki-ppc64-linux.h +++ b/include/vki/vki-ppc64-linux.h @@ -7,7 +7,7 @@ This file is part of Valgrind, a dynamic binary instrumentation framework. - Copyright (C) 2005 Julian Seward + Copyright (C) 2005-2006 Julian Seward jseward@acm.org This program is free software; you can redistribute it and/or @@ -28,8 +28,8 @@ The GNU General Public License is contained in the file COPYING. */ -#ifndef __PPC64_LINUX_VKI_ARCH_H -#define __PPC64_LINUX_VKI_ARCH_H +#ifndef __VKI_PPC64_LINUX_H +#define __VKI_PPC64_LINUX_H // ppc64 is big-endian. #define VKI_BIG_ENDIAN 1 @@ -753,7 +753,7 @@ struct vki_shminfo64 { // end //---------------------------------------------------------------------- -#endif // __PPC64_LINUX_VKI_ARCH_H +#endif // __VKI_PPC64_LINUX_H /*--------------------------------------------------------------------*/ /*--- end ---*/ diff --git a/include/vki-x86-linux.h b/include/vki/vki-x86-linux.h similarity index 100% rename from include/vki-x86-linux.h rename to include/vki/vki-x86-linux.h diff --git a/massif/ms_main.c b/massif/ms_main.c index a130f43691..d8de83f32f 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -35,6 +35,7 @@ // structures below for more info on how things work. #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_aspacemgr.h" #include "pub_tool_debuginfo.h" #include "pub_tool_hashtable.h" diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index f194500720..d282e62c26 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -29,6 +29,7 @@ */ #include "pub_tool_basics.h" +#include "pub_tool_vki.h" #include "pub_tool_aspacemgr.h" #include "pub_tool_execontext.h" #include "pub_tool_hashtable.h"