]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Modularised vg_transtab.c as m_transtab.
authorNicholas Nethercote <njn@valgrind.org>
Fri, 13 May 2005 23:40:55 +0000 (23:40 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Fri, 13 May 2005 23:40:55 +0000 (23:40 +0000)
Renamed add_to_trans_tab() as add_to_transtab() for consistency
with the other names.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3703

coregrind/Makefile.am
coregrind/core.h
coregrind/m_aspacemgr/aspacemgr.c
coregrind/m_translate.c
coregrind/m_transtab.c [moved from coregrind/vg_transtab.c with 98% similarity]
coregrind/pub_core_transtab.h [new file with mode: 0644]
coregrind/vg_main.c
coregrind/vg_redir.c
coregrind/vg_scheduler.c

index 914c571c2fa80df9bf6a451032cf8027052abbab..8c51c7ea23e306e4cc19531e77cffef47ad18ca0 100644 (file)
@@ -53,6 +53,7 @@ noinst_HEADERS = \
        pub_core_syscalls.h     \
        pub_core_tooliface.h    \
        pub_core_translate.h    \
+       pub_core_transtab.h     \
        ume.h                   \
        vg_symtab2.h            \
        vg_symtypes.h
@@ -80,6 +81,7 @@ stage2_SOURCES = \
        m_stacktrace.c \
        m_tooliface.c \
        m_translate.c \
+       m_transtab.c \
        ume.c \
        \
        vg_scheduler.c \
@@ -95,8 +97,7 @@ stage2_SOURCES = \
        vg_redir.c \
        vg_dwarf.c \
        vg_stabs.c \
-       vg_symtypes.c \
-       vg_transtab.c
+       vg_symtypes.c
 
 ## libplatform.a must be before libarch.a and libos.a, it seems.
 stage2_extra= \
index 6ac1166f419905ed7dbe59ccf50f14ec652b85a9..48aa00658c263f464e15f25808df9df187f88515 100644 (file)
@@ -758,38 +758,6 @@ extern void VG_(print_scheduler_stats) ( void );
 extern ULong VG_(bbs_done);
 
 
-/* ---------------------------------------------------------------------
-   Exports of vg_transtab.c
-   ------------------------------------------------------------------ */
-
-/* The fast-cache for tt-lookup, and for finding counters. */
-extern ULong* VG_(tt_fast) [VG_TT_FAST_SIZE];
-extern UInt*  VG_(tt_fastN)[VG_TT_FAST_SIZE];
-
-
-extern void VG_(init_tt_tc)       ( void );
-
-extern
-void VG_(add_to_trans_tab)( VexGuestExtents* vge,
-                            Addr64           entry,
-                            AddrH            code,
-                            UInt             code_len );
-
-extern Bool VG_(search_transtab) ( /*OUT*/AddrH* result,
-                                   Addr64        guest_addr, 
-                                   Bool          upd_cache );
-
-extern void VG_(discard_translations) ( Addr64 start, UInt range );
-
-extern void VG_(sanity_check_tt_tc) ( Char* caller );
-
-extern void VG_(print_tt_tc_stats) ( void );
-
-extern UInt VG_(get_bbs_translated) ( void );
-
-extern void VG_(show_BB_profile) ( void );
-
-
 /* ---------------------------------------------------------------------
    Exports of vg_syscall.S
    ------------------------------------------------------------------ */
index d01f76adeb7ca6a72ff22dc47a24d82c42f49e2d..57bc6ae396412498672db351e6a274562ff1b572 100644 (file)
@@ -34,6 +34,7 @@
 #include "pub_core_aspacemgr.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
+#include "pub_core_transtab.h"
 #include "vki_unistd.h"
 
 
index fa717dab5a6a30656531a77bc0b550b7c206b7f7..4ec0043a77b6b84009ddbebb51dc1990231f1668 100644 (file)
@@ -32,6 +32,8 @@
 #include "core.h"
 #include "pub_core_aspacemgr.h"
 #include "pub_core_tooliface.h"
+#include "pub_core_translate.h"
+#include "pub_core_transtab.h"
 
 
 /*------------------------------------------------------------*/
@@ -496,10 +498,10 @@ Bool VG_(translate) ( ThreadId tid,
    if (!debugging_translation) {
       // Note that we use orig_addr0, not orig_addr, which might have been
       // changed by the redirection
-      VG_(add_to_trans_tab)( &vge,
-                             orig_addr0,
-                             (Addr)(&tmpbuf[0]), 
-                             tmpbuf_used );
+      VG_(add_to_transtab)( &vge,
+                            orig_addr0,
+                            (Addr)(&tmpbuf[0]), 
+                            tmpbuf_used );
    }
 
    VGP_POPCC(VgpTranslate);
similarity index 98%
rename from coregrind/vg_transtab.c
rename to coregrind/m_transtab.c
index 68ccb6c4409dcabe45a9d1bef9ead1ca838e58ac..9c44d4c73e7abfe747068312fa7c3a8d34469c5b 100644 (file)
@@ -1,7 +1,7 @@
 
 /*--------------------------------------------------------------------*/
 /*--- Management of the translation table and cache.               ---*/
-/*---                                                vg_transtab.c ---*/
+/*---                                                 m_transtab.c ---*/
 /*--------------------------------------------------------------------*/
 
 /*
@@ -31,7 +31,9 @@
 
 #include "core.h"
 #include "pub_core_tooliface.h"
+// XXX: this module should not depend on m_translate!
 #include "pub_core_translate.h"
+#include "pub_core_transtab.h"
 
 /* #define DEBUG_TRANSTAB */
 
@@ -326,10 +328,10 @@ static void initialiseSector ( Int sno )
    pre: youngest_sector points to a valid (although possibly full)
    sector.
 */
-void VG_(add_to_trans_tab)( VexGuestExtents* vge,
-                            Addr64           entry,
-                            AddrH            code,
-                            UInt             code_len )
+void VG_(add_to_transtab)( VexGuestExtents* vge,
+                           Addr64           entry,
+                           AddrH            code,
+                           UInt             code_len )
 {
    Int    tcAvailQ, reqdQ, y, i;
    ULong  *tce, *tce2;
@@ -341,7 +343,7 @@ void VG_(add_to_trans_tab)( VexGuestExtents* vge,
    vg_assert(code_len > 0 && code_len < 20000);
 
    if (0)
-      VG_(printf)("add_to_trans_tab(entry = 0x%llx, len = %d)\n",
+      VG_(printf)("add_to_transtab(entry = 0x%llx, len = %d)\n",
                   entry, code_len);
 
    n_in_count++;
@@ -804,5 +806,5 @@ void VG_(show_BB_profile) ( void )
 
 
 /*--------------------------------------------------------------------*/
-/*--- end                                            vg_transtab.c ---*/
+/*--- end                                                          ---*/
 /*--------------------------------------------------------------------*/
diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h
new file mode 100644 (file)
index 0000000..6d1e46b
--- /dev/null
@@ -0,0 +1,71 @@
+
+/*--------------------------------------------------------------------*/
+/*--- The translation table and cache.                             ---*/
+/*---                                          pub_core_transtab.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+   This file is part of Valgrind, a dynamic binary instrumentation
+   framework.
+
+   Copyright (C) 2000-2005 Julian Seward
+      jseward@acm.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 __PUB_CORE_TRANSTAB_H
+#define __PUB_CORE_TRANSTAB_H
+
+//--------------------------------------------------------------------
+// PURPOSE: This module is responsible for caching translations, and
+// enabling fast look-ups of them.
+//--------------------------------------------------------------------
+
+/* The fast-cache for tt-lookup, and for finding counters. */
+extern ULong* VG_(tt_fast) [VG_TT_FAST_SIZE];
+extern UInt*  VG_(tt_fastN)[VG_TT_FAST_SIZE];
+
+extern void VG_(init_tt_tc)       ( void );
+
+extern
+void VG_(add_to_transtab)( VexGuestExtents* vge,
+                           Addr64           entry,
+                           AddrH            code,
+                           UInt             code_len );
+
+extern Bool VG_(search_transtab) ( /*OUT*/AddrH* result,
+                                   Addr64        guest_addr, 
+                                   Bool          upd_cache );
+
+extern void VG_(discard_translations) ( Addr64 start, UInt range );
+
+extern void VG_(sanity_check_tt_tc) ( Char* caller );
+
+extern void VG_(print_tt_tc_stats) ( void );
+
+extern UInt VG_(get_bbs_translated) ( void );
+
+extern void VG_(show_BB_profile) ( void );
+
+
+#endif   // __PUB_CORE_TRANSTAB_H
+
+/*--------------------------------------------------------------------*/
+/*--- end                                                          ---*/
+/*--------------------------------------------------------------------*/
index 41f5fbb23116bd4e12d2a11b47ef71f1c886ddaa..72e7a79ef047fdc9b21b4038aeb190ad42e4fc38 100644 (file)
@@ -38,6 +38,7 @@
 #include "pub_core_execontext.h"
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
+#include "pub_core_transtab.h"
 
 #include <dirent.h>
 #include <dlfcn.h>
index 0d8996f3e7dcd67722814f693a6fba42e70d9780..f0840b7f090c12e227ba05774950145ca4f85786 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "pub_core_aspacemgr.h"
 #include "pub_core_skiplist.h"
+#include "pub_core_transtab.h"
 
 /*------------------------------------------------------------*/
 /*--- General purpose redirection.                         ---*/
index 97e10646a698a3995c092ca327d1ce770446609c..c610869a8be3f01f316e6671838c56f5dce0bc60 100644 (file)
@@ -67,6 +67,7 @@
 #include "pub_core_syscalls.h"
 #include "pub_core_tooliface.h"
 #include "pub_core_translate.h"
+#include "pub_core_transtab.h"
 #include "vki_unistd.h"
 
 /* ---------------------------------------------------------------------