sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 1 | |
| 2 | /*--------------------------------------------------------------------*/ |
| 3 | /*--- A header file containing constants (for assembly code). ---*/ |
| 4 | /*--- vg_constants.h ---*/ |
| 5 | /*--------------------------------------------------------------------*/ |
| 6 | |
| 7 | /* |
| 8 | This file is part of Valgrind, an x86 protected-mode emulator |
| 9 | designed for debugging and profiling binaries on x86-Unixes. |
| 10 | |
| 11 | Copyright (C) 2000-2002 Julian Seward |
| 12 | jseward@acm.org |
| 13 | Julian_Seward@muraroa.demon.co.uk |
| 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_CONSTANTS_H |
| 34 | #define __VG_CONSTANTS_H |
| 35 | |
| 36 | |
| 37 | /* This file is included in all Valgrind source files, including |
| 38 | assembly ones. */ |
| 39 | |
| 40 | /* All symbols externally visible from valgrind.so are prefixed |
| 41 | as specified here. The prefix can be changed, so as to avoid |
| 42 | namespace conflict problems. |
| 43 | */ |
| 44 | #define VGAPPEND(str1,str2) str1##str2 |
| 45 | |
| 46 | /* These macros should add different prefixes so the same base |
| 47 | name can safely be used across different macros. */ |
| 48 | #define VG_(str) VGAPPEND(vgPlain_,str) |
| 49 | #define VGM_(str) VGAPPEND(vgMem_,str) |
| 50 | #define VGP_(str) VGAPPEND(vgProf_,str) |
| 51 | #define VGOFF_(str) VGAPPEND(vgOff_,str) |
| 52 | |
| 53 | /* Reasons why the inner simulation loop might stop (i.e. why has |
| 54 | vg_dispatch_ctr reached zero? */ |
| 55 | #define VG_Y_SIGCHECK 0 /* signal check due */ |
| 56 | #define VG_Y_SMC 1 /* write to code detected */ |
| 57 | #define VG_Y_EXIT 2 /* natural or debug end to simulation */ |
| 58 | #define VG_Y_TRANSLATE 3 /* translation of vg_m_eip needed */ |
| 59 | |
| 60 | /* Check for pending signals every this-many jumps. Since this |
| 61 | happens in the region of once per millisecond, we also take the |
| 62 | opportunity do do a bit of quick sanity checking at the same time. |
| 63 | Look at the call sites of VG_(deliver_signals). */ |
| 64 | #define VG_SIGCHECK_INTERVAL 1000 |
| 65 | |
| 66 | /* A ,agic values that %ebp might be set to when returning to the |
| 67 | dispatcher. The only other legitimate value is to point to the |
| 68 | start of VG_(baseBlock). */ |
| 69 | #define VG_EBP_DISPATCH_CHECKED 17 |
| 70 | |
| 71 | /* Debugging hack for assembly code ... sigh. */ |
| 72 | #if 0 |
| 73 | #define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal |
| 74 | #else |
| 75 | #define OYNK(nnn) |
| 76 | #endif |
| 77 | |
| 78 | #if 1 |
| 79 | #define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal |
| 80 | #else |
| 81 | #define OYNNK(nnn) |
| 82 | #endif |
| 83 | |
| 84 | /* Constants for the fast translation lookup cache. */ |
| 85 | #define VG_TT_FAST_BITS 15 |
| 86 | #define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS) |
| 87 | #define VG_TT_FAST_MASK ((VG_TT_FAST_SIZE) - 1) |
| 88 | |
| 89 | /* Constants for the fast original-code-write check cache. */ |
| 90 | |
| 91 | /* Usually you want this to be zero. */ |
| 92 | #define VG_SMC_FASTCHECK_IN_C 0 |
| 93 | |
| 94 | #define VG_SMC_CACHE_BITS 19 |
| 95 | #define VG_SMC_CACHE_SIZE (1 << VG_SMC_CACHE_BITS) |
| 96 | #define VG_SMC_CACHE_MASK ((VG_SMC_CACHE_SIZE) - 1) |
| 97 | |
| 98 | #define VG_SMC_CACHE_SHIFT 6 |
| 99 | |
| 100 | |
| 101 | #endif /* ndef __VG_INCLUDE_H */ |
| 102 | |
| 103 | /*--------------------------------------------------------------------*/ |
| 104 | /*--- end vg_constants.h ---*/ |
| 105 | /*--------------------------------------------------------------------*/ |