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 | /* |
njn | c953984 | 2002-10-02 13:26:35 +0000 | [diff] [blame] | 8 | This file is part of Valgrind, an extensible x86 protected-mode |
| 9 | emulator for monitoring program execution on x86-Unixes. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 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 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 29 | The GNU General Public License is contained in the file COPYING. |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 30 | */ |
| 31 | |
| 32 | #ifndef __VG_CONSTANTS_H |
| 33 | #define __VG_CONSTANTS_H |
| 34 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 35 | #include "vg_constants_skin.h" |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 36 | |
| 37 | /* This file is included in all Valgrind source files, including |
| 38 | assembly ones. */ |
| 39 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 40 | /* Magic values that %ebp might be set to when returning to the |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 41 | dispatcher. The only other legitimate value is to point to the |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 42 | start of VG_(baseBlock). These also are return values from |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 43 | VG_(run_innerloop) to the scheduler. |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 44 | |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 45 | EBP means %ebp can legitimately have this value when a basic block |
| 46 | returns to the dispatch loop. TRC means that this value is a valid |
| 47 | thread return code, which the dispatch loop may return to the |
| 48 | scheduler. */ |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 49 | #define VG_TRC_EBP_JMP_SYSCALL 19 /* EBP and TRC */ |
| 50 | #define VG_TRC_EBP_JMP_CLIENTREQ 23 /* EBP and TRC */ |
| 51 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 52 | #define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */ |
| 53 | #define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */ |
| 54 | #define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */ |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 55 | |
sewardj | 22854b9 | 2002-11-30 14:00:47 +0000 | [diff] [blame] | 56 | /* size of call instruction put into generated code at jump sites */ |
| 57 | #define VG_PATCHME_CALLSZ 5 |
| 58 | |
| 59 | /* size of jmp instruction which overwrites the call */ |
| 60 | #define VG_PATCHME_JMPSZ 5 |
| 61 | |
| 62 | /* maximum number of normal jumps which can appear in a basic block */ |
| 63 | #define VG_MAX_JUMPS 2 |
| 64 | |
| 65 | /* Offset of code in a TCEntry */ |
| 66 | #define VG_CODE_OFFSET (8 + VG_MAX_JUMPS * 2) |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 67 | |
| 68 | /* Debugging hack for assembly code ... sigh. */ |
| 69 | #if 0 |
| 70 | #define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal |
| 71 | #else |
| 72 | #define OYNK(nnn) |
| 73 | #endif |
| 74 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 75 | #if 0 |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 76 | #define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal |
| 77 | #else |
| 78 | #define OYNNK(nnn) |
| 79 | #endif |
| 80 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 81 | |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 82 | /* Constants for the fast translation lookup cache. */ |
| 83 | #define VG_TT_FAST_BITS 15 |
| 84 | #define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS) |
| 85 | #define VG_TT_FAST_MASK ((VG_TT_FAST_SIZE) - 1) |
| 86 | |
| 87 | /* Constants for the fast original-code-write check cache. */ |
| 88 | |
sewardj | 2e93c50 | 2002-04-12 11:12:52 +0000 | [diff] [blame] | 89 | |
sewardj | 20917d8 | 2002-05-28 01:36:45 +0000 | [diff] [blame] | 90 | /* Assembly code stubs make this request */ |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 91 | #define VG_USERREQ__SIGNAL_RETURNS 0x4001 |
sewardj | 54cacf0 | 2002-04-12 23:24:59 +0000 | [diff] [blame] | 92 | |
njn25 | e49d8e7 | 2002-09-23 09:36:25 +0000 | [diff] [blame] | 93 | #endif /* ndef __VG_CONSTANTS_H */ |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 94 | |
| 95 | /*--------------------------------------------------------------------*/ |
| 96 | /*--- end vg_constants.h ---*/ |
| 97 | /*--------------------------------------------------------------------*/ |