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 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 13 | |
| 14 | This program is free software; you can redistribute it and/or |
| 15 | modify it under the terms of the GNU General Public License as |
| 16 | published by the Free Software Foundation; either version 2 of the |
| 17 | License, or (at your option) any later version. |
| 18 | |
| 19 | This program is distributed in the hope that it will be useful, but |
| 20 | WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | General Public License for more details. |
| 23 | |
| 24 | You should have received a copy of the GNU General Public License |
| 25 | along with this program; if not, write to the Free Software |
| 26 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 27 | 02111-1307, USA. |
| 28 | |
| 29 | The GNU General Public License is contained in the file LICENSE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef __VG_CONSTANTS_H |
| 33 | #define __VG_CONSTANTS_H |
| 34 | |
| 35 | |
| 36 | /* This file is included in all Valgrind source files, including |
| 37 | assembly ones. */ |
| 38 | |
| 39 | /* All symbols externally visible from valgrind.so are prefixed |
| 40 | as specified here. The prefix can be changed, so as to avoid |
| 41 | namespace conflict problems. |
| 42 | */ |
| 43 | #define VGAPPEND(str1,str2) str1##str2 |
| 44 | |
| 45 | /* These macros should add different prefixes so the same base |
| 46 | name can safely be used across different macros. */ |
| 47 | #define VG_(str) VGAPPEND(vgPlain_,str) |
| 48 | #define VGM_(str) VGAPPEND(vgMem_,str) |
| 49 | #define VGP_(str) VGAPPEND(vgProf_,str) |
| 50 | #define VGOFF_(str) VGAPPEND(vgOff_,str) |
| 51 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 52 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 53 | /* Magic values that %ebp might be set to when returning to the |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 54 | dispatcher. The only other legitimate value is to point to the |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 55 | start of VG_(baseBlock). These also are return values from |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 56 | VG_(run_innerloop) to the scheduler. |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 57 | |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 58 | EBP means %ebp can legitimately have this value when a basic block |
| 59 | returns to the dispatch loop. TRC means that this value is a valid |
| 60 | thread return code, which the dispatch loop may return to the |
| 61 | scheduler. */ |
| 62 | #define VG_TRC_EBP_JMP_STKADJ 17 /* EBP only; handled by dispatcher */ |
| 63 | #define VG_TRC_EBP_JMP_SYSCALL 19 /* EBP and TRC */ |
| 64 | #define VG_TRC_EBP_JMP_CLIENTREQ 23 /* EBP and TRC */ |
| 65 | |
| 66 | #define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */ |
| 67 | #define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */ |
| 68 | #define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */ |
| 69 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 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 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 78 | #if 0 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 79 | #define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal |
| 80 | #else |
| 81 | #define OYNNK(nnn) |
| 82 | #endif |
| 83 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 84 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 85 | /* Constants for the fast translation lookup cache. */ |
| 86 | #define VG_TT_FAST_BITS 15 |
| 87 | #define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS) |
| 88 | #define VG_TT_FAST_MASK ((VG_TT_FAST_SIZE) - 1) |
| 89 | |
| 90 | /* Constants for the fast original-code-write check cache. */ |
| 91 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 92 | |
sewardj | 20917d8 | 2002-05-28 01:36:45 +0000 | [diff] [blame] | 93 | /* Assembly code stubs make this request */ |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 94 | #define VG_USERREQ__SIGNAL_RETURNS 0x4001 |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 95 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 96 | #endif /* ndef __VG_INCLUDE_H */ |
| 97 | |
| 98 | /*--------------------------------------------------------------------*/ |
| 99 | /*--- end vg_constants.h ---*/ |
| 100 | /*--------------------------------------------------------------------*/ |