blob: 6f1455945e103b73867bff262e88e72a5e089574 [file] [log] [blame]
njn8bddf582005-05-13 23:40:55 +00001
2/*--------------------------------------------------------------------*/
3/*--- The translation table and cache. ---*/
4/*--- pub_core_transtab.h ---*/
5/*--------------------------------------------------------------------*/
6
7/*
8 This file is part of Valgrind, a dynamic binary instrumentation
9 framework.
10
11 Copyright (C) 2000-2005 Julian Seward
12 jseward@acm.org
13
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License as
16 published by the Free Software Foundation; either version 2 of the
17 License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
27 02111-1307, USA.
28
29 The GNU General Public License is contained in the file COPYING.
30*/
31
32#ifndef __PUB_CORE_TRANSTAB_H
33#define __PUB_CORE_TRANSTAB_H
34
35//--------------------------------------------------------------------
36// PURPOSE: This module is responsible for caching translations, and
37// enabling fast look-ups of them.
38//--------------------------------------------------------------------
39
njn2e8f4ef2005-05-14 21:44:20 +000040#include "pub_core_transtab_asm.h"
41
njn8bddf582005-05-13 23:40:55 +000042/* The fast-cache for tt-lookup, and for finding counters. */
43extern ULong* VG_(tt_fast) [VG_TT_FAST_SIZE];
44extern UInt* VG_(tt_fastN)[VG_TT_FAST_SIZE];
45
46extern void VG_(init_tt_tc) ( void );
47
48extern
49void VG_(add_to_transtab)( VexGuestExtents* vge,
50 Addr64 entry,
51 AddrH code,
sewardj26412bd2005-07-07 10:05:05 +000052 UInt code_len,
53 Bool is_self_checking );
njn8bddf582005-05-13 23:40:55 +000054
55extern Bool VG_(search_transtab) ( /*OUT*/AddrH* result,
56 Addr64 guest_addr,
57 Bool upd_cache );
58
sewardja3054502005-07-26 23:04:25 +000059extern void VG_(discard_translations) ( Addr64 start, ULong range );
njn8bddf582005-05-13 23:40:55 +000060
njn8bddf582005-05-13 23:40:55 +000061extern void VG_(print_tt_tc_stats) ( void );
62
63extern UInt VG_(get_bbs_translated) ( void );
64
njn2025cf92005-06-26 20:44:48 +000065// BB profiling stuff
njn8bddf582005-05-13 23:40:55 +000066
njn2025cf92005-06-26 20:44:48 +000067typedef struct _BBProfEntry {
68 Addr64 addr;
69 ULong score;
70} BBProfEntry;
71
72extern ULong VG_(get_BB_profile) ( BBProfEntry tops[], UInt n_tops );
njn8bddf582005-05-13 23:40:55 +000073
74#endif // __PUB_CORE_TRANSTAB_H
75
76/*--------------------------------------------------------------------*/
77/*--- end ---*/
78/*--------------------------------------------------------------------*/