blob: 252353c468f046b480a53383b9f023c55f97b9ca [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
sewardjde4a1d02002-03-22 01:27:54 +000013
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
sewardjde4a1d02002-03-22 01:27:54 +000052
sewardj2e93c502002-04-12 11:12:52 +000053/* Magic values that %ebp might be set to when returning to the
sewardjde4a1d02002-03-22 01:27:54 +000054 dispatcher. The only other legitimate value is to point to the
sewardj2e93c502002-04-12 11:12:52 +000055 start of VG_(baseBlock). These also are return values from
sewardj54cacf02002-04-12 23:24:59 +000056 VG_(run_innerloop) to the scheduler.
sewardj2e93c502002-04-12 11:12:52 +000057
sewardj54cacf02002-04-12 23:24:59 +000058 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
sewardjde4a1d02002-03-22 01:27:54 +000070
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
sewardj2e93c502002-04-12 11:12:52 +000078#if 0
sewardjde4a1d02002-03-22 01:27:54 +000079#define OYNNK(nnn) pushal; pushl $nnn; call VG_(oynk) ; addl $4,%esp; popal
80#else
81#define OYNNK(nnn)
82#endif
83
sewardj2e93c502002-04-12 11:12:52 +000084
sewardjde4a1d02002-03-22 01:27:54 +000085/* 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
sewardj2e93c502002-04-12 11:12:52 +000092
sewardj54cacf02002-04-12 23:24:59 +000093/* Assembly code stubs make these requests ... */
94#define VG_USERREQ__SIGNAL_RETURNS 0x4001
sewardjbc5b99f2002-04-13 00:08:51 +000095#define VG_USERREQ__PTHREAD_RETURNS 0x4002
sewardj54cacf02002-04-12 23:24:59 +000096
sewardjde4a1d02002-03-22 01:27:54 +000097#endif /* ndef __VG_INCLUDE_H */
98
99/*--------------------------------------------------------------------*/
100/*--- end vg_constants.h ---*/
101/*--------------------------------------------------------------------*/