sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- Management of the translation table and cache. ---*/ |
| 4 | /*--- vg_transtab.c ---*/ |
| 5 | /*--------------------------------------------------------------------*/ |
| 6 | |
| 7 | /* |
njn | b9c427c | 2004-12-01 14:14:42 +0000 | [diff] [blame] | 8 | This file is part of Valgrind, a dynamic binary instrumentation |
| 9 | framework. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 10 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 11 | Copyright (C) 2000-2005 Julian Seward |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 12 | jseward@acm.org |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 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 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 29 | The GNU General Public License is contained in the file COPYING. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 30 | */ |
| 31 | |
nethercote | f1e5e15 | 2004-09-01 23:58:16 +0000 | [diff] [blame] | 32 | #include "core.h" |
njn | 43b9a8a | 2005-05-10 04:37:01 +0000 | [diff] [blame^] | 33 | #include "pub_core_tooliface.h" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 34 | |
sewardj | 18d7513 | 2002-05-16 11:06:21 +0000 | [diff] [blame] | 35 | /* #define DEBUG_TRANSTAB */ |
| 36 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 37 | |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 38 | /*-------------------------------------------------------------*/ |
| 39 | /*--- Management of the FIFO-based translation table+cache. ---*/ |
| 40 | /*-------------------------------------------------------------*/ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 41 | |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 42 | /*------------------ CONSTANTS ------------------*/ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 43 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 44 | /* Number of sectors the TC is divided into. If you need a larger |
| 45 | overall translation cache, increase this value. */ |
| 46 | #define N_SECTORS 8 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 47 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 48 | /* Number of TC entries in each sector. This needs to be a prime |
| 49 | number to work properly, and it is strongly recommended not to |
| 50 | change this. */ |
| 51 | #define N_TTES_PER_SECTOR /*30011*/ 40009 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 52 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 53 | /* Because each sector contains a hash table of TTEntries, we need to |
| 54 | specify the maximum allowable loading, after which the sector is |
| 55 | deemed full. */ |
| 56 | #define SECTOR_TT_LIMIT_PERCENT 60 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 57 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 58 | /* The sector is deemed full when this many entries are in it. */ |
| 59 | #define N_TTES_PER_SECTOR_USABLE \ |
| 60 | ((N_TTES_PER_SECTOR * SECTOR_TT_LIMIT_PERCENT) / 100) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 61 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 62 | |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 63 | /*------------------ TYPES ------------------*/ |
| 64 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 65 | /* A translation-cache entry is two parts: |
| 66 | - The guest address of the first (entry) bb in the translation, |
| 67 | as a 64-bit word. |
| 68 | - One or more 64-bit words containing the code. |
| 69 | It is supposed to be 64-bit aligned. |
| 70 | */ |
| 71 | /* |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 72 | typedef |
| 73 | struct { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 74 | Addr64 orig_addr; |
| 75 | ULong code[0]; |
| 76 | } |
| 77 | TCEntry; |
| 78 | */ |
| 79 | |
| 80 | /* A translation-table entry. This indicates precisely which areas of |
| 81 | guest code are included in the translation, and contains all other |
| 82 | auxiliary info too. */ |
| 83 | typedef |
| 84 | struct { |
| 85 | /* Profiling only: the count and weight (arbitrary meaning) for |
| 86 | this translation. Weight is a property of the translation |
| 87 | itself and computed once when the translation is created. |
| 88 | Count is an entry count for the translation and is |
| 89 | incremented by 1 every time the translation is used, if we |
| 90 | are profiling. */ |
| 91 | UInt count; |
| 92 | UShort weight; |
| 93 | |
| 94 | /* Status of the slot. Note, we need to be able to do lazy |
| 95 | deletion, hence the Deleted state. */ |
| 96 | enum { InUse, Deleted, Empty } status; |
| 97 | |
| 98 | /* Pointer to the corresponding TCEntry (must be in the same |
| 99 | sector!) */ |
| 100 | ULong* tce; |
| 101 | |
| 102 | /* This is the original guest address that purportedly is the |
| 103 | entry point of the translation. You might think that .entry |
| 104 | should be the same as .vge->base[0], and most of the time it |
| 105 | is. However, when doing redirections, that is not the case. |
| 106 | .vge must always correctly describe the guest code sections |
| 107 | from which this translation was made. However, .entry may or |
| 108 | may not be a lie, depending on whether or not we're doing |
| 109 | redirection. */ |
| 110 | Addr64 entry; |
| 111 | |
| 112 | /* This structure describes precisely what ranges of guest code |
| 113 | the translation covers, so we can decide whether or not to |
| 114 | delete it when translations of a given address range are |
| 115 | invalidated. */ |
| 116 | VexGuestExtents vge; |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 117 | } |
| 118 | TTEntry; |
| 119 | |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 120 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 121 | /* Finally, a sector itself. Each sector contains an array of |
| 122 | TCEntries, which hold code, and an array of TTEntries, containing |
| 123 | all required administrative info. Profiling is supported using the |
| 124 | TTEntry .count and .weight fields, if required. Each sector is |
| 125 | independent in that no cross-sector references are allowed. |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 126 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 127 | If the sector is not in use, all three pointers are NULL and |
| 128 | tt_n_inuse is zero. |
| 129 | */ |
| 130 | typedef |
| 131 | struct { |
| 132 | /* The TCEntry area. Size of this depends on the average |
| 133 | translation size. We try and size it so it becomes full |
| 134 | precisely when this sector's translation table (tt) reaches |
| 135 | its load limit (SECTOR_TT_LIMIT_PERCENT). */ |
| 136 | ULong* tc; |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 137 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 138 | /* The TTEntry array. This is a fixed size, always containing |
| 139 | exactly N_TTES_PER_SECTOR entries. */ |
| 140 | TTEntry* tt; |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 141 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 142 | /* This points to the current allocation point in tc. */ |
| 143 | ULong* tc_next; |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 144 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 145 | /* The count of tt entries with state InUse. */ |
| 146 | Int tt_n_inuse; |
| 147 | } |
| 148 | Sector; |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 149 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 150 | |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 151 | /*------------------ DECLS ------------------*/ |
| 152 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 153 | /* The root data structure is an array of sectors. The index of the |
| 154 | youngest sector is recorded, and new translations are put into that |
| 155 | sector. When it fills up, we move along to the next sector and |
| 156 | start to fill that up, wrapping around at the end of the array. |
| 157 | That way, once all N_TC_SECTORS have been bought into use for the |
| 158 | first time, and are full, we then re-use the oldest sector, |
| 159 | endlessly. |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 160 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 161 | When running, youngest sector should be between >= 0 and < |
| 162 | N_TC_SECTORS. The initial -1 value indicates the TT/TC system is |
| 163 | not yet initialised. |
| 164 | */ |
| 165 | static Sector sectors[N_SECTORS]; |
| 166 | static Int youngest_sector = -1; |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 167 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 168 | /* The number of ULongs in each TCEntry area. This is computed once |
| 169 | at startup and does not change. */ |
| 170 | static Int tc_sector_szQ; |
nethercote | 92e7b7f | 2004-08-07 17:52:25 +0000 | [diff] [blame] | 171 | |
| 172 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 173 | /* Fast helper for the TC. A direct-mapped cache which holds a |
sewardj | c54ee50 | 2004-11-29 19:46:47 +0000 | [diff] [blame] | 174 | pointer to a TC entry which may or may not be the correct one, but |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 175 | which we hope usually is. This array is referred to directly from |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 176 | <arch>/dispatch.S. |
sewardj | 8aef119 | 2002-07-24 09:36:36 +0000 | [diff] [blame] | 177 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 178 | Entries in tt_fast may point to any valid TC entry, regardless of |
| 179 | which sector it's in. Consequently we must be very careful to |
| 180 | invalidate this cache when TC entries are changed or disappear. |
| 181 | |
| 182 | A special TCEntry -- bogus_tc_entry -- must be pointed at to cause |
| 183 | that cache entry to miss. This relies on the assumption that no |
| 184 | guest code actually has an address of 0x1. |
| 185 | */ |
| 186 | /*global*/ ULong* VG_(tt_fast)[VG_TT_FAST_SIZE]; |
| 187 | |
| 188 | static ULong bogus_tc_entry = (Addr64)1; |
sewardj | 22854b9 | 2002-11-30 14:00:47 +0000 | [diff] [blame] | 189 | |
| 190 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 191 | /* For profiling, we have a parallel array of pointers to .count |
| 192 | fields in TT entries. Again, these pointers must be invalidated |
| 193 | when translations disappear. A NULL pointer suffices to indicate |
| 194 | an unused slot. |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 195 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 196 | tt_fast and tt_fastN change together: if tt_fast[i] points to |
| 197 | bogus_tc_entry then the corresponding tt_fastN[i] must be null. If |
| 198 | tt_fast[i] points to some TC entry somewhere, then tt_fastN[i] |
| 199 | *must* point to the .count field of the corresponding TT entry. |
| 200 | |
| 201 | tt_fast and tt_fastN are referred to from assembly code |
| 202 | (dispatch.S). |
| 203 | */ |
| 204 | /*global*/ UInt* VG_(tt_fastN)[VG_TT_FAST_SIZE]; |
| 205 | |
| 206 | |
sewardj | 663a1bd | 2005-04-24 11:22:44 +0000 | [diff] [blame] | 207 | /* Make sure we're not used before initialisation. */ |
| 208 | static Bool init_done = False; |
| 209 | |
| 210 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 211 | /*------------------ STATS DECLS ------------------*/ |
| 212 | |
| 213 | /* Number of fast-cache updates and flushes done. */ |
| 214 | ULong n_fast_flushes = 0; |
| 215 | ULong n_fast_updates = 0; |
| 216 | |
| 217 | /* Number of full lookups done. */ |
| 218 | ULong n_full_lookups = 0; |
| 219 | ULong n_lookup_probes = 0; |
| 220 | |
| 221 | /* Number/osize/tsize of translations entered. */ |
| 222 | ULong n_in_count = 0; |
| 223 | ULong n_in_osize = 0; |
| 224 | ULong n_in_tsize = 0; |
| 225 | |
| 226 | /* Number/osize of translations discarded due to lack of space. */ |
| 227 | ULong n_dump_count = 0; |
| 228 | ULong n_dump_osize = 0; |
| 229 | |
| 230 | /* Number/osize of translations discarded due to requests to do so. */ |
| 231 | ULong n_disc_count = 0; |
| 232 | ULong n_disc_osize = 0; |
| 233 | |
| 234 | |
| 235 | |
| 236 | /*-------------------------------------------------------------*/ |
| 237 | /*--- Add/delete/find translations ---*/ |
| 238 | /*-------------------------------------------------------------*/ |
| 239 | |
| 240 | static UInt vge_osize ( VexGuestExtents* vge ) |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 241 | { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 242 | UInt i, n = 0; |
| 243 | for (i = 0; i < vge->n_used; i++) |
| 244 | n += (UInt)vge->len[i]; |
| 245 | return n; |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 246 | } |
| 247 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 248 | static Bool isValidSector ( Int sector ) |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 249 | { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 250 | if (sector < 0 || sector >= N_SECTORS) |
| 251 | return False; |
| 252 | return True; |
| 253 | } |
| 254 | |
| 255 | static inline UInt HASH_TT ( Addr64 key ) |
| 256 | { |
| 257 | UInt kHi = (UInt)(key >> 32); |
| 258 | UInt kLo = (UInt)key; |
| 259 | return (kHi ^ kLo) % N_TTES_PER_SECTOR; |
| 260 | } |
| 261 | |
| 262 | static void setFastCacheEntry ( Addr64 key, ULong* tce, UInt* count ) |
| 263 | { |
| 264 | UInt cno = ((UInt)key) & VG_TT_FAST_MASK; |
| 265 | VG_(tt_fast)[cno] = tce; |
| 266 | VG_(tt_fastN)[cno] = count; |
| 267 | n_fast_updates++; |
| 268 | } |
| 269 | |
| 270 | static void invalidateFastCache ( void ) |
| 271 | { |
| 272 | UInt j; |
| 273 | for (j = 0; j < VG_TT_FAST_SIZE; j++) { |
| 274 | VG_(tt_fast)[j] = &bogus_tc_entry; |
| 275 | VG_(tt_fastN)[j] = NULL; |
| 276 | } |
| 277 | n_fast_flushes++; |
| 278 | } |
| 279 | |
| 280 | static void initialiseSector ( Int sno ) |
| 281 | { |
| 282 | Int i; |
| 283 | vg_assert(isValidSector(sno)); |
| 284 | |
| 285 | if (sectors[sno].tc == NULL) { |
| 286 | /* Sector has never been used before. Need to allocate tt and |
| 287 | tc. */ |
| 288 | vg_assert(sectors[sno].tt == NULL); |
| 289 | vg_assert(sectors[sno].tc_next == NULL); |
| 290 | vg_assert(sectors[sno].tt_n_inuse == 0); |
| 291 | sectors[sno].tc |
| 292 | = VG_(get_memory_from_mmap) |
| 293 | ( 8 * tc_sector_szQ, "sectors[sno].tc" ); |
| 294 | sectors[sno].tt |
| 295 | = VG_(get_memory_from_mmap) |
| 296 | ( N_TTES_PER_SECTOR * sizeof(TTEntry), "sectors[sno].tt" ); |
| 297 | if (VG_(clo_verbosity) > 2) |
| 298 | VG_(message)(Vg_DebugMsg, "TT/TC: initialise sector %d", sno); |
| 299 | } else { |
| 300 | /* Sector has been used before. */ |
| 301 | vg_assert(sectors[sno].tt != NULL); |
| 302 | vg_assert(sectors[sno].tc_next != NULL); |
| 303 | n_dump_count += sectors[sno].tt_n_inuse; |
| 304 | for (i = 0; i < N_TTES_PER_SECTOR; i++) { |
| 305 | if (sectors[sno].tt[i].status == InUse) { |
| 306 | n_dump_osize += vge_osize(§ors[sno].tt[i].vge); |
| 307 | } |
| 308 | } |
| 309 | if (VG_(clo_verbosity) > 2) |
| 310 | VG_(message)(Vg_DebugMsg, "TT/TC: recycle sector %d", sno); |
| 311 | } |
| 312 | |
| 313 | sectors[sno].tc_next = sectors[sno].tc; |
| 314 | sectors[sno].tt_n_inuse = 0; |
| 315 | for (i = 0; i < N_TTES_PER_SECTOR; i++) |
| 316 | sectors[sno].tt[i].status = Empty; |
| 317 | |
| 318 | invalidateFastCache(); |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 319 | } |
| 320 | |
| 321 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 322 | /* Add a translation of vge to TT/TC. The translation is temporarily |
| 323 | in code[0 .. code_len-1]. |
| 324 | |
| 325 | pre: youngest_sector points to a valid (although possibly full) |
| 326 | sector. |
| 327 | */ |
| 328 | void VG_(add_to_trans_tab)( VexGuestExtents* vge, |
| 329 | Addr64 entry, |
| 330 | AddrH code, |
| 331 | UInt code_len ) |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 332 | { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 333 | Int tcAvailQ, reqdQ, y, i; |
| 334 | ULong *tce, *tce2; |
| 335 | UChar* srcP; |
| 336 | UChar* dstP; |
| 337 | |
sewardj | 663a1bd | 2005-04-24 11:22:44 +0000 | [diff] [blame] | 338 | vg_assert(init_done); |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 339 | vg_assert(vge->n_used >= 1 && vge->n_used <= 3); |
| 340 | vg_assert(code_len > 0 && code_len < 20000); |
| 341 | |
| 342 | if (0) |
| 343 | VG_(printf)("add_to_trans_tab(entry = 0x%llx, len = %d)\n", |
| 344 | entry, code_len); |
| 345 | |
| 346 | n_in_count++; |
| 347 | n_in_tsize += code_len; |
| 348 | n_in_osize += vge_osize(vge); |
| 349 | |
| 350 | y = youngest_sector; |
| 351 | vg_assert(isValidSector(y)); |
| 352 | |
| 353 | if (sectors[y].tc == NULL) |
| 354 | initialiseSector(y); |
| 355 | |
| 356 | /* Try putting the translation in this sector. */ |
| 357 | reqdQ = 1 + ((code_len + 7) >> 3); |
| 358 | |
| 359 | /* Will it fit in tc? */ |
| 360 | tcAvailQ = ((ULong*)(§ors[y].tc[tc_sector_szQ])) |
| 361 | - ((ULong*)(sectors[y].tc_next)); |
| 362 | vg_assert(tcAvailQ >= 0); |
| 363 | vg_assert(tcAvailQ <= tc_sector_szQ); |
| 364 | |
| 365 | if (tcAvailQ < reqdQ |
| 366 | || sectors[y].tt_n_inuse >= N_TTES_PER_SECTOR_USABLE) { |
| 367 | /* No. So move on to the next sector. Either it's never been |
| 368 | used before, in which case it will get its tt/tc allocated |
| 369 | now, or it has been used before, in which case it is set to be |
| 370 | empty, hence throwing out the oldest sector. */ |
| 371 | youngest_sector++; |
| 372 | if (youngest_sector >= N_SECTORS) |
| 373 | youngest_sector = 0; |
| 374 | y = youngest_sector; |
| 375 | initialiseSector(y); |
| 376 | } |
| 377 | |
| 378 | /* Be sure ... */ |
| 379 | tcAvailQ = ((ULong*)(§ors[y].tc[tc_sector_szQ])) |
| 380 | - ((ULong*)(sectors[y].tc_next)); |
| 381 | vg_assert(tcAvailQ >= 0); |
| 382 | vg_assert(tcAvailQ <= tc_sector_szQ); |
| 383 | vg_assert(tcAvailQ >= reqdQ); |
| 384 | vg_assert(sectors[y].tt_n_inuse < N_TTES_PER_SECTOR_USABLE); |
| 385 | vg_assert(sectors[y].tt_n_inuse >= 0); |
| 386 | |
| 387 | /* Copy into tc. */ |
| 388 | tce = sectors[y].tc_next; |
| 389 | vg_assert(tce >= §ors[y].tc[0]); |
| 390 | vg_assert(tce <= §ors[y].tc[tc_sector_szQ]); |
| 391 | |
| 392 | tce[0] = entry; |
| 393 | dstP = (UChar*)(&tce[1]); |
| 394 | srcP = (UChar*)code; |
| 395 | for (i = 0; i < code_len; i++) |
| 396 | dstP[i] = srcP[i]; |
| 397 | sectors[y].tc_next += reqdQ; |
| 398 | sectors[y].tt_n_inuse++; |
| 399 | |
| 400 | /* more paranoia */ |
| 401 | tce2 = sectors[y].tc_next; |
| 402 | vg_assert(tce2 >= §ors[y].tc[0]); |
| 403 | vg_assert(tce2 <= §ors[y].tc[tc_sector_szQ]); |
| 404 | |
| 405 | /* Find an empty tt slot, and use it. There must be such a slot |
| 406 | since tt is never allowed to get completely full. */ |
| 407 | i = HASH_TT(entry); |
| 408 | vg_assert(i >= 0 && i < N_TTES_PER_SECTOR); |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 409 | while (True) { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 410 | if (sectors[y].tt[i].status == Empty |
| 411 | || sectors[y].tt[i].status == Deleted) |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 412 | break; |
| 413 | i++; |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 414 | if (i >= N_TTES_PER_SECTOR) |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 415 | i = 0; |
| 416 | } |
sewardj | 22854b9 | 2002-11-30 14:00:47 +0000 | [diff] [blame] | 417 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 418 | sectors[y].tt[i].status = InUse; |
| 419 | sectors[y].tt[i].tce = tce; |
| 420 | sectors[y].tt[i].count = 0; |
| 421 | sectors[y].tt[i].weight = 1; |
| 422 | sectors[y].tt[i].vge = *vge; |
| 423 | sectors[y].tt[i].entry = entry; |
| 424 | |
| 425 | setFastCacheEntry( entry, tce, §ors[y].tt[i].count ); |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 429 | /* Search for the translation of the given guest address. If |
| 430 | requested, a successful search can also cause the fast-caches to be |
| 431 | updated. |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 432 | */ |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 433 | Bool VG_(search_transtab) ( /*OUT*/AddrH* result, |
| 434 | Addr64 guest_addr, |
| 435 | Bool upd_cache ) |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 436 | { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 437 | Int i, j, k, kstart, sno; |
sewardj | 663a1bd | 2005-04-24 11:22:44 +0000 | [diff] [blame] | 438 | |
| 439 | vg_assert(init_done); |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 440 | /* Find the initial probe point just once. It will be the same in |
| 441 | all sectors and avoids multiple expensive % operations. */ |
| 442 | n_full_lookups++; |
| 443 | k = -1; |
| 444 | kstart = HASH_TT(guest_addr); |
| 445 | vg_assert(kstart >= 0 && kstart < N_TTES_PER_SECTOR); |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 446 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 447 | /* Search in all the sectors. Although the order should not matter, |
| 448 | it might be most efficient to search in the order youngest to |
| 449 | oldest. */ |
| 450 | sno = youngest_sector; |
| 451 | for (i = 0; i < N_SECTORS; i++) { |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 452 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 453 | if (sectors[sno].tc == NULL) |
| 454 | goto notfound; /* sector not in use. */ |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 455 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 456 | k = kstart; |
| 457 | for (j = 0; j < N_TTES_PER_SECTOR; j++) { |
| 458 | n_lookup_probes++; |
| 459 | if (sectors[sno].tt[k].status == InUse |
| 460 | && sectors[sno].tt[k].entry == guest_addr) { |
| 461 | /* found it */ |
| 462 | if (upd_cache) |
| 463 | setFastCacheEntry( |
| 464 | guest_addr, sectors[sno].tt[k].tce, |
| 465 | §ors[sno].tt[k].count ); |
| 466 | if (result) |
| 467 | *result = sizeof(Addr64) + (AddrH)sectors[sno].tt[k].tce; |
| 468 | return True; |
| 469 | } |
| 470 | if (sectors[sno].tt[k].status == Empty) |
| 471 | break; /* not found in this sector */ |
| 472 | k++; |
| 473 | if (k == N_TTES_PER_SECTOR) |
| 474 | k = 0; |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 475 | } |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 476 | |
| 477 | /* If we fall off the end, all entries are InUse and not |
| 478 | matching, or Deleted. In any case we did not find it in this |
| 479 | sector. */ |
| 480 | |
| 481 | notfound: |
| 482 | /* move to the next oldest sector */ |
| 483 | sno = sno==0 ? (N_SECTORS-1) : (sno-1); |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 484 | } |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 485 | |
| 486 | /* Not found in any sector. */ |
| 487 | return False; |
sewardj | 6c3769f | 2002-11-29 01:02:45 +0000 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 491 | /* Delete all translations which intersect with any part of the |
| 492 | specified guest address range. Note, this is SLOW. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 493 | */ |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 494 | |
| 495 | static inline |
| 496 | Bool overlap1 ( Addr64 s1, UInt r1, Addr64 s2, UInt r2 ) |
| 497 | { |
| 498 | Addr64 e1 = s1 + (ULong)r1 - 1ULL; |
| 499 | Addr64 e2 = s2 + (ULong)r1 - 1ULL; |
| 500 | if (e1 < s2 || e2 < s1) |
| 501 | return False; |
| 502 | return True; |
| 503 | } |
| 504 | |
| 505 | static inline |
| 506 | Bool overlaps ( Addr64 start, UInt range, VexGuestExtents* vge ) |
| 507 | { |
| 508 | if (overlap1(start, range, vge->base[0], (UInt)vge->len[0])) |
| 509 | return True; |
| 510 | if (vge->n_used < 2) |
| 511 | return False; |
| 512 | if (overlap1(start, range, vge->base[1], (UInt)vge->len[1])) |
| 513 | return True; |
| 514 | if (vge->n_used < 3) |
| 515 | return False; |
| 516 | if (overlap1(start, range, vge->base[2], (UInt)vge->len[2])) |
| 517 | return True; |
| 518 | return False; |
| 519 | } |
| 520 | |
| 521 | |
| 522 | void VG_(discard_translations) ( Addr64 guest_start, UInt range ) |
| 523 | { |
| 524 | Int sno, i; |
| 525 | Bool anyDeleted = False; |
| 526 | |
sewardj | 663a1bd | 2005-04-24 11:22:44 +0000 | [diff] [blame] | 527 | vg_assert(init_done); |
| 528 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 529 | for (sno = 0; sno < N_SECTORS; sno++) { |
| 530 | if (sectors[sno].tc == NULL) |
| 531 | continue; |
| 532 | for (i = 0; i < N_TTES_PER_SECTOR; i++) { |
| 533 | if (sectors[sno].tt[i].status == InUse |
| 534 | && overlaps( guest_start, range, §ors[sno].tt[i].vge )) { |
| 535 | sectors[sno].tt[i].status = Deleted; |
| 536 | sectors[sno].tt_n_inuse--; |
| 537 | anyDeleted = True; |
| 538 | n_disc_count++; |
| 539 | n_disc_osize += vge_osize(§ors[sno].tt[i].vge); |
| 540 | } |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | if (anyDeleted) |
| 545 | invalidateFastCache(); |
| 546 | } |
| 547 | |
| 548 | |
| 549 | /*------------------------------------------------------------*/ |
| 550 | /*--- Sanity checking ---*/ |
| 551 | /*------------------------------------------------------------*/ |
| 552 | |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 553 | void VG_(sanity_check_tt_tc) ( Char* who ) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 554 | { |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 555 | } |
| 556 | |
| 557 | |
| 558 | /*------------------------------------------------------------*/ |
| 559 | /*--- Initialisation. ---*/ |
| 560 | /*------------------------------------------------------------*/ |
| 561 | |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 562 | void VG_(init_tt_tc) ( void ) |
| 563 | { |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 564 | Int i, avg_codeszQ; |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 565 | |
sewardj | 663a1bd | 2005-04-24 11:22:44 +0000 | [diff] [blame] | 566 | vg_assert(!init_done); |
| 567 | init_done = True; |
| 568 | |
sewardj | 4ccf707 | 2004-11-28 16:58:05 +0000 | [diff] [blame] | 569 | /* Otherwise lots of things go wrong... */ |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 570 | vg_assert(sizeof(ULong) == 8); |
| 571 | vg_assert(sizeof(Addr64) == 8); |
| 572 | |
| 573 | if (VG_(clo_verbosity) > 2) |
| 574 | VG_(message)(Vg_DebugMsg, |
| 575 | "TT/TC: VG_(init_tt_tc) " |
| 576 | "(startup of code management)"); |
| 577 | |
| 578 | /* Figure out how big each tc area should be. */ |
njn | 43b9a8a | 2005-05-10 04:37:01 +0000 | [diff] [blame^] | 579 | avg_codeszQ = (VG_(details).avg_translation_sizeB + 7) / 8; |
| 580 | tc_sector_szQ = N_TTES_PER_SECTOR_USABLE * (1 + avg_codeszQ); |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 581 | |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 582 | /* Ensure the calculated value is not way crazy. */ |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 583 | vg_assert(tc_sector_szQ >= 2 * N_TTES_PER_SECTOR_USABLE); |
| 584 | vg_assert(tc_sector_szQ <= 50 * N_TTES_PER_SECTOR_USABLE); |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 585 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 586 | /* Initialise the sectors */ |
| 587 | youngest_sector = 0; |
| 588 | for (i = 0; i < N_SECTORS; i++) { |
| 589 | sectors[i].tc = NULL; |
| 590 | sectors[i].tt = NULL; |
| 591 | sectors[i].tc_next = NULL; |
| 592 | sectors[i].tt_n_inuse = 0; |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 593 | } |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 594 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 595 | /* and the fast caches. */ |
| 596 | invalidateFastCache(); |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 597 | |
| 598 | if (VG_(clo_verbosity) > 2) { |
| 599 | VG_(message)(Vg_DebugMsg, |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 600 | "TT/TC: cache: %d sectors of %d bytes each = %d total", |
| 601 | N_SECTORS, 8 * tc_sector_szQ, |
| 602 | N_SECTORS * 8 * tc_sector_szQ ); |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 603 | VG_(message)(Vg_DebugMsg, |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 604 | "TT/TC: table: %d total entries, max occupancy %d (%d%%)", |
| 605 | N_SECTORS * N_TTES_PER_SECTOR, |
| 606 | N_SECTORS * N_TTES_PER_SECTOR_USABLE, |
| 607 | SECTOR_TT_LIMIT_PERCENT ); |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | |
| 612 | /*------------------------------------------------------------*/ |
| 613 | /*--- Printing out statistics. ---*/ |
| 614 | /*------------------------------------------------------------*/ |
| 615 | |
| 616 | static ULong safe_idiv( ULong a, ULong b ) |
| 617 | { |
| 618 | return (b == 0 ? 0 : a / b); |
| 619 | } |
| 620 | |
| 621 | UInt VG_(get_bbs_translated) ( void ) |
| 622 | { |
| 623 | return n_in_count; |
| 624 | } |
| 625 | |
| 626 | void VG_(print_tt_tc_stats) ( void ) |
| 627 | { |
| 628 | VG_(message)(Vg_DebugMsg, |
| 629 | " tt/tc: %llu tt lookups requiring %llu probes", |
| 630 | n_full_lookups, n_lookup_probes ); |
| 631 | VG_(message)(Vg_DebugMsg, |
| 632 | " tt/tc: %llu fast-cache updates, %llu flushes", |
| 633 | n_fast_updates, n_fast_flushes ); |
| 634 | |
| 635 | VG_(message)(Vg_DebugMsg, |
| 636 | "translate: new %lld (%lld -> %lld; ratio %lld:10)", |
| 637 | n_in_count, n_in_osize, n_in_tsize, |
| 638 | safe_idiv(10*n_in_tsize, n_in_osize)); |
| 639 | VG_(message)(Vg_DebugMsg, |
| 640 | "translate: dumped %lld (%lld -> ?" "?)", |
| 641 | n_dump_count, n_dump_osize ); |
| 642 | VG_(message)(Vg_DebugMsg, |
| 643 | "translate: discarded %lld (%lld -> ?" "?)", |
| 644 | n_disc_count, n_disc_osize ); |
| 645 | } |
| 646 | |
| 647 | /*------------------------------------------------------------*/ |
| 648 | /*--- Printing out of profiling results. ---*/ |
| 649 | /*------------------------------------------------------------*/ |
| 650 | |
| 651 | /* Only the top N_MAX bbs will be displayed. */ |
sewardj | f9f1949 | 2005-01-24 10:42:46 +0000 | [diff] [blame] | 652 | #define N_MAX 200 |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 653 | |
| 654 | static TTEntry* tops[N_MAX]; |
| 655 | |
| 656 | static ULong score ( TTEntry* tte ) |
| 657 | { |
| 658 | return ((ULong)tte->weight) * ((ULong)tte->count); |
| 659 | } |
| 660 | |
| 661 | static Bool heavier ( TTEntry* t1, TTEntry* t2 ) |
| 662 | { |
| 663 | return score(t1) > score(t2); |
| 664 | } |
| 665 | |
| 666 | /* Print n/m in form xx.yy% */ |
| 667 | static |
| 668 | void percentify ( ULong n, ULong m, Int field_width, Char* buf) |
| 669 | { |
| 670 | Int i, len, space; |
| 671 | ULong lo, hi; |
| 672 | if (m == 0) m = 1; /* stay sane */ |
| 673 | hi = (n * 100) / m; |
| 674 | lo = (((n * 100) - hi * m) * 100) / m; |
| 675 | vg_assert(lo < 100); |
| 676 | if (lo < 10) |
| 677 | VG_(sprintf)(buf, "%lld.0%lld%%", hi, lo); |
| 678 | else |
| 679 | VG_(sprintf)(buf, "%lld.%lld%%", hi, lo); |
| 680 | |
| 681 | len = VG_(strlen)(buf); |
| 682 | space = field_width - len; |
| 683 | if (space < 0) space = 0; /* Allow for v. small field_width */ |
| 684 | i = len; |
| 685 | |
| 686 | /* Right justify in field */ |
| 687 | for ( ; i >= 0; i--) buf[i + space] = buf[i]; |
| 688 | for (i = 0; i < space; i++) buf[i] = ' '; |
| 689 | } |
| 690 | |
| 691 | |
| 692 | void VG_(show_BB_profile) ( void ) |
| 693 | { |
| 694 | Char name[64]; |
| 695 | Int sno, i, r, s; |
| 696 | ULong score_total, score_cumul, score_here; |
| 697 | Char buf_cumul[10]; |
| 698 | Char buf_here[10]; |
| 699 | |
| 700 | /* First, compute the total weighted count, and find the top N |
| 701 | ttes. tops contains pointers to the most-used N_MAX blocks, in |
| 702 | descending order (viz, tops[0] is the highest scorer). */ |
| 703 | for (i = 0; i < N_MAX; i++) |
| 704 | tops[i] = NULL; |
| 705 | |
| 706 | score_total = 0; |
| 707 | |
| 708 | for (sno = 0; sno < N_SECTORS; sno++) { |
| 709 | if (sectors[sno].tc == NULL) |
| 710 | continue; |
| 711 | for (i = 0; i < N_TTES_PER_SECTOR; i++) { |
| 712 | if (sectors[sno].tt[i].status != InUse) |
| 713 | continue; |
| 714 | score_total += score(§ors[sno].tt[i]); |
| 715 | /* Find the rank for sectors[sno].tt[i]. */ |
| 716 | r = N_MAX-1; |
| 717 | while (True) { |
| 718 | if (r == -1) |
| 719 | break; |
| 720 | if (tops[r] == NULL) { |
| 721 | r--; |
| 722 | continue; |
| 723 | } |
| 724 | if (heavier(§ors[sno].tt[i], tops[r])) { |
| 725 | r--; |
| 726 | continue; |
| 727 | } |
| 728 | break; |
| 729 | } |
| 730 | r++; |
| 731 | vg_assert(r >= 0 && r <= N_MAX); |
| 732 | /* This bb should be placed at r, and bbs above it shifted |
| 733 | upwards one slot. */ |
| 734 | if (r < N_MAX) { |
| 735 | for (s = N_MAX-1; s > r; s--) |
| 736 | tops[s] = tops[s-1]; |
| 737 | tops[r] = §ors[sno].tt[i]; |
| 738 | } |
| 739 | } |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 740 | } |
| 741 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 742 | VG_(printf)("\n"); |
| 743 | VG_(printf)("------------------------------------------------------------\n"); |
| 744 | VG_(printf)("--- BEGIN BB Profile (summary of scores) ---\n"); |
| 745 | VG_(printf)("------------------------------------------------------------\n"); |
| 746 | VG_(printf)("\n"); |
| 747 | |
| 748 | VG_(printf)("Total score = %lld\n\n", score_total); |
| 749 | |
| 750 | score_cumul = 0; |
| 751 | for (r = 0; r < N_MAX; r++) { |
| 752 | if (tops[r] == NULL) |
| 753 | continue; |
| 754 | name[0] = 0; |
| 755 | VG_(get_fnname_w_offset)(tops[r]->entry, name, 64); |
| 756 | name[63] = 0; |
| 757 | score_here = score(tops[r]); |
| 758 | score_cumul += score_here; |
| 759 | percentify(score_cumul, score_total, 6, buf_cumul); |
| 760 | percentify(score_here, score_total, 6, buf_here); |
| 761 | VG_(printf)("%3d: (%9lld %s) %9lld %s 0x%llx %s\n", |
| 762 | r, |
| 763 | score_cumul, buf_cumul, |
| 764 | score_here, buf_here, tops[r]->entry, name ); |
| 765 | } |
| 766 | |
| 767 | VG_(printf)("\n"); |
| 768 | VG_(printf)("------------------------------------------------------------\n"); |
| 769 | VG_(printf)("--- BB Profile (BB details) ---\n"); |
| 770 | VG_(printf)("------------------------------------------------------------\n"); |
| 771 | VG_(printf)("\n"); |
| 772 | |
| 773 | score_cumul = 0; |
| 774 | for (r = 0; r < N_MAX; r++) { |
| 775 | if (tops[r] == NULL) |
| 776 | continue; |
| 777 | name[0] = 0; |
| 778 | VG_(get_fnname_w_offset)(tops[r]->entry, name, 64); |
| 779 | name[63] = 0; |
| 780 | score_here = score(tops[r]); |
| 781 | score_cumul += score_here; |
| 782 | percentify(score_cumul, score_total, 6, buf_cumul); |
| 783 | percentify(score_here, score_total, 6, buf_here); |
| 784 | VG_(printf)("\n"); |
| 785 | VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= begin BB rank %d " |
| 786 | "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r); |
| 787 | VG_(printf)("%3d: (%9lld %s) %9lld %s 0x%llx %s\n", |
| 788 | r, |
| 789 | score_cumul, buf_cumul, |
| 790 | score_here, buf_here, tops[r]->entry, name ); |
| 791 | VG_(printf)("\n"); |
| 792 | VG_(translate)(0, tops[r]->entry, True, VG_(clo_profile_flags)); |
| 793 | VG_(printf)("=-=-=-=-=-=-=-=-=-=-=-=-=-= end BB rank %d " |
| 794 | "=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n", r); |
| 795 | } |
| 796 | |
| 797 | VG_(printf)("\n"); |
| 798 | VG_(printf)("------------------------------------------------------------\n"); |
| 799 | VG_(printf)("--- END BB Profile ---\n"); |
| 800 | VG_(printf)("------------------------------------------------------------\n"); |
| 801 | VG_(printf)("\n"); |
sewardj | c0d8f68 | 2002-11-30 00:49:43 +0000 | [diff] [blame] | 802 | } |
| 803 | |
sewardj | fa8ec11 | 2005-01-19 11:55:34 +0000 | [diff] [blame] | 804 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 805 | /*--------------------------------------------------------------------*/ |
| 806 | /*--- end vg_transtab.c ---*/ |
| 807 | /*--------------------------------------------------------------------*/ |