FreeBSD Helgrind: turn off check for locks held on exit for FreeBSD 14.2
[valgrind.git] / coregrind / pub_core_trampoline.h
blobd0bd6b859742263e1da59e24e855e5b2ad19dc9e
2 /*--------------------------------------------------------------------*/
3 /*--- The trampoline code page. pub_core_trampoline.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2017 Julian Seward
11 jseward@acm.org
13 This program is free software; you can redistribute it and/or
14 modify it under the terms of the GNU General Public License as
15 published by the Free Software Foundation; either version 2 of the
16 License, or (at your option) any later version.
18 This program is distributed in the hope that it will be useful, but
19 WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, see <http://www.gnu.org/licenses/>.
26 The GNU General Public License is contained in the file COPYING.
29 #ifndef __PUB_CORE_TRAMPOLINE_H
30 #define __PUB_CORE_TRAMPOLINE_H
32 #include "pub_core_basics.h" // VG_ macro
34 //--------------------------------------------------------------------
35 // PURPOSE: This module defines a few replacement functions for Linux
36 // vsyscalls, which we can't implement directly. It also contains
37 // stubs for signal returns. Note, all the code within runs on the
38 // simulated CPU. The vsyscall stubs are gotten to by use of the
39 // redirect mechanism.
41 // Note: generally, putting replacement functions in here is a bad
42 // idea, since any Dwarf frame-unwind info attached to them will not
43 // be seen by the unwinder in gcc's runtime support. This means
44 // unwinding during exception handling by gcc tends to fail if it
45 // encounters one of these replacement functions. A better place to
46 // put them is in one of the .so's preloaded into the client, since
47 // the client's ld.so will know about it and so gcc's unwinder
48 // (somehow) is able to get hold of it.
49 //--------------------------------------------------------------------
51 /* These two delimit our handwritten assembly code, so we can tell
52 tools which track memory that this area should be regarded as
53 readable, at least. Otherwise Memcheck complains we're jumping to
54 invalid addresses. */
56 extern Addr VG_(trampoline_stuff_start);
57 extern Addr VG_(trampoline_stuff_end);
59 #if defined(VGP_x86_freebsd)
60 extern void VG_(x86_freebsd_SUBST_FOR_sigreturn);
61 #endif
63 #if defined(VGP_amd64_freebsd)
64 extern void VG_(amd64_freebsd_SUBST_FOR_sigreturn);
65 #endif
67 #if defined(VGP_arm64_freebsd)
68 extern void VG_(arm64_freebsd_SUBST_FOR_sigreturn);
69 #endif
71 #if defined(VGP_x86_linux)
72 extern Addr VG_(x86_linux_SUBST_FOR_sigreturn);
73 extern Addr VG_(x86_linux_SUBST_FOR_rt_sigreturn);
74 extern Char* VG_(x86_linux_REDIR_FOR_index) ( const Char*, Int );
75 extern UInt VG_(x86_linux_REDIR_FOR_strlen)( void* );
76 #endif
78 #if defined(VGP_amd64_linux)
79 extern Addr VG_(amd64_linux_SUBST_FOR_rt_sigreturn);
80 extern Addr VG_(amd64_linux_REDIR_FOR_vgettimeofday);
81 extern Addr VG_(amd64_linux_REDIR_FOR_vtime);
82 extern Addr VG_(amd64_linux_REDIR_FOR_vgetcpu);
83 extern UInt VG_(amd64_linux_REDIR_FOR_strlen)( void* );
84 extern Int VG_(amd64_linux_REDIR_FOR_strcmp)( void*, void* );
85 extern Char* VG_(amd64_linux_REDIR_FOR_index) ( const Char*, Int );
86 #endif
88 #if defined(VGP_ppc32_linux)
89 extern Addr VG_(ppc32_linux_SUBST_FOR_sigreturn);
90 extern Addr VG_(ppc32_linux_SUBST_FOR_rt_sigreturn);
91 extern UInt VG_(ppc32_linux_REDIR_FOR_strlen)( void* );
92 extern UInt VG_(ppc32_linux_REDIR_FOR_strcmp)( void*, void* );
93 extern void* VG_(ppc32_linux_REDIR_FOR_strchr)( void*, Int );
94 #endif
96 #if defined(VGP_ppc64be_linux) || defined(VGP_ppc64le_linux)
97 extern Addr VG_(ppc64_linux_SUBST_FOR_rt_sigreturn);
98 extern UInt VG_(ppc64_linux_REDIR_FOR_strlen)( void* );
99 extern void* VG_(ppc64_linux_REDIR_FOR_strchr)( void*, Int );
100 /* A label (sans dot) marking the ultra-magical return stub via which
101 all redirected and wrapped functions are made to "return" on
102 ppc64-linux. The one insn at this label is never really
103 translated. Instead, m_translate generates IR to restore the
104 thread's LR and R2 registers from a small stack in the ppc64 guest
105 state structure, and then branch to LR. Convoluted? Confusing?
106 You betcha. Could I think of anything simpler? No. */
107 extern Addr VG_(ppctoc_magic_redirect_return_stub);
108 #endif
110 #if defined(VGP_arm_linux)
111 extern Addr VG_(arm_linux_SUBST_FOR_sigreturn);
112 extern Addr VG_(arm_linux_SUBST_FOR_rt_sigreturn);
113 extern UInt VG_(arm_linux_REDIR_FOR_strlen)( void* );
114 extern void* VG_(arm_linux_REDIR_FOR_index) ( void*, Int );
115 extern void* VG_(arm_linux_REDIR_FOR_memcpy)( void*, void*, Int );
116 extern void* VG_(arm_linux_REDIR_FOR_strcmp)( void*, void* );
117 #endif
119 #if defined(VGP_arm64_linux)
120 extern Addr VG_(arm64_linux_SUBST_FOR_rt_sigreturn);
121 extern ULong VG_(arm64_linux_REDIR_FOR_strlen)( void* );
122 extern void* VG_(arm64_linux_REDIR_FOR_index) ( void*, Long );
123 extern Long VG_(arm64_linux_REDIR_FOR_strcmp)( void*, void* );
124 #endif
126 #if defined(VGP_x86_darwin)
127 extern Addr VG_(x86_darwin_SUBST_FOR_sigreturn);
128 extern SizeT VG_(x86_darwin_REDIR_FOR_strlen)( void* );
129 extern SizeT VG_(x86_darwin_REDIR_FOR_strcmp)( void*, void* );
130 extern void* VG_(x86_darwin_REDIR_FOR_strcat)( void*, void * );
131 extern char* VG_(x86_darwin_REDIR_FOR_strcpy)( char *s1, char *s2 );
132 extern SizeT VG_(x86_darwin_REDIR_FOR_strlcat)( char *s1, const char *s2,
133 SizeT size );
134 #endif
136 #if defined(VGP_amd64_darwin)
137 extern Addr VG_(amd64_darwin_SUBST_FOR_sigreturn);
138 extern SizeT VG_(amd64_darwin_REDIR_FOR_strlen)( void* );
139 extern SizeT VG_(amd64_darwin_REDIR_FOR_strcmp)( void*, void* );
140 extern void* VG_(amd64_darwin_REDIR_FOR_strcat)( void*, void * );
141 extern char* VG_(amd64_darwin_REDIR_FOR_strcpy)( char *s1, char *s2 );
142 extern SizeT VG_(amd64_darwin_REDIR_FOR_strlcat)( char *s1, const char *s2,
143 SizeT size );
144 extern UInt VG_(amd64_darwin_REDIR_FOR_arc4random)( void );
145 # if DARWIN_VERS == DARWIN_10_9
146 extern char* VG_(amd64_darwin_REDIR_FOR_strchr)( const char*, int );
147 # endif
148 #endif
150 #if defined(VGP_s390x_linux)
151 extern Addr VG_(s390x_linux_SUBST_FOR_sigreturn);
152 extern Addr VG_(s390x_linux_SUBST_FOR_rt_sigreturn);
153 // Note: Long for the 2nd parameter because according to z-series ABI,
154 // section "Parameter Passing" SIMPLE_ARG:
155 // "Values shorter than 64 bits are sign- or zero-extended
156 // (as appropriate) to 64 bits."
157 extern void* VG_(s390x_linux_REDIR_FOR_index) ( void*, Long );
158 #endif
160 #if defined(VGP_mips32_linux)
161 extern Addr VG_(mips32_linux_SUBST_FOR_sigreturn);
162 extern Addr VG_(mips32_linux_SUBST_FOR_rt_sigreturn);
163 extern Char* VG_(mips32_linux_REDIR_FOR_index)( const Char*, Int );
164 extern UInt VG_(mips32_linux_REDIR_FOR_strlen)( void* );
165 #endif
167 #if defined(VGP_mips64_linux)
168 extern Addr VG_(mips64_linux_SUBST_FOR_rt_sigreturn);
169 extern Char* VG_(mips64_linux_REDIR_FOR_index)( const Char*, Int );
170 extern UInt VG_(mips64_linux_REDIR_FOR_strlen)( void* );
171 #endif
173 #if defined(VGP_nanomips_linux)
174 extern Addr VG_(nanomips_linux_SUBST_FOR_rt_sigreturn);
175 extern Char* VG_(nanomips_linux_REDIR_FOR_index)( const Char*, Int );
176 extern UInt VG_(nanomips_linux_REDIR_FOR_strlen)( void* );
177 #endif
179 #if defined(VGP_x86_solaris)
180 extern SizeT VG_(x86_solaris_REDIR_FOR_strcmp)(const HChar *, const HChar *);
181 extern SizeT VG_(x86_solaris_REDIR_FOR_strlen)(const HChar *);
182 #endif
184 #if defined(VGP_amd64_solaris)
185 extern HChar *VG_(amd64_solaris_REDIR_FOR_strcpy)(HChar *, const HChar *);
186 extern HChar *VG_(amd64_solaris_REDIR_FOR_strncpy)(HChar *, const HChar *,
187 SizeT);
188 extern Int VG_(amd64_solaris_REDIR_FOR_strcmp)(const HChar *, const HChar *);
189 extern HChar *VG_(amd64_solaris_REDIR_FOR_strcat)(HChar *, const HChar *);
190 extern SizeT VG_(amd64_solaris_REDIR_FOR_strlen)(const HChar *);
191 #endif
193 #endif // __PUB_CORE_TRAMPOLINE_H
195 /*--------------------------------------------------------------------*/
196 /*--- end ---*/
197 /*--------------------------------------------------------------------*/