sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- A header file for all parts of Valgrind. ---*/ |
| 4 | /*--- Include no other! ---*/ |
| 5 | /*--- vg_include.h ---*/ |
| 6 | /*--------------------------------------------------------------------*/ |
| 7 | |
| 8 | /* |
| 9 | This file is part of Valgrind, an x86 protected-mode emulator |
| 10 | designed for debugging and profiling binaries on x86-Unixes. |
| 11 | |
| 12 | Copyright (C) 2000-2002 Julian Seward |
| 13 | jseward@acm.org |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 14 | |
| 15 | This program is free software; you can redistribute it and/or |
| 16 | modify it under the terms of the GNU General Public License as |
| 17 | published by the Free Software Foundation; either version 2 of the |
| 18 | License, or (at your option) any later version. |
| 19 | |
| 20 | This program is distributed in the hope that it will be useful, but |
| 21 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 23 | General Public License for more details. |
| 24 | |
| 25 | You should have received a copy of the GNU General Public License |
| 26 | along with this program; if not, write to the Free Software |
| 27 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 28 | 02111-1307, USA. |
| 29 | |
| 30 | The GNU General Public License is contained in the file LICENSE. |
| 31 | */ |
| 32 | |
| 33 | #ifndef __VG_INCLUDE_H |
| 34 | #define __VG_INCLUDE_H |
| 35 | |
| 36 | |
| 37 | #include <stdarg.h> /* ANSI varargs stuff */ |
| 38 | #include <setjmp.h> /* for jmp_buf */ |
| 39 | |
| 40 | |
| 41 | /* --------------------------------------------------------------------- |
| 42 | Build options and table sizes. You should be able to change these |
| 43 | options or sizes, recompile, and still have a working system. |
| 44 | ------------------------------------------------------------------ */ |
| 45 | |
| 46 | #include "vg_constants.h" |
| 47 | |
| 48 | |
| 49 | /* Set to 1 to enable time profiling. Since this uses SIGPROF, we |
| 50 | don't want this permanently enabled -- only for profiling |
| 51 | builds. */ |
| 52 | #if 0 |
| 53 | # define VG_PROFILE |
| 54 | #endif |
| 55 | |
| 56 | |
| 57 | /* Total number of integer registers available for allocation. That's |
| 58 | all of them except %esp, %edi and %ebp. %edi is a general spare |
| 59 | temporary. %ebp permanently points at VG_(baseBlock). Note that |
| 60 | it's important that this tie in with what rankToRealRegNo() says. |
| 61 | DO NOT CHANGE THIS VALUE FROM 5. ! */ |
| 62 | #define VG_MAX_REALREGS 5 |
| 63 | |
| 64 | /* Total number of spill slots available for allocation, if a TempReg |
| 65 | doesn't make it into a RealReg. Just bomb the entire system if |
| 66 | this value is too small; we don't expect it will ever get |
| 67 | particularly high. */ |
| 68 | #define VG_MAX_SPILLSLOTS 24 |
| 69 | |
| 70 | |
| 71 | /* Constants for the slow translation lookup cache. */ |
| 72 | #define VG_TRANSTAB_SLOW_BITS 11 |
| 73 | #define VG_TRANSTAB_SLOW_SIZE (1 << VG_TRANSTAB_SLOW_BITS) |
| 74 | #define VG_TRANSTAB_SLOW_MASK ((VG_TRANSTAB_SLOW_SIZE) - 1) |
| 75 | |
| 76 | /* Size of a buffer used for creating messages. */ |
| 77 | #define M_VG_MSGBUF 10000 |
| 78 | |
| 79 | /* Size of a smallish table used to read /proc/self/map entries. */ |
| 80 | #define M_PROCMAP_BUF 20000 |
| 81 | |
| 82 | /* Max length of pathname to a .so/executable file. */ |
| 83 | #define M_VG_LIBNAMESTR 100 |
| 84 | |
| 85 | /* Max length of a text fragment used to construct error messages. */ |
| 86 | #define M_VG_ERRTXT 512 |
| 87 | |
| 88 | /* Max length of the string copied from env var VG_ARGS at startup. */ |
| 89 | #define M_VG_CMDLINE_STRLEN 1000 |
| 90 | |
| 91 | /* Max number of options for Valgrind which we can handle. */ |
| 92 | #define M_VG_CMDLINE_OPTS 100 |
| 93 | |
| 94 | /* After this many different unsuppressed errors have been observed, |
| 95 | be more conservative about collecting new ones. */ |
| 96 | #define M_VG_COLLECT_ERRORS_SLOWLY_AFTER 50 |
| 97 | |
| 98 | /* After this many different unsuppressed errors have been observed, |
| 99 | stop collecting errors at all, and tell the user their program is |
| 100 | evidently a steaming pile of camel dung. */ |
| 101 | #define M_VG_COLLECT_NO_ERRORS_AFTER 500 |
| 102 | |
| 103 | /* These many bytes below %ESP are considered addressible if we're |
| 104 | doing the --workaround-gcc296-bugs hack. */ |
| 105 | #define VG_GCC296_BUG_STACK_SLOP 256 |
| 106 | |
| 107 | /* The maximum number of calls we're prepared to save in a |
| 108 | backtrace. */ |
| 109 | #define VG_DEEPEST_BACKTRACE 50 |
| 110 | |
| 111 | /* Number of lists in which we keep track of malloc'd but not free'd |
| 112 | blocks. Should be prime. */ |
| 113 | #define VG_N_MALLOCLISTS 997 |
| 114 | |
| 115 | /* Number of lists in which we keep track of ExeContexts. Should be |
| 116 | prime. */ |
| 117 | #define VG_N_EC_LISTS /*997*/ 4999 |
| 118 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 119 | /* Defines the thread-scheduling timeslice, in terms of the number of |
| 120 | basic blocks we attempt to run each thread for. Smaller values |
| 121 | give finer interleaving but much increased scheduling overheads. */ |
| 122 | #define VG_SCHEDULING_QUANTUM 10000 |
| 123 | |
| 124 | /* The maximum number of pthreads that we support. This is |
| 125 | deliberately not very high since our implementation of some of the |
| 126 | scheduler algorithms is surely O(N^2) in the number of threads, |
| 127 | since that's simple, at least. And (in practice) we hope that most |
| 128 | programs do not need many threads. */ |
| 129 | #define VG_N_THREADS 20 |
| 130 | |
| 131 | /* Number of file descriptors that can simultaneously be waited on for |
| 132 | I/O to complete. Perhaps this should be the same as VG_N_THREADS |
| 133 | (surely a thread can't wait on more than one fd at once?. Who |
| 134 | knows.) */ |
| 135 | #define VG_N_WAITING_FDS 10 |
| 136 | |
| 137 | /* Maximum number of mutexes allowed. */ |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 138 | #define VG_N_MUTEXES 30 |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 139 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 140 | |
| 141 | /* --------------------------------------------------------------------- |
| 142 | Basic types |
| 143 | ------------------------------------------------------------------ */ |
| 144 | |
| 145 | typedef unsigned char UChar; |
| 146 | typedef unsigned short UShort; |
| 147 | typedef unsigned int UInt; |
| 148 | typedef unsigned long long int ULong; |
| 149 | |
| 150 | typedef signed char Char; |
| 151 | typedef signed short Short; |
| 152 | typedef signed int Int; |
| 153 | typedef signed long long int Long; |
| 154 | |
| 155 | typedef unsigned int Addr; |
| 156 | |
| 157 | typedef unsigned char Bool; |
| 158 | #define False ((Bool)0) |
| 159 | #define True ((Bool)1) |
| 160 | |
| 161 | #define mycat_wrk(aaa,bbb) aaa##bbb |
| 162 | #define mycat(aaa,bbb) mycat_wrk(aaa,bbb) |
| 163 | |
| 164 | /* Just pray that gcc's constant folding works properly ... */ |
| 165 | #define BITS(bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0) \ |
| 166 | ( ((bit7) << 7) | ((bit6) << 6) | ((bit5) << 5) | ((bit4) << 4) \ |
| 167 | | ((bit3) << 3) | ((bit2) << 2) | ((bit1) << 1) | (bit0)) |
| 168 | |
| 169 | |
| 170 | /* --------------------------------------------------------------------- |
| 171 | Now the basic types are set up, we can haul in the kernel-interface |
| 172 | definitions. |
| 173 | ------------------------------------------------------------------ */ |
| 174 | |
| 175 | #include "./vg_kerneliface.h" |
| 176 | |
| 177 | |
| 178 | /* --------------------------------------------------------------------- |
| 179 | Command-line-settable options |
| 180 | ------------------------------------------------------------------ */ |
| 181 | |
| 182 | #define VG_CLO_SMC_NONE 0 |
| 183 | #define VG_CLO_SMC_SOME 1 |
| 184 | #define VG_CLO_SMC_ALL 2 |
| 185 | |
| 186 | #define VG_CLO_MAX_SFILES 10 |
| 187 | |
sewardj | 97ced73 | 2002-03-25 00:07:36 +0000 | [diff] [blame] | 188 | /* Shall we V-check addrs (they are always A checked too): default: YES */ |
| 189 | extern Bool VG_(clo_check_addrVs); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 190 | /* Enquire about whether to attach to GDB at errors? default: NO */ |
| 191 | extern Bool VG_(clo_GDB_attach); |
| 192 | /* Sanity-check level: 0 = none, 1 (default), > 1 = expensive. */ |
| 193 | extern Int VG_(sanity_level); |
| 194 | /* Verbosity level: 0 = silent, 1 (default), > 1 = more verbose. */ |
| 195 | extern Int VG_(clo_verbosity); |
| 196 | /* Automatically attempt to demangle C++ names? default: YES */ |
| 197 | extern Bool VG_(clo_demangle); |
| 198 | /* Do leak check at exit? default: NO */ |
| 199 | extern Bool VG_(clo_leak_check); |
| 200 | /* In leak check, show reachable-but-not-freed blocks? default: NO */ |
| 201 | extern Bool VG_(clo_show_reachable); |
| 202 | /* How closely should we compare ExeContexts in leak records? default: 2 */ |
| 203 | extern Int VG_(clo_leak_resolution); |
| 204 | /* Round malloc sizes upwards to integral number of words? default: |
| 205 | NO */ |
| 206 | extern Bool VG_(clo_sloppy_malloc); |
| 207 | /* Allow loads from partially-valid addresses? default: YES */ |
| 208 | extern Bool VG_(clo_partial_loads_ok); |
| 209 | /* Simulate child processes? default: NO */ |
| 210 | extern Bool VG_(clo_trace_children); |
| 211 | /* The file id on which we send all messages. default: 2 (stderr). */ |
| 212 | extern Int VG_(clo_logfile_fd); |
| 213 | /* Max volume of the freed blocks queue. */ |
| 214 | extern Int VG_(clo_freelist_vol); |
| 215 | /* Assume accesses immediately below %esp are due to gcc-2.96 bugs. |
| 216 | default: NO */ |
| 217 | extern Bool VG_(clo_workaround_gcc296_bugs); |
| 218 | |
| 219 | /* The number of suppression files specified. */ |
| 220 | extern Int VG_(clo_n_suppressions); |
| 221 | /* The names of the suppression files. */ |
| 222 | extern Char* VG_(clo_suppressions)[VG_CLO_MAX_SFILES]; |
| 223 | |
| 224 | /* Single stepping? default: NO */ |
| 225 | extern Bool VG_(clo_single_step); |
| 226 | /* Code improvement? default: YES */ |
| 227 | extern Bool VG_(clo_optimise); |
| 228 | /* Memory-check instrumentation? default: YES */ |
| 229 | extern Bool VG_(clo_instrument); |
| 230 | /* DEBUG: clean up instrumented code? default: YES */ |
| 231 | extern Bool VG_(clo_cleanup); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 232 | /* SMC write checks? default: SOME (1,2,4 byte movs to mem) */ |
| 233 | extern Int VG_(clo_smc_check); |
| 234 | /* DEBUG: print system calls? default: NO */ |
| 235 | extern Bool VG_(clo_trace_syscalls); |
| 236 | /* DEBUG: print signal details? default: NO */ |
| 237 | extern Bool VG_(clo_trace_signals); |
| 238 | /* DEBUG: print symtab details? default: NO */ |
| 239 | extern Bool VG_(clo_trace_symtab); |
| 240 | /* DEBUG: print malloc details? default: NO */ |
| 241 | extern Bool VG_(clo_trace_malloc); |
sewardj | 8937c81 | 2002-04-12 20:12:20 +0000 | [diff] [blame] | 242 | /* DEBUG: print thread scheduling events? default: NO */ |
| 243 | extern Bool VG_(clo_trace_sched); |
sewardj | 45b4b37 | 2002-04-16 22:50:32 +0000 | [diff] [blame] | 244 | /* DEBUG: print pthread (mutex etc) events? default: 0 (none), 1 |
| 245 | (some), 2 (all) */ |
| 246 | extern Int VG_(clo_trace_pthread_level); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 247 | /* Stop after this many basic blocks. default: Infinity. */ |
| 248 | extern ULong VG_(clo_stop_after); |
| 249 | /* Display gory details for the k'th most popular error. default: |
| 250 | Infinity. */ |
| 251 | extern Int VG_(clo_dump_error); |
| 252 | /* Number of parents of a backtrace. Default: 8. */ |
| 253 | extern Int VG_(clo_backtrace_size); |
| 254 | |
| 255 | |
| 256 | /* --------------------------------------------------------------------- |
| 257 | Debugging and profiling stuff |
| 258 | ------------------------------------------------------------------ */ |
| 259 | |
| 260 | /* No, really. I _am_ that strange. */ |
| 261 | #define OINK(nnn) VG_(message)(Vg_DebugMsg, "OINK %d",nnn) |
| 262 | |
| 263 | /* Tools for building messages from multiple parts. */ |
| 264 | typedef |
| 265 | enum { Vg_UserMsg, Vg_DebugMsg, Vg_DebugExtraMsg } |
| 266 | VgMsgKind; |
| 267 | |
| 268 | extern void VG_(start_msg) ( VgMsgKind kind ); |
| 269 | extern void VG_(add_to_msg) ( Char* format, ... ); |
| 270 | extern void VG_(end_msg) ( void ); |
| 271 | |
| 272 | /* Send a simple, single-part message. */ |
| 273 | extern void VG_(message) ( VgMsgKind kind, Char* format, ... ); |
| 274 | |
| 275 | /* Create a logfile into which messages can be dumped. */ |
| 276 | extern void VG_(startup_logging) ( void ); |
| 277 | extern void VG_(shutdown_logging) ( void ); |
| 278 | |
| 279 | |
| 280 | /* Profiling stuff */ |
| 281 | #ifdef VG_PROFILE |
| 282 | |
| 283 | #define VGP_M_STACK 10 |
| 284 | |
| 285 | #define VGP_M_CCS 20 /* == the # of elems in VGP_LIST */ |
| 286 | #define VGP_LIST \ |
| 287 | VGP_PAIR(VgpRun=0, "running"), \ |
| 288 | VGP_PAIR(VgpMalloc, "low-lev malloc/free"), \ |
| 289 | VGP_PAIR(VgpCliMalloc, "client malloc/free"), \ |
| 290 | VGP_PAIR(VgpTranslate, "translate-main"), \ |
| 291 | VGP_PAIR(VgpToUCode, "to-ucode"), \ |
| 292 | VGP_PAIR(VgpFromUcode, "from-ucode"), \ |
| 293 | VGP_PAIR(VgpImprove, "improve"), \ |
| 294 | VGP_PAIR(VgpInstrument, "instrument"), \ |
| 295 | VGP_PAIR(VgpCleanup, "cleanup"), \ |
| 296 | VGP_PAIR(VgpRegAlloc, "reg-alloc"), \ |
| 297 | VGP_PAIR(VgpDoLRU, "do-lru"), \ |
| 298 | VGP_PAIR(VgpSlowFindT, "slow-search-transtab"), \ |
| 299 | VGP_PAIR(VgpInitAudit, "init-mem-audit"), \ |
| 300 | VGP_PAIR(VgpExeContext, "exe-context"), \ |
| 301 | VGP_PAIR(VgpReadSyms, "read-syms"), \ |
| 302 | VGP_PAIR(VgpAddToT, "add-to-transtab"), \ |
| 303 | VGP_PAIR(VgpSARP, "set-addr-range-perms"), \ |
| 304 | VGP_PAIR(VgpSyscall, "syscall wrapper"), \ |
| 305 | VGP_PAIR(VgpSpare1, "spare 1"), \ |
| 306 | VGP_PAIR(VgpSpare2, "spare 2") |
| 307 | |
| 308 | #define VGP_PAIR(enumname,str) enumname |
| 309 | typedef enum { VGP_LIST } VgpCC; |
| 310 | #undef VGP_PAIR |
| 311 | |
| 312 | extern void VGP_(init_profiling) ( void ); |
| 313 | extern void VGP_(done_profiling) ( void ); |
| 314 | extern void VGP_(pushcc) ( VgpCC ); |
| 315 | extern void VGP_(popcc) ( void ); |
| 316 | |
| 317 | #define VGP_PUSHCC(cc) VGP_(pushcc)(cc) |
| 318 | #define VGP_POPCC VGP_(popcc)() |
| 319 | |
| 320 | #else |
| 321 | |
| 322 | #define VGP_PUSHCC(cc) /* */ |
| 323 | #define VGP_POPCC /* */ |
| 324 | |
| 325 | #endif /* VG_PROFILE */ |
| 326 | |
| 327 | |
| 328 | /* --------------------------------------------------------------------- |
| 329 | Exports of vg_malloc2.c |
| 330 | ------------------------------------------------------------------ */ |
| 331 | |
| 332 | /* Allocation arenas. |
| 333 | SYMTAB is for Valgrind's symbol table storage. |
| 334 | CLIENT is for the client's mallocs/frees. |
| 335 | DEMANGLE is for the C++ demangler. |
| 336 | EXECTXT is for storing ExeContexts. |
| 337 | ERRCTXT is for storing ErrContexts. |
| 338 | PRIVATE is for Valgrind general stuff. |
| 339 | TRANSIENT is for very short-term use. It should be empty |
| 340 | in between uses. |
| 341 | When adding a new arena, remember also to add it |
| 342 | to ensure_mm_init(). |
| 343 | */ |
| 344 | typedef Int ArenaId; |
| 345 | |
| 346 | #define VG_N_ARENAS 7 |
| 347 | |
| 348 | #define VG_AR_PRIVATE 0 /* :: ArenaId */ |
| 349 | #define VG_AR_SYMTAB 1 /* :: ArenaId */ |
| 350 | #define VG_AR_CLIENT 2 /* :: ArenaId */ |
| 351 | #define VG_AR_DEMANGLE 3 /* :: ArenaId */ |
| 352 | #define VG_AR_EXECTXT 4 /* :: ArenaId */ |
| 353 | #define VG_AR_ERRCTXT 5 /* :: ArenaId */ |
| 354 | #define VG_AR_TRANSIENT 6 /* :: ArenaId */ |
| 355 | |
| 356 | extern void* VG_(malloc) ( ArenaId arena, Int nbytes ); |
| 357 | extern void VG_(free) ( ArenaId arena, void* ptr ); |
| 358 | extern void* VG_(calloc) ( ArenaId arena, Int nmemb, Int nbytes ); |
| 359 | extern void* VG_(realloc) ( ArenaId arena, void* ptr, Int size ); |
| 360 | extern void* VG_(malloc_aligned) ( ArenaId aid, Int req_alignB, |
| 361 | Int req_pszB ); |
| 362 | |
| 363 | extern void VG_(mallocSanityCheckArena) ( ArenaId arena ); |
| 364 | extern void VG_(mallocSanityCheckAll) ( void ); |
| 365 | |
| 366 | extern void VG_(show_all_arena_stats) ( void ); |
| 367 | extern Bool VG_(is_empty_arena) ( ArenaId aid ); |
| 368 | |
| 369 | |
| 370 | /* The red-zone size for the client. This can be arbitrary, but |
| 371 | unfortunately must be set at compile time. */ |
| 372 | #define VG_AR_CLIENT_REDZONE_SZW 4 |
| 373 | |
| 374 | #define VG_AR_CLIENT_REDZONE_SZB \ |
| 375 | (VG_AR_CLIENT_REDZONE_SZW * VKI_BYTES_PER_WORD) |
| 376 | |
| 377 | |
| 378 | /* --------------------------------------------------------------------- |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 379 | Exports of vg_clientfuns.c |
| 380 | ------------------------------------------------------------------ */ |
| 381 | |
| 382 | /* This doesn't export code or data that valgrind.so needs to link |
| 383 | against. However, the scheduler does need to know the following |
| 384 | request codes. A few, publically-visible, request codes are also |
| 385 | defined in valgrind.h. */ |
| 386 | |
| 387 | #define VG_USERREQ__MALLOC 0x2001 |
| 388 | #define VG_USERREQ__BUILTIN_NEW 0x2002 |
| 389 | #define VG_USERREQ__BUILTIN_VEC_NEW 0x2003 |
| 390 | |
| 391 | #define VG_USERREQ__FREE 0x2004 |
| 392 | #define VG_USERREQ__BUILTIN_DELETE 0x2005 |
| 393 | #define VG_USERREQ__BUILTIN_VEC_DELETE 0x2006 |
| 394 | |
| 395 | #define VG_USERREQ__CALLOC 0x2007 |
| 396 | #define VG_USERREQ__REALLOC 0x2008 |
| 397 | #define VG_USERREQ__MEMALIGN 0x2009 |
| 398 | |
| 399 | |
| 400 | #define VG_USERREQ__PTHREAD_CREATE 0x3001 |
sewardj | bc5b99f | 2002-04-13 00:08:51 +0000 | [diff] [blame] | 401 | #define VG_USERREQ__PTHREAD_JOIN 0x3002 |
| 402 | #define VG_USERREQ__PTHREAD_GET_THREADID 0x3003 |
| 403 | #define VG_USERREQ__PTHREAD_MUTEX_INIT 0x3004 |
| 404 | #define VG_USERREQ__PTHREAD_MUTEX_LOCK 0x3005 |
| 405 | #define VG_USERREQ__PTHREAD_MUTEX_UNLOCK 0x3006 |
| 406 | #define VG_USERREQ__PTHREAD_MUTEX_DESTROY 0x3007 |
| 407 | #define VG_USERREQ__PTHREAD_CANCEL 0x3008 |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 408 | |
sewardj | 45b4b37 | 2002-04-16 22:50:32 +0000 | [diff] [blame] | 409 | /* Cosmetic ... */ |
| 410 | #define VG_USERREQ__GET_PTHREAD_TRACE_LEVEL 0x3101 |
| 411 | |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 412 | /* |
| 413 | In vg_constants.h: |
| 414 | #define VG_USERREQ__SIGNAL_RETURNS 0x4001 |
sewardj | bc5b99f | 2002-04-13 00:08:51 +0000 | [diff] [blame] | 415 | #define VG_USERREQ__PTHREAD_RETURNS 0x4002 |
| 416 | #define VG_USERREQ__SHUTDOWN_VALGRIND 0x4003 |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 417 | */ |
| 418 | |
| 419 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 420 | /* --------------------------------------------------------------------- |
| 421 | Constants pertaining to the simulated CPU state, VG_(baseBlock), |
| 422 | which need to go here to avoid ugly circularities. |
| 423 | ------------------------------------------------------------------ */ |
| 424 | |
| 425 | /* How big is the saved FPU state? */ |
| 426 | #define VG_SIZE_OF_FPUSTATE 108 |
| 427 | /* ... and in words ... */ |
| 428 | #define VG_SIZE_OF_FPUSTATE_W ((VG_SIZE_OF_FPUSTATE+3)/4) |
| 429 | |
| 430 | |
| 431 | /* --------------------------------------------------------------------- |
| 432 | Exports of vg_scheduler.c |
| 433 | ------------------------------------------------------------------ */ |
| 434 | |
| 435 | /* ThreadIds are simply indices into the vg_threads[] array. */ |
| 436 | typedef |
| 437 | UInt |
| 438 | ThreadId; |
| 439 | |
| 440 | /* MutexIds are simply indices into the vg_mutexes[] array. */ |
| 441 | typedef |
| 442 | UInt |
| 443 | MutexId; |
| 444 | |
| 445 | |
| 446 | #define VG_INVALID_THREADID ((ThreadId)(-1)) |
| 447 | |
| 448 | typedef |
| 449 | enum { |
| 450 | VgTs_Empty, /* this slot is not in use */ |
| 451 | VgTs_Runnable, /* waiting to be scheduled */ |
| 452 | VgTs_WaitJoiner, /* waiting for someone to do join on me */ |
| 453 | VgTs_WaitJoinee, /* waiting for the thread I did join on */ |
| 454 | VgTs_WaitFD, /* waiting for I/O completion on a fd */ |
| 455 | VgTs_WaitMX, /* waiting on a mutex */ |
| 456 | VgTs_Sleeping /* sleeping for a while */ |
| 457 | } |
| 458 | ThreadStatus; |
| 459 | |
| 460 | typedef |
| 461 | struct { |
| 462 | /* The thread identity is simply the index in vg_threads[]. |
| 463 | ThreadId == 0 is the root thread and has the special property |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 464 | that we don't try and allocate or deallocate its stack. For |
| 465 | convenience of generating error message, we also put the |
| 466 | ThreadId in this tid field, but be aware that it should |
| 467 | ALWAYS just == the index in vg_threads[]. */ |
| 468 | ThreadId tid; |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 469 | |
| 470 | /* Current scheduling status. */ |
| 471 | ThreadStatus status; |
| 472 | |
| 473 | /* Identity of joiner (thread who called join on me), or |
| 474 | VG_INVALID_THREADID if no one asked to join yet. */ |
| 475 | ThreadId joiner; |
| 476 | |
| 477 | /* Identity of mutex we are waiting on, if .status == WaitMX. */ |
| 478 | MutexId waited_on_mid; |
| 479 | |
| 480 | /* If VgTs_Sleeping, this is when we should wake up. */ |
| 481 | ULong awaken_at; |
| 482 | |
| 483 | /* return value */ |
| 484 | void* retval; |
| 485 | |
| 486 | /* Stacks. When a thread slot is freed, we don't deallocate its |
| 487 | stack; we just leave it lying around for the next use of the |
| 488 | slot. If the next use of the slot requires a larger stack, |
| 489 | only then is the old one deallocated and a new one |
| 490 | allocated. |
| 491 | |
| 492 | For the main thread (threadid == 0), this mechanism doesn't |
| 493 | apply. We don't know the size of the stack since we didn't |
| 494 | allocate it, and furthermore we never reallocate it. */ |
| 495 | |
| 496 | /* The allocated size of this thread's stack (permanently zero |
| 497 | if this is ThreadId == 0, since we didn't allocate its stack) */ |
| 498 | UInt stack_size; |
| 499 | |
| 500 | /* Address of the lowest word in this thread's stack. NULL means |
| 501 | not allocated yet. |
| 502 | */ |
| 503 | Addr stack_base; |
| 504 | |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 505 | /* Address of the highest legitimate word in this stack. This is |
| 506 | used for error messages only -- not critical for execution |
| 507 | correctness. Is is set for all stacks, specifically including |
| 508 | ThreadId == 0 (the main thread). */ |
| 509 | Addr stack_highest_word; |
| 510 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 511 | /* Saved machine context. */ |
| 512 | UInt m_eax; |
| 513 | UInt m_ebx; |
| 514 | UInt m_ecx; |
| 515 | UInt m_edx; |
| 516 | UInt m_esi; |
| 517 | UInt m_edi; |
| 518 | UInt m_ebp; |
| 519 | UInt m_esp; |
| 520 | UInt m_eflags; |
| 521 | UInt m_eip; |
| 522 | UInt m_fpu[VG_SIZE_OF_FPUSTATE_W]; |
| 523 | |
| 524 | UInt sh_eax; |
| 525 | UInt sh_ebx; |
| 526 | UInt sh_ecx; |
| 527 | UInt sh_edx; |
| 528 | UInt sh_esi; |
| 529 | UInt sh_edi; |
| 530 | UInt sh_ebp; |
| 531 | UInt sh_esp; |
| 532 | UInt sh_eflags; |
| 533 | } |
| 534 | ThreadState; |
| 535 | |
| 536 | |
| 537 | /* Copy the specified thread's state into VG_(baseBlock) in |
| 538 | preparation for running it. */ |
| 539 | extern void VG_(load_thread_state)( ThreadId ); |
| 540 | |
| 541 | /* Save the specified thread's state back in VG_(baseBlock), and fill |
| 542 | VG_(baseBlock) with junk, for sanity-check reasons. */ |
| 543 | extern void VG_(save_thread_state)( ThreadId ); |
| 544 | |
| 545 | /* Get the thread state block for the specified thread. */ |
| 546 | extern ThreadState* VG_(get_thread_state)( ThreadId ); |
| 547 | |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 548 | /* And for the currently running one, if valid. */ |
| 549 | extern ThreadState* VG_(get_current_thread_state) ( void ); |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 550 | |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 551 | /* Similarly ... */ |
| 552 | extern ThreadId VG_(get_current_tid) ( void ); |
| 553 | |
| 554 | /* Which thread is this address in the stack of, if any? Used for |
| 555 | error message generation. */ |
| 556 | extern ThreadId VG_(identify_stack_addr)( Addr a ); |
| 557 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 558 | |
| 559 | /* Return codes from the scheduler. */ |
| 560 | typedef |
| 561 | enum { VgSrc_Deadlock, VgSrc_Shutdown, VgSrc_BbsDone } |
| 562 | VgSchedReturnCode; |
| 563 | |
| 564 | /* The scheduler. */ |
| 565 | extern VgSchedReturnCode VG_(scheduler) ( void ); |
| 566 | |
| 567 | extern void VG_(scheduler_init) ( void ); |
| 568 | |
sewardj | 15a43e1 | 2002-04-17 19:35:12 +0000 | [diff] [blame] | 569 | extern void VG_(pp_sched_status) ( void ); |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 570 | |
| 571 | /* vg_oursignalhandler() might longjmp(). Here's the jmp_buf. */ |
| 572 | extern jmp_buf VG_(scheduler_jmpbuf); |
| 573 | /* ... and if so, here's the signal which caused it to do so. */ |
| 574 | extern Int VG_(longjmpd_on_signal); |
| 575 | |
| 576 | |
| 577 | /* We check that the initial stack, which we can't move, is allocated |
| 578 | here. VG_(scheduler_init) checks this. |
| 579 | */ |
| 580 | #define VG_STARTUP_STACK_MASK (Addr)0xBFFF8000 |
| 581 | |
| 582 | |
| 583 | /* The red-zone size which we put at the bottom (highest address) of |
| 584 | thread stacks, for paranoia reasons. This can be arbitrary, and |
| 585 | doesn't really need to be set at compile time. */ |
| 586 | #define VG_AR_CLIENT_STACKBASE_REDZONE_SZW 4 |
| 587 | |
| 588 | #define VG_AR_CLIENT_STACKBASE_REDZONE_SZB \ |
| 589 | (VG_AR_CLIENT_STACKBASE_REDZONE_SZW * VKI_BYTES_PER_WORD) |
| 590 | |
| 591 | |
| 592 | |
| 593 | /* --------------------------------------------------------------------- |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 594 | Exports of vg_signals.c |
| 595 | ------------------------------------------------------------------ */ |
| 596 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 597 | extern void VG_(sigstartup_actions) ( void ); |
| 598 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 599 | extern void VG_(deliver_signals) ( ThreadId ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 600 | extern void VG_(unblock_host_signal) ( Int sigNo ); |
| 601 | |
| 602 | |
| 603 | /* Fake system calls for signal handling. */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 604 | extern void VG_(do__NR_sigaction) ( ThreadId tid ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 605 | extern void VG_(do__NR_sigprocmask) ( Int how, vki_ksigset_t* set ); |
| 606 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 607 | /* Modify the current thread's state once we have detected it is |
| 608 | returning from a signal handler. */ |
sewardj | 77e466c | 2002-04-14 02:29:29 +0000 | [diff] [blame] | 609 | extern Bool VG_(signal_returns) ( ThreadId ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 610 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 611 | /* Handy utilities to block/restore all host signals. */ |
| 612 | extern void VG_(block_all_host_signals) |
| 613 | ( /* OUT */ vki_ksigset_t* saved_mask ); |
| 614 | extern void VG_(restore_host_signals) |
| 615 | ( /* IN */ vki_ksigset_t* saved_mask ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 616 | |
| 617 | /* --------------------------------------------------------------------- |
| 618 | Exports of vg_mylibc.c |
| 619 | ------------------------------------------------------------------ */ |
| 620 | |
| 621 | |
| 622 | #define NULL ((void*)0) |
| 623 | |
| 624 | extern void VG_(exit)( Int status ) |
| 625 | __attribute__ ((__noreturn__)); |
| 626 | |
| 627 | extern void VG_(printf) ( const char *format, ... ); |
| 628 | /* too noisy ... __attribute__ ((format (printf, 1, 2))) ; */ |
| 629 | |
| 630 | extern void VG_(sprintf) ( Char* buf, Char *format, ... ); |
| 631 | |
| 632 | extern void VG_(vprintf) ( void(*send)(Char), |
| 633 | const Char *format, va_list vargs ); |
| 634 | |
| 635 | extern Bool VG_(isspace) ( Char c ); |
| 636 | |
| 637 | extern Int VG_(strlen) ( const Char* str ); |
| 638 | |
| 639 | extern Long VG_(atoll) ( Char* str ); |
| 640 | |
| 641 | extern Char* VG_(strcat) ( Char* dest, const Char* src ); |
| 642 | extern Char* VG_(strncat) ( Char* dest, const Char* src, Int n ); |
| 643 | extern Char* VG_(strpbrk) ( const Char* s, const Char* accept ); |
| 644 | |
| 645 | extern Char* VG_(strcpy) ( Char* dest, const Char* src ); |
| 646 | |
| 647 | extern Int VG_(strcmp) ( const Char* s1, const Char* s2 ); |
| 648 | extern Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 ); |
| 649 | |
| 650 | extern Int VG_(strncmp) ( const Char* s1, const Char* s2, Int nmax ); |
| 651 | extern Int VG_(strncmp_ws) ( const Char* s1, const Char* s2, Int nmax ); |
| 652 | |
| 653 | extern Char* VG_(strstr) ( const Char* haystack, Char* needle ); |
| 654 | extern Char* VG_(strchr) ( const Char* s, Char c ); |
| 655 | extern Char* VG_(strdup) ( ArenaId aid, const Char* s); |
| 656 | |
| 657 | extern Char* VG_(getenv) ( Char* name ); |
| 658 | extern Int VG_(getpid) ( void ); |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 659 | extern ULong VG_(read_microsecond_timer)( void ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 660 | |
| 661 | |
| 662 | extern Char VG_(toupper) ( Char c ); |
| 663 | |
| 664 | extern void VG_(strncpy_safely) ( Char* dest, const Char* src, Int ndest ); |
| 665 | |
| 666 | extern void VG_(strncpy) ( Char* dest, const Char* src, Int ndest ); |
| 667 | |
| 668 | extern Bool VG_(stringMatch) ( Char* pat, Char* str ); |
| 669 | |
| 670 | |
| 671 | #define __STRING(x) #x |
| 672 | |
| 673 | /* Asserts are permanently enabled. Hurrah! */ |
| 674 | #define vg_assert(expr) \ |
| 675 | ((void) ((expr) ? 0 : \ |
| 676 | (VG_(assert_fail) (__STRING(expr), \ |
| 677 | __FILE__, __LINE__, \ |
| 678 | __PRETTY_FUNCTION__), 0))) |
| 679 | |
| 680 | extern void VG_(assert_fail) ( Char* expr, Char* file, |
| 681 | Int line, Char* fn ) |
| 682 | __attribute__ ((__noreturn__)); |
| 683 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 684 | /* Reading files. */ |
| 685 | extern Int VG_(open_read) ( Char* pathname ); |
| 686 | extern void VG_(close) ( Int fd ); |
| 687 | extern Int VG_(read) ( Int fd, void* buf, Int count); |
| 688 | extern Int VG_(write) ( Int fd, void* buf, Int count); |
| 689 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 690 | extern Int VG_(fcntl) ( Int fd, Int cmd, Int arg ); |
| 691 | |
| 692 | extern Int VG_(select)( Int n, |
| 693 | vki_fd_set* readfds, |
| 694 | vki_fd_set* writefds, |
| 695 | vki_fd_set* exceptfds, |
| 696 | struct vki_timeval * timeout ); |
| 697 | extern Int VG_(nanosleep)( const struct vki_timespec *req, |
| 698 | struct vki_timespec *rem ); |
| 699 | |
| 700 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 701 | /* mmap-ery ... */ |
| 702 | extern void* VG_(mmap)( void* start, UInt length, |
| 703 | UInt prot, UInt flags, UInt fd, UInt offset ); |
| 704 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 705 | extern Int VG_(munmap)( void* start, Int length ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 706 | |
| 707 | |
| 708 | /* Print a (panic) message, and abort. */ |
| 709 | extern void VG_(panic) ( Char* str ) |
| 710 | __attribute__ ((__noreturn__)); |
| 711 | |
| 712 | /* Get memory by anonymous mmap. */ |
| 713 | void* VG_(get_memory_from_mmap) ( Int nBytes ); |
| 714 | |
| 715 | /* Signal stuff. Note that these use the vk_ (kernel) structure |
| 716 | definitions, which are different in places from those that glibc |
| 717 | defines. Since we're operating right at the kernel interface, |
| 718 | glibc's view of the world is entirely irrelevant. */ |
| 719 | extern Int VG_(ksigfillset)( vki_ksigset_t* set ); |
| 720 | extern Int VG_(ksigemptyset)( vki_ksigset_t* set ); |
| 721 | extern Int VG_(ksigaddset)( vki_ksigset_t* set, Int signum ); |
| 722 | |
| 723 | extern Int VG_(ksigprocmask)( Int how, const vki_ksigset_t* set, |
| 724 | vki_ksigset_t* oldset ); |
| 725 | extern Int VG_(ksigaction) ( Int signum, |
| 726 | const vki_ksigaction* act, |
| 727 | vki_ksigaction* oldact ); |
| 728 | extern Int VG_(ksigismember) ( vki_ksigset_t* set, Int signum ); |
| 729 | |
| 730 | extern Int VG_(ksignal)(Int signum, void (*sighandler)(Int)); |
| 731 | |
| 732 | extern Int VG_(ksigaltstack)( const vki_kstack_t* ss, vki_kstack_t* oss ); |
| 733 | |
| 734 | |
| 735 | |
| 736 | /* --------------------------------------------------------------------- |
| 737 | Definitions for the JITter (vg_translate.c, vg_to_ucode.c, |
| 738 | vg_from_ucode.c). |
| 739 | ------------------------------------------------------------------ */ |
| 740 | |
| 741 | /* Tags which describe what operands are. */ |
| 742 | typedef |
| 743 | enum { TempReg=0, ArchReg=1, RealReg=2, |
| 744 | SpillNo=3, Literal=4, Lit16=5, |
| 745 | NoValue=6 } |
| 746 | Tag; |
| 747 | |
| 748 | |
| 749 | /* Microinstruction opcodes. */ |
| 750 | typedef |
| 751 | enum { |
| 752 | NOP, |
| 753 | GET, |
| 754 | PUT, |
| 755 | LOAD, |
| 756 | STORE, |
| 757 | MOV, |
| 758 | CMOV, /* Used for cmpxchg and cmov */ |
| 759 | WIDEN, |
| 760 | JMP, |
| 761 | |
| 762 | /* Read/write the %EFLAGS register into a TempReg. */ |
| 763 | GETF, PUTF, |
| 764 | |
| 765 | ADD, ADC, AND, OR, XOR, SUB, SBB, |
| 766 | SHL, SHR, SAR, ROL, ROR, RCL, RCR, |
| 767 | NOT, NEG, INC, DEC, BSWAP, |
| 768 | CC2VAL, |
| 769 | |
| 770 | /* Not strictly needed, but useful for making better |
| 771 | translations of address calculations. */ |
| 772 | LEA1, /* reg2 := const + reg1 */ |
| 773 | LEA2, /* reg3 := const + reg1 + reg2 * 1,2,4 or 8 */ |
| 774 | |
| 775 | /* not for translating x86 calls -- only to call helpers */ |
| 776 | CALLM_S, CALLM_E, /* Mark start and end of push/pop sequences |
| 777 | for CALLM. */ |
| 778 | PUSH, POP, CLEAR, /* Add/remove/zap args for helpers. */ |
| 779 | CALLM, /* call to a machine-code helper */ |
| 780 | |
| 781 | /* Hack for translating string (REP-) insns. Jump to literal if |
| 782 | TempReg/RealReg is zero. */ |
| 783 | JIFZ, |
| 784 | |
| 785 | /* FPU ops which read/write mem or don't touch mem at all. */ |
| 786 | FPU_R, |
| 787 | FPU_W, |
| 788 | FPU, |
| 789 | |
| 790 | /* Advance the simulated %eip by some small (< 128) number. */ |
| 791 | INCEIP, |
| 792 | |
| 793 | /* uinstrs which are not needed for mere translation of x86 code, |
| 794 | only for instrumentation of it. */ |
| 795 | LOADV, |
| 796 | STOREV, |
| 797 | GETV, |
| 798 | PUTV, |
| 799 | TESTV, |
| 800 | SETV, |
| 801 | /* Get/set the v-bit (and it is only one bit) for the simulated |
| 802 | %eflags register. */ |
| 803 | GETVF, |
| 804 | PUTVF, |
| 805 | |
| 806 | /* Do a unary or binary tag op. Only for post-instrumented |
| 807 | code. For TAG1, first and only arg is a TempReg, and is both |
| 808 | arg and result reg. For TAG2, first arg is src, second is |
| 809 | dst, in the normal way; both are TempRegs. In both cases, |
| 810 | 3rd arg is a RiCHelper with a Lit16 tag. This indicates |
| 811 | which tag op to do. */ |
| 812 | TAG1, |
| 813 | TAG2 |
| 814 | } |
| 815 | Opcode; |
| 816 | |
| 817 | |
| 818 | /* Condition codes, observing the Intel encoding. CondAlways is an |
| 819 | extra. */ |
| 820 | typedef |
| 821 | enum { |
| 822 | CondO = 0, /* overflow */ |
| 823 | CondNO = 1, /* no overflow */ |
| 824 | CondB = 2, /* below */ |
| 825 | CondNB = 3, /* not below */ |
| 826 | CondZ = 4, /* zero */ |
| 827 | CondNZ = 5, /* not zero */ |
| 828 | CondBE = 6, /* below or equal */ |
| 829 | CondNBE = 7, /* not below or equal */ |
| 830 | CondS = 8, /* negative */ |
| 831 | ConsNS = 9, /* not negative */ |
| 832 | CondP = 10, /* parity even */ |
| 833 | CondNP = 11, /* not parity even */ |
| 834 | CondL = 12, /* jump less */ |
| 835 | CondNL = 13, /* not less */ |
| 836 | CondLE = 14, /* less or equal */ |
| 837 | CondNLE = 15, /* not less or equal */ |
| 838 | CondAlways = 16 /* Jump always */ |
| 839 | } |
| 840 | Condcode; |
| 841 | |
| 842 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 843 | /* Descriptions of additional properties of *unconditional* jumps. */ |
| 844 | typedef |
| 845 | enum { |
| 846 | JmpBoring=0, /* boring unconditional jump */ |
| 847 | JmpCall=1, /* jump due to an x86 call insn */ |
| 848 | JmpRet=2, /* jump due to an x86 ret insn */ |
| 849 | JmpSyscall=3, /* do a system call, then jump */ |
| 850 | JmpClientReq=4 /* do a client request, then jump */ |
| 851 | } |
| 852 | JmpKind; |
| 853 | |
| 854 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 855 | /* Flags. User-level code can only read/write O(verflow), S(ign), |
| 856 | Z(ero), A(ux-carry), C(arry), P(arity), and may also write |
| 857 | D(irection). That's a total of 7 flags. A FlagSet is a bitset, |
| 858 | thusly: |
| 859 | 76543210 |
| 860 | DOSZACP |
| 861 | and bit 7 must always be zero since it is unused. |
| 862 | */ |
| 863 | typedef UChar FlagSet; |
| 864 | |
| 865 | #define FlagD (1<<6) |
| 866 | #define FlagO (1<<5) |
| 867 | #define FlagS (1<<4) |
| 868 | #define FlagZ (1<<3) |
| 869 | #define FlagA (1<<2) |
| 870 | #define FlagC (1<<1) |
| 871 | #define FlagP (1<<0) |
| 872 | |
| 873 | #define FlagsOSZACP (FlagO | FlagS | FlagZ | FlagA | FlagC | FlagP) |
| 874 | #define FlagsOSZAP (FlagO | FlagS | FlagZ | FlagA | FlagP) |
| 875 | #define FlagsOSZCP (FlagO | FlagS | FlagZ | FlagC | FlagP) |
| 876 | #define FlagsOSACP (FlagO | FlagS | FlagA | FlagC | FlagP) |
| 877 | #define FlagsSZACP ( FlagS | FlagZ | FlagA | FlagC | FlagP) |
| 878 | #define FlagsSZAP ( FlagS | FlagZ | FlagA | FlagP) |
sewardj | 4a7456e | 2002-03-24 13:52:19 +0000 | [diff] [blame] | 879 | #define FlagsZCP ( FlagZ | FlagC | FlagP) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 880 | #define FlagsOC (FlagO | FlagC ) |
sewardj | 4d0ab1f | 2002-03-24 10:00:09 +0000 | [diff] [blame] | 881 | #define FlagsAC ( FlagA | FlagC ) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 882 | |
| 883 | #define FlagsALL (FlagsOSZACP | FlagD) |
| 884 | #define FlagsEmpty (FlagSet)0 |
| 885 | |
| 886 | #define VG_IS_FLAG_SUBSET(set1,set2) \ |
| 887 | (( ((FlagSet)set1) & ((FlagSet)set2) ) == ((FlagSet)set1) ) |
| 888 | |
| 889 | #define VG_UNION_FLAG_SETS(set1,set2) \ |
| 890 | ( ((FlagSet)set1) | ((FlagSet)set2) ) |
| 891 | |
| 892 | |
| 893 | |
| 894 | /* A Micro (u)-instruction. */ |
| 895 | typedef |
| 896 | struct { |
| 897 | /* word 1 */ |
| 898 | UInt lit32; /* 32-bit literal */ |
| 899 | |
| 900 | /* word 2 */ |
| 901 | UShort val1; /* first operand */ |
| 902 | UShort val2; /* second operand */ |
| 903 | |
| 904 | /* word 3 */ |
| 905 | UShort val3; /* third operand */ |
| 906 | UChar opcode; /* opcode */ |
| 907 | UChar size; /* data transfer size */ |
| 908 | |
| 909 | /* word 4 */ |
| 910 | FlagSet flags_r; /* :: FlagSet */ |
| 911 | FlagSet flags_w; /* :: FlagSet */ |
| 912 | UChar tag1:4; /* first operand tag */ |
| 913 | UChar tag2:4; /* second operand tag */ |
| 914 | UChar tag3:4; /* third operand tag */ |
| 915 | UChar extra4b:4; /* Spare field, used by WIDEN for src |
| 916 | -size, and by LEA2 for scale |
| 917 | (1,2,4 or 8) */ |
| 918 | |
| 919 | /* word 5 */ |
| 920 | UChar cond; /* condition, for jumps */ |
| 921 | Bool smc_check:1; /* do a smc test, if writes memory. */ |
| 922 | Bool signed_widen:1; /* signed or unsigned WIDEN ? */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 923 | JmpKind jmpkind:3; /* additional properties of unconditional JMP */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 924 | } |
| 925 | UInstr; |
| 926 | |
| 927 | |
| 928 | /* Expandable arrays of uinstrs. */ |
| 929 | typedef |
| 930 | struct { |
| 931 | Int used; |
| 932 | Int size; |
| 933 | UInstr* instrs; |
| 934 | Int nextTemp; |
| 935 | } |
| 936 | UCodeBlock; |
| 937 | |
| 938 | /* Refer to `the last instruction stuffed in', including as an |
| 939 | lvalue. */ |
| 940 | #define LAST_UINSTR(cb) (cb)->instrs[(cb)->used-1] |
| 941 | |
| 942 | /* An invalid temporary number :-) */ |
| 943 | #define INVALID_TEMPREG 999999999 |
| 944 | |
| 945 | |
| 946 | /* --------------------------------------------------------------------- |
| 947 | Exports of vg_demangle.c |
| 948 | ------------------------------------------------------------------ */ |
| 949 | |
| 950 | extern void VG_(demangle) ( Char* orig, Char* result, Int result_size ); |
| 951 | |
| 952 | |
| 953 | /* --------------------------------------------------------------------- |
| 954 | Exports of vg_from_ucode.c |
| 955 | ------------------------------------------------------------------ */ |
| 956 | |
| 957 | extern UChar* VG_(emit_code) ( UCodeBlock* cb, Int* nbytes ); |
| 958 | |
| 959 | |
| 960 | /* --------------------------------------------------------------------- |
| 961 | Exports of vg_to_ucode.c |
| 962 | ------------------------------------------------------------------ */ |
| 963 | |
| 964 | extern Int VG_(disBB) ( UCodeBlock* cb, Addr eip0 ); |
| 965 | extern Char* VG_(nameOfIntReg) ( Int size, Int reg ); |
| 966 | extern Char VG_(nameOfIntSize) ( Int size ); |
| 967 | extern UInt VG_(extend_s_8to32) ( UInt x ); |
| 968 | extern Int VG_(getNewTemp) ( UCodeBlock* cb ); |
| 969 | extern Int VG_(getNewShadow) ( UCodeBlock* cb ); |
| 970 | |
| 971 | #define SHADOW(tempreg) ((tempreg)+1) |
| 972 | |
| 973 | |
| 974 | /* --------------------------------------------------------------------- |
| 975 | Exports of vg_translate.c |
| 976 | ------------------------------------------------------------------ */ |
| 977 | |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 978 | extern void VG_(translate) ( ThreadState* tst, |
| 979 | Addr orig_addr, |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 980 | UInt* orig_size, |
| 981 | Addr* trans_addr, |
| 982 | UInt* trans_size ); |
| 983 | |
| 984 | extern void VG_(emptyUInstr) ( UInstr* u ); |
| 985 | extern void VG_(newUInstr0) ( UCodeBlock* cb, Opcode opcode, Int sz ); |
| 986 | extern void VG_(newUInstr1) ( UCodeBlock* cb, Opcode opcode, Int sz, |
| 987 | Tag tag1, UInt val1 ); |
| 988 | extern void VG_(newUInstr2) ( UCodeBlock* cb, Opcode opcode, Int sz, |
| 989 | Tag tag1, UInt val1, |
| 990 | Tag tag2, UInt val2 ); |
| 991 | extern void VG_(newUInstr3) ( UCodeBlock* cb, Opcode opcode, Int sz, |
| 992 | Tag tag1, UInt val1, |
| 993 | Tag tag2, UInt val2, |
| 994 | Tag tag3, UInt val3 ); |
| 995 | extern void VG_(setFlagRW) ( UInstr* u, |
| 996 | FlagSet fr, FlagSet fw ); |
| 997 | |
| 998 | extern void VG_(setLiteralField) ( UCodeBlock* cb, UInt lit32 ); |
| 999 | extern Bool VG_(anyFlagUse) ( UInstr* u ); |
| 1000 | |
| 1001 | |
| 1002 | |
| 1003 | extern void VG_(ppUInstr) ( Int instrNo, UInstr* u ); |
| 1004 | extern void VG_(ppUCodeBlock) ( UCodeBlock* cb, Char* title ); |
| 1005 | |
| 1006 | extern Char* VG_(nameCondcode) ( Condcode cond ); |
| 1007 | extern Bool VG_(saneUInstr) ( Bool beforeRA, UInstr* u ); |
| 1008 | extern Bool VG_(saneUCodeBlock) ( UCodeBlock* cb ); |
| 1009 | extern Char* VG_(nameUOpcode) ( Bool upper, Opcode opc ); |
| 1010 | extern Int VG_(rankToRealRegNo) ( Int rank ); |
| 1011 | |
| 1012 | extern void* VG_(jitmalloc) ( Int nbytes ); |
| 1013 | extern void VG_(jitfree) ( void* ptr ); |
| 1014 | |
| 1015 | |
| 1016 | /* --------------------------------------------------------------------- |
| 1017 | Exports of vg_execontext.c. |
| 1018 | ------------------------------------------------------------------ */ |
| 1019 | |
| 1020 | /* Records the PC and a bit of the call chain. The first 4 %eip |
| 1021 | values are used in comparisons do remove duplicate errors, and for |
| 1022 | comparing against suppression specifications. The rest are purely |
| 1023 | informational (but often important). */ |
| 1024 | |
| 1025 | typedef |
| 1026 | struct _ExeContextRec { |
| 1027 | struct _ExeContextRec * next; |
| 1028 | /* The size of this array is VG_(clo_backtrace_size); at least |
| 1029 | 2, at most VG_DEEPEST_BACKTRACE. [0] is the current %eip, |
| 1030 | [1] is its caller, [2] is the caller of [1], etc. */ |
| 1031 | Addr eips[0]; |
| 1032 | } |
| 1033 | ExeContext; |
| 1034 | |
| 1035 | |
| 1036 | /* Initialise the ExeContext storage mechanism. */ |
| 1037 | extern void VG_(init_ExeContext_storage) ( void ); |
| 1038 | |
| 1039 | /* Print stats (informational only). */ |
| 1040 | extern void VG_(show_ExeContext_stats) ( void ); |
| 1041 | |
| 1042 | |
| 1043 | /* Take a snapshot of the client's stack. Search our collection of |
| 1044 | ExeContexts to see if we already have it, and if not, allocate a |
| 1045 | new one. Either way, return a pointer to the context. */ |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1046 | extern ExeContext* VG_(get_ExeContext) ( Bool skip_top_frame, |
| 1047 | Addr eip, Addr ebp ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1048 | |
| 1049 | /* Print an ExeContext. */ |
| 1050 | extern void VG_(pp_ExeContext) ( ExeContext* ); |
| 1051 | |
| 1052 | /* Compare two ExeContexts, just comparing the top two callers. */ |
| 1053 | extern Bool VG_(eq_ExeContext_top2) ( ExeContext* e1, ExeContext* e2 ); |
| 1054 | |
| 1055 | /* Compare two ExeContexts, just comparing the top four callers. */ |
| 1056 | extern Bool VG_(eq_ExeContext_top4) ( ExeContext* e1, ExeContext* e2 ); |
| 1057 | |
| 1058 | /* Compare two ExeContexts, comparing all callers. */ |
| 1059 | extern Bool VG_(eq_ExeContext_all) ( ExeContext* e1, ExeContext* e2 ); |
| 1060 | |
| 1061 | |
| 1062 | |
| 1063 | /* --------------------------------------------------------------------- |
| 1064 | Exports of vg_errcontext.c. |
| 1065 | ------------------------------------------------------------------ */ |
| 1066 | |
| 1067 | extern void VG_(load_suppressions) ( void ); |
| 1068 | extern void VG_(show_all_errors) ( void ); |
| 1069 | extern void VG_(record_value_error) ( Int size ); |
| 1070 | extern void VG_(record_free_error) ( Addr a ); |
| 1071 | extern void VG_(record_freemismatch_error) ( Addr a ); |
| 1072 | extern void VG_(record_address_error) ( Addr a, Int size, |
| 1073 | Bool isWrite ); |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 1074 | |
| 1075 | extern void VG_(record_jump_error) ( ThreadState* tst, Addr a ); |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1076 | |
| 1077 | extern void VG_(record_param_err) ( ThreadState* tst, |
| 1078 | Addr a, |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1079 | Bool isWriteLack, |
| 1080 | Char* msg ); |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1081 | extern void VG_(record_user_err) ( ThreadState* tst, |
| 1082 | Addr a, Bool isWriteLack ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1083 | |
| 1084 | |
| 1085 | /* The classification of a faulting address. */ |
| 1086 | typedef |
| 1087 | enum { Stack, Unknown, Freed, Mallocd, UserG, UserS } |
| 1088 | AddrKind; |
| 1089 | |
| 1090 | /* Records info about a faulting address. */ |
| 1091 | typedef |
| 1092 | struct { |
| 1093 | /* ALL */ |
| 1094 | AddrKind akind; |
| 1095 | /* Freed, Mallocd */ |
| 1096 | Int blksize; |
| 1097 | /* Freed, Mallocd */ |
| 1098 | Int rwoffset; |
| 1099 | /* Freed, Mallocd */ |
| 1100 | ExeContext* lastchange; |
sewardj | 1e8cdc9 | 2002-04-18 11:37:52 +0000 | [diff] [blame^] | 1101 | /* Stack */ |
| 1102 | ThreadId stack_tid; |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1103 | } |
| 1104 | AddrInfo; |
| 1105 | |
| 1106 | |
| 1107 | /* --------------------------------------------------------------------- |
| 1108 | Exports of vg_clientperms.c |
| 1109 | ------------------------------------------------------------------ */ |
| 1110 | |
| 1111 | extern Bool VG_(client_perm_maybe_describe)( Addr a, AddrInfo* ai ); |
| 1112 | |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1113 | extern UInt VG_(handle_client_request) ( ThreadState* tst, UInt* arg_block ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1114 | |
| 1115 | extern void VG_(delete_client_stack_blocks_following_ESP_change) ( void ); |
| 1116 | |
| 1117 | extern void VG_(show_client_block_stats) ( void ); |
| 1118 | |
| 1119 | |
| 1120 | /* --------------------------------------------------------------------- |
| 1121 | Exports of vg_procselfmaps.c |
| 1122 | ------------------------------------------------------------------ */ |
| 1123 | |
| 1124 | extern |
| 1125 | void VG_(read_procselfmaps) ( |
| 1126 | void (*record_mapping)( Addr, UInt, Char, Char, Char, UInt, UChar* ) |
| 1127 | ); |
| 1128 | |
| 1129 | |
| 1130 | /* --------------------------------------------------------------------- |
| 1131 | Exports of vg_symtab2.c |
| 1132 | ------------------------------------------------------------------ */ |
| 1133 | |
| 1134 | /* We assume the executable is loaded here ... can't really find |
| 1135 | out. There is a hacky sanity check in vg_init_memory_audit() |
| 1136 | which should trip up most stupidities. |
| 1137 | */ |
| 1138 | #define VG_ASSUMED_EXE_BASE (Addr)0x8048000 |
| 1139 | |
| 1140 | extern void VG_(read_symbols) ( void ); |
| 1141 | extern void VG_(mini_stack_dump) ( ExeContext* ec ); |
| 1142 | extern void VG_(what_obj_and_fun_is_this) |
| 1143 | ( Addr a, |
| 1144 | Char* obj_buf, Int n_obj_buf, |
| 1145 | Char* fun_buf, Int n_fun_buf ); |
| 1146 | |
| 1147 | extern void VG_(symtab_notify_munmap) ( Addr start, UInt length ); |
| 1148 | |
| 1149 | |
| 1150 | /* --------------------------------------------------------------------- |
| 1151 | Exports of vg_clientmalloc.c |
| 1152 | ------------------------------------------------------------------ */ |
| 1153 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1154 | typedef |
| 1155 | enum { |
| 1156 | Vg_AllocMalloc = 0, |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1157 | Vg_AllocNew = 1, |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1158 | Vg_AllocNewVec = 2 |
| 1159 | } |
| 1160 | VgAllocKind; |
| 1161 | |
| 1162 | /* Description of a malloc'd chunk. */ |
| 1163 | typedef |
| 1164 | struct _ShadowChunk { |
| 1165 | struct _ShadowChunk* next; |
| 1166 | ExeContext* where; /* where malloc'd/free'd */ |
| 1167 | UInt size : 30; /* size requested. */ |
| 1168 | VgAllocKind allockind : 2; /* which wrapper did the allocation */ |
| 1169 | Addr data; /* ptr to actual block. */ |
| 1170 | } |
| 1171 | ShadowChunk; |
| 1172 | |
| 1173 | extern void VG_(clientmalloc_done) ( void ); |
| 1174 | extern void VG_(describe_addr) ( Addr a, AddrInfo* ai ); |
| 1175 | extern ShadowChunk** VG_(get_malloc_shadows) ( /*OUT*/ UInt* n_shadows ); |
| 1176 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1177 | /* These are called from the scheduler, when it intercepts a user |
| 1178 | request. */ |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1179 | extern void* VG_(client_malloc) ( ThreadState* tst, |
| 1180 | UInt size, VgAllocKind kind ); |
| 1181 | extern void* VG_(client_memalign) ( ThreadState* tst, |
| 1182 | UInt align, UInt size ); |
| 1183 | extern void VG_(client_free) ( ThreadState* tst, |
| 1184 | void* ptrV, VgAllocKind kind ); |
| 1185 | extern void* VG_(client_calloc) ( ThreadState* tst, |
| 1186 | UInt nmemb, UInt size1 ); |
| 1187 | extern void* VG_(client_realloc) ( ThreadState* tst, |
| 1188 | void* ptrV, UInt size_new ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1189 | |
| 1190 | |
| 1191 | /* --------------------------------------------------------------------- |
| 1192 | Exports of vg_main.c |
| 1193 | ------------------------------------------------------------------ */ |
| 1194 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1195 | /* A structure used as an intermediary when passing the simulated |
| 1196 | CPU's state to some assembly fragments, particularly system calls. |
| 1197 | Stuff is copied from baseBlock to here, the assembly magic runs, |
| 1198 | and then the inverse copy is done. */ |
| 1199 | |
| 1200 | extern UInt VG_(m_state_static) [8 /* int regs, in Intel order */ |
| 1201 | + 1 /* %eflags */ |
| 1202 | + 1 /* %eip */ |
| 1203 | + VG_SIZE_OF_FPUSTATE_W /* FPU state */ |
| 1204 | ]; |
| 1205 | |
| 1206 | /* Handy fns for doing the copy back and forth. */ |
| 1207 | extern void VG_(copy_baseBlock_to_m_state_static) ( void ); |
| 1208 | extern void VG_(copy_m_state_static_to_baseBlock) ( void ); |
| 1209 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1210 | /* Called when some unhandleable client behaviour is detected. |
| 1211 | Prints a msg and aborts. */ |
| 1212 | extern void VG_(unimplemented) ( Char* msg ); |
| 1213 | |
| 1214 | /* The stack on which Valgrind runs. We can't use the same stack as the |
| 1215 | simulatee -- that's an important design decision. */ |
| 1216 | extern UInt VG_(stack)[10000]; |
| 1217 | |
| 1218 | /* Similarly, we have to ask for signals to be delivered on an |
| 1219 | alternative stack, since it is possible, although unlikely, that |
| 1220 | we'll have to run client code from inside the Valgrind-installed |
| 1221 | signal handler. If this happens it will be done by |
| 1222 | vg_deliver_signal_immediately(). */ |
| 1223 | extern UInt VG_(sigstack)[10000]; |
| 1224 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1225 | /* Holds client's %esp at the point we gained control. From this the |
| 1226 | client's argc, argv and envp are deduced. */ |
| 1227 | extern Addr VG_(esp_at_startup); |
| 1228 | extern Int VG_(client_argc); |
| 1229 | extern Char** VG_(client_argv); |
| 1230 | extern Char** VG_(client_envp); |
| 1231 | |
| 1232 | /* Remove valgrind.so from a LD_PRELOAD=... string so child processes |
| 1233 | don't get traced into. */ |
| 1234 | extern void VG_(mash_LD_PRELOAD_string)( Char* ld_preload_str ); |
| 1235 | |
| 1236 | /* Something of a function looking for a home ... start up GDB. This |
| 1237 | is called from VG_(swizzle_esp_then_start_GDB) and so runs on the |
| 1238 | *client's* stack. This is necessary to give GDB the illusion that |
| 1239 | the client program really was running on the real cpu. */ |
| 1240 | extern void VG_(start_GDB_whilst_on_client_stack) ( void ); |
| 1241 | |
| 1242 | /* Spew out vast amounts of junk during JITting? */ |
| 1243 | extern Bool VG_(disassemble); |
| 1244 | |
| 1245 | /* 64-bit counter for the number of basic blocks done. */ |
| 1246 | extern ULong VG_(bbs_done); |
| 1247 | /* 64-bit counter for the number of bbs to go before a debug exit. */ |
| 1248 | extern ULong VG_(bbs_to_go); |
| 1249 | |
| 1250 | /* Counts downwards in vg_run_innerloop. */ |
| 1251 | extern UInt VG_(dispatch_ctr); |
| 1252 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1253 | /* Is the client running on the simulated CPU or the real one? */ |
| 1254 | extern Bool VG_(running_on_simd_CPU); /* Initially False */ |
| 1255 | |
| 1256 | /* The current LRU epoch. */ |
| 1257 | extern UInt VG_(current_epoch); |
| 1258 | |
| 1259 | |
| 1260 | /* --- Counters, for informational purposes only. --- */ |
| 1261 | |
| 1262 | /* Number of lookups which miss the fast tt helper. */ |
| 1263 | extern UInt VG_(tt_fast_misses); |
| 1264 | |
| 1265 | /* Counts for LRU informational messages. */ |
| 1266 | |
| 1267 | /* Number and total o/t size of new translations this epoch. */ |
| 1268 | extern UInt VG_(this_epoch_in_count); |
| 1269 | extern UInt VG_(this_epoch_in_osize); |
| 1270 | extern UInt VG_(this_epoch_in_tsize); |
| 1271 | /* Number and total o/t size of discarded translations this epoch. */ |
| 1272 | extern UInt VG_(this_epoch_out_count); |
| 1273 | extern UInt VG_(this_epoch_out_osize); |
| 1274 | extern UInt VG_(this_epoch_out_tsize); |
| 1275 | /* Number and total o/t size of translations overall. */ |
| 1276 | extern UInt VG_(overall_in_count); |
| 1277 | extern UInt VG_(overall_in_osize); |
| 1278 | extern UInt VG_(overall_in_tsize); |
| 1279 | /* Number and total o/t size of discards overall. */ |
| 1280 | extern UInt VG_(overall_out_count); |
| 1281 | extern UInt VG_(overall_out_osize); |
| 1282 | extern UInt VG_(overall_out_tsize); |
| 1283 | |
| 1284 | /* The number of LRU-clearings of TT/TC. */ |
| 1285 | extern UInt VG_(number_of_lrus); |
| 1286 | |
| 1287 | /* Counts pertaining to the register allocator. */ |
| 1288 | |
| 1289 | /* total number of uinstrs input to reg-alloc */ |
| 1290 | extern UInt VG_(uinstrs_prealloc); |
| 1291 | |
| 1292 | /* total number of uinstrs added due to spill code */ |
| 1293 | extern UInt VG_(uinstrs_spill); |
| 1294 | |
| 1295 | /* number of bbs requiring spill code */ |
| 1296 | extern UInt VG_(translations_needing_spill); |
| 1297 | |
| 1298 | /* total of register ranks over all translations */ |
| 1299 | extern UInt VG_(total_reg_rank); |
| 1300 | |
| 1301 | /* Counts pertaining to the self-modifying-code detection machinery. */ |
| 1302 | |
| 1303 | /* Total number of writes checked. */ |
| 1304 | //extern UInt VG_(smc_total_check4s); |
| 1305 | |
| 1306 | /* Number of writes which the fast smc check couldn't show were |
| 1307 | harmless. */ |
| 1308 | extern UInt VG_(smc_cache_passed); |
| 1309 | |
| 1310 | /* Numnber of writes which really did write on original code. */ |
| 1311 | extern UInt VG_(smc_fancy_passed); |
| 1312 | |
| 1313 | /* Number of translations discarded as a result. */ |
| 1314 | //extern UInt VG_(smc_discard_count); |
| 1315 | |
| 1316 | /* Counts pertaining to internal sanity checking. */ |
| 1317 | extern UInt VG_(sanity_fast_count); |
| 1318 | extern UInt VG_(sanity_slow_count); |
| 1319 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1320 | /* Counts pertaining to the scheduler. */ |
| 1321 | extern UInt VG_(num_scheduling_events_MINOR); |
| 1322 | extern UInt VG_(num_scheduling_events_MAJOR); |
| 1323 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1324 | |
| 1325 | /* --------------------------------------------------------------------- |
| 1326 | Exports of vg_memory.c |
| 1327 | ------------------------------------------------------------------ */ |
| 1328 | |
| 1329 | extern void VGM_(init_memory_audit) ( void ); |
| 1330 | extern Addr VGM_(curr_dataseg_end); |
| 1331 | extern void VG_(show_reg_tags) ( void ); |
| 1332 | extern void VG_(detect_memory_leaks) ( void ); |
| 1333 | extern void VG_(done_prof_mem) ( void ); |
| 1334 | |
| 1335 | /* Set permissions for an address range. Not speed-critical. */ |
| 1336 | extern void VGM_(make_noaccess) ( Addr a, UInt len ); |
| 1337 | extern void VGM_(make_writable) ( Addr a, UInt len ); |
| 1338 | extern void VGM_(make_readable) ( Addr a, UInt len ); |
| 1339 | /* Use with care! (read: use for shmat only) */ |
| 1340 | extern void VGM_(make_readwritable) ( Addr a, UInt len ); |
| 1341 | extern void VGM_(copy_address_range_perms) ( Addr src, Addr dst, |
| 1342 | UInt len ); |
| 1343 | |
| 1344 | /* Check permissions for an address range. Not speed-critical. */ |
| 1345 | extern Bool VGM_(check_writable) ( Addr a, UInt len, Addr* bad_addr ); |
| 1346 | extern Bool VGM_(check_readable) ( Addr a, UInt len, Addr* bad_addr ); |
| 1347 | extern Bool VGM_(check_readable_asciiz) ( Addr a, Addr* bad_addr ); |
| 1348 | |
| 1349 | /* Sanity checks which may be done at any time. Doing them at |
| 1350 | signal-delivery time turns out to be convenient. */ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1351 | extern void VG_(do_sanity_checks) ( ThreadId tid, Bool force_expensive ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1352 | /* Very cheap ... */ |
| 1353 | extern Bool VG_(first_and_last_secondaries_look_plausible) ( void ); |
| 1354 | |
| 1355 | /* These functions are called from generated code. */ |
| 1356 | extern void VG_(helperc_STOREV4) ( UInt, Addr ); |
| 1357 | extern void VG_(helperc_STOREV2) ( UInt, Addr ); |
| 1358 | extern void VG_(helperc_STOREV1) ( UInt, Addr ); |
| 1359 | |
| 1360 | extern UInt VG_(helperc_LOADV1) ( Addr ); |
| 1361 | extern UInt VG_(helperc_LOADV2) ( Addr ); |
| 1362 | extern UInt VG_(helperc_LOADV4) ( Addr ); |
| 1363 | |
| 1364 | extern void VGM_(handle_esp_assignment) ( Addr new_espA ); |
| 1365 | extern void VGM_(fpu_write_check) ( Addr addr, Int size ); |
| 1366 | extern void VGM_(fpu_read_check) ( Addr addr, Int size ); |
| 1367 | |
| 1368 | /* Safely (avoiding SIGSEGV / SIGBUS) scan the entire valid address |
| 1369 | space and pass the addresses and values of all addressible, |
| 1370 | defined, aligned words to notify_word. This is the basis for the |
| 1371 | leak detector. Returns the number of calls made to notify_word. */ |
| 1372 | UInt VG_(scan_all_valid_memory) ( void (*notify_word)( Addr, UInt ) ); |
| 1373 | |
| 1374 | /* Is this address within some small distance below %ESP? Used only |
| 1375 | for the --workaround-gcc296-bugs kludge. */ |
sewardj | 8c82451 | 2002-04-14 04:16:48 +0000 | [diff] [blame] | 1376 | extern Bool VG_(is_just_below_ESP)( Addr esp, Addr aa ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1377 | |
| 1378 | /* Nasty kludgery to deal with applications which switch stacks, |
| 1379 | like netscape. */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1380 | #define VG_PLAUSIBLE_STACK_SIZE 8000000 |
| 1381 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1382 | |
| 1383 | /* --------------------------------------------------------------------- |
| 1384 | Exports of vg_syscall_mem.c |
| 1385 | ------------------------------------------------------------------ */ |
| 1386 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1387 | extern void VG_(perform_assumed_nonblocking_syscall) ( ThreadId tid ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1388 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1389 | extern void VG_(check_known_blocking_syscall) ( ThreadId tid, |
| 1390 | Int syscallno, |
| 1391 | Int* /*IN*/ res ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1392 | |
| 1393 | extern Bool VG_(is_kerror) ( Int res ); |
| 1394 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1395 | #define KERNEL_DO_SYSCALL(thread_id, result_lvalue) \ |
| 1396 | VG_(load_thread_state)(thread_id); \ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1397 | VG_(copy_baseBlock_to_m_state_static)(); \ |
| 1398 | VG_(do_syscall)(); \ |
| 1399 | VG_(copy_m_state_static_to_baseBlock)(); \ |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1400 | VG_(save_thread_state)(thread_id); \ |
| 1401 | result_lvalue = VG_(get_thread_state)(thread_id)->m_eax; |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1402 | |
| 1403 | |
| 1404 | /* --------------------------------------------------------------------- |
| 1405 | Exports of vg_transtab.c |
| 1406 | ------------------------------------------------------------------ */ |
| 1407 | |
| 1408 | /* An entry in the translation table (TT). */ |
| 1409 | typedef |
| 1410 | struct { |
| 1411 | /* +0 */ Addr orig_addr; |
| 1412 | /* +4 */ Addr trans_addr; |
| 1413 | /* +8 */ UInt mru_epoch; |
| 1414 | /* +12 */ UShort orig_size; |
| 1415 | /* +14 */ UShort trans_size; |
| 1416 | } |
| 1417 | TTEntry; |
| 1418 | |
| 1419 | /* The number of basic blocks in an epoch (one age-step). */ |
| 1420 | #define VG_BBS_PER_EPOCH 20000 |
| 1421 | |
| 1422 | extern void VG_(get_tt_tc_used) ( UInt* tt_used, UInt* tc_used ); |
| 1423 | extern void VG_(maybe_do_lru_pass) ( void ); |
| 1424 | extern void VG_(flush_transtab) ( void ); |
| 1425 | extern Addr VG_(copy_to_transcache) ( Addr trans_addr, Int trans_size ); |
| 1426 | extern void VG_(add_to_trans_tab) ( TTEntry* tte ); |
| 1427 | |
| 1428 | extern void VG_(smc_mark_original) ( Addr original_addr, |
| 1429 | Int original_len ); |
| 1430 | |
| 1431 | extern void VG_(init_transtab_and_SMC) ( void ); |
| 1432 | |
| 1433 | extern void VG_(sanity_check_tc_tt) ( void ); |
| 1434 | extern Addr VG_(search_transtab) ( Addr original_addr ); |
| 1435 | |
| 1436 | extern void VG_(invalidate_tt_fast)( void ); |
| 1437 | |
| 1438 | |
| 1439 | /* --------------------------------------------------------------------- |
| 1440 | Exports of vg_vtagops.c |
| 1441 | ------------------------------------------------------------------ */ |
| 1442 | |
| 1443 | /* Lists the names of value-tag operations used in instrumented |
| 1444 | code. These are the third argument to TAG1 and TAG2 uinsns. */ |
| 1445 | |
| 1446 | typedef |
| 1447 | enum { |
| 1448 | /* Unary. */ |
| 1449 | VgT_PCast40, VgT_PCast20, VgT_PCast10, |
| 1450 | VgT_PCast01, VgT_PCast02, VgT_PCast04, |
| 1451 | |
| 1452 | VgT_PCast14, VgT_PCast12, VgT_PCast11, |
| 1453 | |
| 1454 | VgT_Left4, VgT_Left2, VgT_Left1, |
| 1455 | |
| 1456 | VgT_SWiden14, VgT_SWiden24, VgT_SWiden12, |
| 1457 | VgT_ZWiden14, VgT_ZWiden24, VgT_ZWiden12, |
| 1458 | |
| 1459 | /* Binary; 1st is rd; 2nd is rd+wr */ |
| 1460 | VgT_UifU4, VgT_UifU2, VgT_UifU1, VgT_UifU0, |
| 1461 | VgT_DifD4, VgT_DifD2, VgT_DifD1, |
| 1462 | |
| 1463 | VgT_ImproveAND4_TQ, VgT_ImproveAND2_TQ, VgT_ImproveAND1_TQ, |
| 1464 | VgT_ImproveOR4_TQ, VgT_ImproveOR2_TQ, VgT_ImproveOR1_TQ, |
| 1465 | VgT_DebugFn |
| 1466 | } |
| 1467 | VgTagOp; |
| 1468 | |
| 1469 | extern Char* VG_(nameOfTagOp) ( VgTagOp ); |
| 1470 | extern UInt VG_(DebugFn) ( UInt a1, UInt a2 ); |
| 1471 | |
| 1472 | |
| 1473 | /* --------------------------------------------------------------------- |
| 1474 | Exports of vg_syscall.S |
| 1475 | ------------------------------------------------------------------ */ |
| 1476 | |
| 1477 | extern void VG_(do_syscall) ( void ); |
| 1478 | |
| 1479 | |
| 1480 | /* --------------------------------------------------------------------- |
| 1481 | Exports of vg_startup.S |
| 1482 | ------------------------------------------------------------------ */ |
| 1483 | |
| 1484 | extern void VG_(shutdown); |
| 1485 | extern void VG_(switch_to_real_CPU) ( void ); |
| 1486 | |
| 1487 | extern void VG_(swizzle_esp_then_start_GDB) ( void ); |
| 1488 | |
| 1489 | |
| 1490 | /* --------------------------------------------------------------------- |
| 1491 | Exports of vg_dispatch.S |
| 1492 | ------------------------------------------------------------------ */ |
| 1493 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 1494 | /* Run a thread for a (very short) while, until some event happens |
| 1495 | which means we need to defer to the scheduler. */ |
| 1496 | extern UInt VG_(run_innerloop) ( void ); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1497 | |
| 1498 | |
| 1499 | /* --------------------------------------------------------------------- |
| 1500 | Exports of vg_helpers.S |
| 1501 | ------------------------------------------------------------------ */ |
| 1502 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1503 | /* SMC fast checks. */ |
| 1504 | extern void VG_(helper_smc_check4); |
| 1505 | |
| 1506 | /* Mul, div, etc, -- we don't codegen these directly. */ |
| 1507 | extern void VG_(helper_idiv_64_32); |
| 1508 | extern void VG_(helper_div_64_32); |
| 1509 | extern void VG_(helper_idiv_32_16); |
| 1510 | extern void VG_(helper_div_32_16); |
| 1511 | extern void VG_(helper_idiv_16_8); |
| 1512 | extern void VG_(helper_div_16_8); |
| 1513 | |
| 1514 | extern void VG_(helper_imul_32_64); |
| 1515 | extern void VG_(helper_mul_32_64); |
| 1516 | extern void VG_(helper_imul_16_32); |
| 1517 | extern void VG_(helper_mul_16_32); |
| 1518 | extern void VG_(helper_imul_8_16); |
| 1519 | extern void VG_(helper_mul_8_16); |
| 1520 | |
| 1521 | extern void VG_(helper_CLD); |
| 1522 | extern void VG_(helper_STD); |
| 1523 | extern void VG_(helper_get_dirflag); |
| 1524 | |
| 1525 | extern void VG_(helper_shldl); |
| 1526 | extern void VG_(helper_shldw); |
| 1527 | extern void VG_(helper_shrdl); |
| 1528 | extern void VG_(helper_shrdw); |
| 1529 | |
| 1530 | extern void VG_(helper_RDTSC); |
| 1531 | extern void VG_(helper_CPUID); |
| 1532 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1533 | extern void VG_(helper_bsf); |
| 1534 | extern void VG_(helper_bsr); |
| 1535 | |
| 1536 | extern void VG_(helper_fstsw_AX); |
| 1537 | extern void VG_(helper_SAHF); |
sewardj | 4d0ab1f | 2002-03-24 10:00:09 +0000 | [diff] [blame] | 1538 | extern void VG_(helper_DAS); |
sewardj | fe8a166 | 2002-03-24 11:54:07 +0000 | [diff] [blame] | 1539 | extern void VG_(helper_DAA); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1540 | |
| 1541 | extern void VG_(helper_value_check4_fail); |
| 1542 | extern void VG_(helper_value_check2_fail); |
| 1543 | extern void VG_(helper_value_check1_fail); |
| 1544 | extern void VG_(helper_value_check0_fail); |
| 1545 | |
sewardj | bc5b99f | 2002-04-13 00:08:51 +0000 | [diff] [blame] | 1546 | /* NOT FUNCTIONS; these are bogus RETURN ADDRESS. */ |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 1547 | extern void VG_(signalreturn_bogusRA)( void ); |
sewardj | bc5b99f | 2002-04-13 00:08:51 +0000 | [diff] [blame] | 1548 | extern void VG_(pthreadreturn_bogusRA)( void ); |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 1549 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1550 | |
| 1551 | /* --------------------------------------------------------------------- |
| 1552 | The state of the simulated CPU. |
| 1553 | ------------------------------------------------------------------ */ |
| 1554 | |
| 1555 | /* This is the Intel register encoding. */ |
| 1556 | #define R_EAX 0 |
| 1557 | #define R_ECX 1 |
| 1558 | #define R_EDX 2 |
| 1559 | #define R_EBX 3 |
| 1560 | #define R_ESP 4 |
| 1561 | #define R_EBP 5 |
| 1562 | #define R_ESI 6 |
| 1563 | #define R_EDI 7 |
| 1564 | |
| 1565 | #define R_AL (0+R_EAX) |
| 1566 | #define R_CL (0+R_ECX) |
| 1567 | #define R_DL (0+R_EDX) |
| 1568 | #define R_BL (0+R_EBX) |
| 1569 | #define R_AH (4+R_EAX) |
| 1570 | #define R_CH (4+R_ECX) |
| 1571 | #define R_DH (4+R_EDX) |
| 1572 | #define R_BH (4+R_EBX) |
| 1573 | |
| 1574 | |
| 1575 | /* --------------------------------------------------------------------- |
| 1576 | Offsets into baseBlock for everything which needs to referred to |
| 1577 | from generated code. The order of these decls does not imply |
| 1578 | what the order of the actual offsets is. The latter is important |
| 1579 | and is set up in vg_main.c. |
| 1580 | ------------------------------------------------------------------ */ |
| 1581 | |
| 1582 | /* An array of words. In generated code, %ebp always points to the |
| 1583 | start of this array. Useful stuff, like the simulated CPU state, |
| 1584 | and the addresses of helper functions, can then be found by |
| 1585 | indexing off %ebp. The following declares variables which, at |
| 1586 | startup time, are given values denoting offsets into baseBlock. |
| 1587 | These offsets are in *words* from the start of baseBlock. */ |
| 1588 | |
| 1589 | #define VG_BASEBLOCK_WORDS 200 |
| 1590 | |
| 1591 | extern UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS]; |
| 1592 | |
| 1593 | |
| 1594 | /* ----------------------------------------------------- |
| 1595 | Read-write parts of baseBlock. |
| 1596 | -------------------------------------------------- */ |
| 1597 | |
| 1598 | /* State of the simulated CPU. */ |
| 1599 | extern Int VGOFF_(m_eax); |
| 1600 | extern Int VGOFF_(m_ecx); |
| 1601 | extern Int VGOFF_(m_edx); |
| 1602 | extern Int VGOFF_(m_ebx); |
| 1603 | extern Int VGOFF_(m_esp); |
| 1604 | extern Int VGOFF_(m_ebp); |
| 1605 | extern Int VGOFF_(m_esi); |
| 1606 | extern Int VGOFF_(m_edi); |
| 1607 | extern Int VGOFF_(m_eflags); |
| 1608 | extern Int VGOFF_(m_fpustate); |
| 1609 | extern Int VGOFF_(m_eip); |
| 1610 | |
| 1611 | /* Reg-alloc spill area (VG_MAX_SPILLSLOTS words long). */ |
| 1612 | extern Int VGOFF_(spillslots); |
| 1613 | |
| 1614 | /* Records the valid bits for the 8 integer regs & flags reg. */ |
| 1615 | extern Int VGOFF_(sh_eax); |
| 1616 | extern Int VGOFF_(sh_ecx); |
| 1617 | extern Int VGOFF_(sh_edx); |
| 1618 | extern Int VGOFF_(sh_ebx); |
| 1619 | extern Int VGOFF_(sh_esp); |
| 1620 | extern Int VGOFF_(sh_ebp); |
| 1621 | extern Int VGOFF_(sh_esi); |
| 1622 | extern Int VGOFF_(sh_edi); |
| 1623 | extern Int VGOFF_(sh_eflags); |
| 1624 | |
| 1625 | |
| 1626 | /* ----------------------------------------------------- |
| 1627 | Read-only parts of baseBlock. |
| 1628 | -------------------------------------------------- */ |
| 1629 | |
| 1630 | /* Offsets of addresses of helper functions. A "helper" function is |
| 1631 | one which is called from generated code. */ |
| 1632 | |
| 1633 | extern Int VGOFF_(helper_idiv_64_32); |
| 1634 | extern Int VGOFF_(helper_div_64_32); |
| 1635 | extern Int VGOFF_(helper_idiv_32_16); |
| 1636 | extern Int VGOFF_(helper_div_32_16); |
| 1637 | extern Int VGOFF_(helper_idiv_16_8); |
| 1638 | extern Int VGOFF_(helper_div_16_8); |
| 1639 | |
| 1640 | extern Int VGOFF_(helper_imul_32_64); |
| 1641 | extern Int VGOFF_(helper_mul_32_64); |
| 1642 | extern Int VGOFF_(helper_imul_16_32); |
| 1643 | extern Int VGOFF_(helper_mul_16_32); |
| 1644 | extern Int VGOFF_(helper_imul_8_16); |
| 1645 | extern Int VGOFF_(helper_mul_8_16); |
| 1646 | |
| 1647 | extern Int VGOFF_(helper_CLD); |
| 1648 | extern Int VGOFF_(helper_STD); |
| 1649 | extern Int VGOFF_(helper_get_dirflag); |
| 1650 | |
| 1651 | extern Int VGOFF_(helper_shldl); |
| 1652 | extern Int VGOFF_(helper_shldw); |
| 1653 | extern Int VGOFF_(helper_shrdl); |
| 1654 | extern Int VGOFF_(helper_shrdw); |
| 1655 | |
| 1656 | extern Int VGOFF_(helper_RDTSC); |
| 1657 | extern Int VGOFF_(helper_CPUID); |
| 1658 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1659 | extern Int VGOFF_(helper_bsf); |
| 1660 | extern Int VGOFF_(helper_bsr); |
| 1661 | |
| 1662 | extern Int VGOFF_(helper_fstsw_AX); |
| 1663 | extern Int VGOFF_(helper_SAHF); |
sewardj | 4d0ab1f | 2002-03-24 10:00:09 +0000 | [diff] [blame] | 1664 | extern Int VGOFF_(helper_DAS); |
sewardj | fe8a166 | 2002-03-24 11:54:07 +0000 | [diff] [blame] | 1665 | extern Int VGOFF_(helper_DAA); |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1666 | |
| 1667 | extern Int VGOFF_(helper_value_check4_fail); |
| 1668 | extern Int VGOFF_(helper_value_check2_fail); |
| 1669 | extern Int VGOFF_(helper_value_check1_fail); |
| 1670 | extern Int VGOFF_(helper_value_check0_fail); |
| 1671 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1672 | extern Int VGOFF_(helperc_STOREV4); /* :: UInt -> Addr -> void */ |
| 1673 | extern Int VGOFF_(helperc_STOREV2); /* :: UInt -> Addr -> void */ |
| 1674 | extern Int VGOFF_(helperc_STOREV1); /* :: UInt -> Addr -> void */ |
| 1675 | |
| 1676 | extern Int VGOFF_(helperc_LOADV4); /* :: Addr -> UInt -> void */ |
| 1677 | extern Int VGOFF_(helperc_LOADV2); /* :: Addr -> UInt -> void */ |
| 1678 | extern Int VGOFF_(helperc_LOADV1); /* :: Addr -> UInt -> void */ |
| 1679 | |
| 1680 | extern Int VGOFF_(handle_esp_assignment); /* :: Addr -> void */ |
| 1681 | extern Int VGOFF_(fpu_write_check); /* :: Addr -> Int -> void */ |
| 1682 | extern Int VGOFF_(fpu_read_check); /* :: Addr -> Int -> void */ |
| 1683 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1684 | |
| 1685 | |
| 1686 | #endif /* ndef __VG_INCLUDE_H */ |
| 1687 | |
sewardj | 3b2736a | 2002-03-24 12:18:35 +0000 | [diff] [blame] | 1688 | |
| 1689 | /* --------------------------------------------------------------------- |
| 1690 | Finally - autoconf-generated settings |
| 1691 | ------------------------------------------------------------------ */ |
| 1692 | |
| 1693 | #include "config.h" |
| 1694 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1695 | /*--------------------------------------------------------------------*/ |
| 1696 | /*--- end vg_include.h ---*/ |
| 1697 | /*--------------------------------------------------------------------*/ |