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