blob: b4e359b3834036a924cf6474f16af90080f28644 [file] [log] [blame]
sewardjde4a1d02002-03-22 01:27:54 +00001
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
sewardjde4a1d02002-03-22 01:27:54 +000053
sewardj2e93c502002-04-12 11:12:52 +000054/* Magic values that %ebp might be set to when returning to the
sewardjde4a1d02002-03-22 01:27:54 +000055 dispatcher. The only other legitimate value is to point to the
sewardj2e93c502002-04-12 11:12:52 +000056 start of VG_(baseBlock). These also are return values from
sewardj54cacf02002-04-12 23:24:59 +000057 VG_(run_innerloop) to the scheduler.
sewardj2e93c502002-04-12 11:12:52 +000058
sewardj54cacf02002-04-12 23:24:59 +000059 EBP means %ebp can legitimately have this value when a basic block
60 returns to the dispatch loop. TRC means that this value is a valid
61 thread return code, which the dispatch loop may return to the
62 scheduler. */
63#define VG_TRC_EBP_JMP_STKADJ 17 /* EBP only; handled by dispatcher */
64#define VG_TRC_EBP_JMP_SYSCALL 19 /* EBP and TRC */
65#define VG_TRC_EBP_JMP_CLIENTREQ 23 /* EBP and TRC */
66
67#define VG_TRC_INNER_COUNTERZERO 29 /* TRC only; means bb ctr == 0 */
68#define VG_TRC_INNER_FASTMISS 31 /* TRC only; means fast-cache miss. */
69#define VG_TRC_UNRESUMABLE_SIGNAL 37 /* TRC only; got sigsegv/sigbus */
70
sewardjde4a1d02002-03-22 01:27:54 +000071
72/* Debugging hack for assembly code ... sigh. */
73#if 0
74#define OYNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal
75#else
76#define OYNK(nnn)
77#endif
78
sewardj2e93c502002-04-12 11:12:52 +000079#if 0
sewardjde4a1d02002-03-22 01:27:54 +000080#define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal
81#else
82#define OYNNK(nnn)
83#endif
84
sewardj2e93c502002-04-12 11:12:52 +000085
sewardjde4a1d02002-03-22 01:27:54 +000086/* Constants for the fast translation lookup cache. */
87#define VG_TT_FAST_BITS 15
88#define VG_TT_FAST_SIZE (1 << VG_TT_FAST_BITS)
89#define VG_TT_FAST_MASK ((VG_TT_FAST_SIZE) - 1)
90
91/* Constants for the fast original-code-write check cache. */
92
sewardj2e93c502002-04-12 11:12:52 +000093
sewardjde4a1d02002-03-22 01:27:54 +000094/* Usually you want this to be zero. */
95#define VG_SMC_FASTCHECK_IN_C 0
96
97#define VG_SMC_CACHE_BITS 19
98#define VG_SMC_CACHE_SIZE (1 << VG_SMC_CACHE_BITS)
99#define VG_SMC_CACHE_MASK ((VG_SMC_CACHE_SIZE) - 1)
100
101#define VG_SMC_CACHE_SHIFT 6
102
103
sewardj54cacf02002-04-12 23:24:59 +0000104/* Assembly code stubs make these requests ... */
105#define VG_USERREQ__SIGNAL_RETURNS 0x4001
sewardjbc5b99f2002-04-13 00:08:51 +0000106#define VG_USERREQ__PTHREAD_RETURNS 0x4002
107#define VG_USERREQ__SHUTDOWN_VALGRIND 0x4003
sewardj54cacf02002-04-12 23:24:59 +0000108
sewardjde4a1d02002-03-22 01:27:54 +0000109#endif /* ndef __VG_INCLUDE_H */
110
111/*--------------------------------------------------------------------*/
112/*--- end vg_constants.h ---*/
113/*--------------------------------------------------------------------*/