Mercurial > pidgin
annotate libpurple/valgrind.h @ 28442:e0223ad82ca1
account: Don't leak the account->privacy / account->deny lists.
Multiple similar to:
==21150== 412 (32 direct, 380 indirect) bytes in 2 blocks are definitely lost in loss record 12,416 of 13,348
==21150== at 0x4C221A7: malloc (vg_replace_malloc.c:195)
==21150== by 0x90AA552: g_malloc (gmem.c:131)
==21150== by 0x90C03C7: g_slice_alloc (gslice.c:824)
==21150== by 0x90C0E05: g_slist_append (gslist.c:117)
==21150== by 0x93AE56F: purple_privacy_permit_add (privacy.c:58)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 26 Oct 2009 04:21:28 +0000 |
parents | c1314a6cefcf |
children |
rev | line source |
---|---|
27711
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1 /* -*- c -*- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2 ---------------------------------------------------------------- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
4 Notice that the following BSD-style license applies to this one |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
5 file (valgrind.h) only. The rest of Valgrind is licensed under the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
6 terms of the GNU General Public License, version 2, unless |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
7 otherwise indicated. See the COPYING file in the source |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
8 distribution for details. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
9 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
10 ---------------------------------------------------------------- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
11 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
12 This file is part of Valgrind, a dynamic binary instrumentation |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
13 framework. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
14 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
15 Copyright (C) 2000-2008 Julian Seward. All rights reserved. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
16 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
17 Redistribution and use in source and binary forms, with or without |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
18 modification, are permitted provided that the following conditions |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
19 are met: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
20 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
21 1. Redistributions of source code must retain the above copyright |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
22 notice, this list of conditions and the following disclaimer. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
23 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
24 2. The origin of this software must not be misrepresented; you must |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
25 not claim that you wrote the original software. If you use this |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
26 software in a product, an acknowledgment in the product |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
27 documentation would be appreciated but is not required. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
28 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
29 3. Altered source versions must be plainly marked as such, and must |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
30 not be misrepresented as being the original software. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
31 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
32 4. The name of the author may not be used to endorse or promote |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
33 products derived from this software without specific prior written |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
34 permission. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
35 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
36 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
37 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
38 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
39 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
40 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
41 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
42 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
43 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
44 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
45 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
46 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
47 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
48 ---------------------------------------------------------------- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
49 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
50 Notice that the above BSD-style license applies to this one file |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
51 (valgrind.h) only. The entire rest of Valgrind is licensed under |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
52 the terms of the GNU General Public License, version 2. See the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
53 COPYING file in the source distribution for details. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
54 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
55 ---------------------------------------------------------------- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
56 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
57 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
58 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
59 /* This file is for inclusion into client (your!) code. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
60 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
61 You can use these macros to manipulate and query Valgrind's |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
62 execution inside your own programs. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
63 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
64 The resulting executables will still run without Valgrind, just a |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
65 little bit more slowly than they otherwise would, but otherwise |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
66 unchanged. When not running on valgrind, each client request |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
67 consumes very few (eg. 7) instructions, so the resulting performance |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
68 loss is negligible unless you plan to execute client requests |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
69 millions of times per second. Nevertheless, if that is still a |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
70 problem, you can compile with the NVALGRIND symbol defined (gcc |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
71 -DNVALGRIND) so that client requests are not even compiled in. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
72 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
73 #ifndef __VALGRIND_H |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
74 #define __VALGRIND_H |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
75 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
76 #include <stdarg.h> |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
77 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
78 /* Nb: this file might be included in a file compiled with -ansi. So |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
79 we can't use C++ style "//" comments nor the "asm" keyword (instead |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
80 use "__asm__"). */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
81 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
82 /* Derive some tags indicating what the target platform is. Note |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
83 that in this file we're using the compiler's CPP symbols for |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
84 identifying architectures, which are different to the ones we use |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
85 within the rest of Valgrind. Note, __powerpc__ is active for both |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
86 32 and 64-bit PPC, whereas __powerpc64__ is only active for the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
87 latter (on Linux, that is). */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
88 #undef PLAT_x86_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
89 #undef PLAT_amd64_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
90 #undef PLAT_ppc32_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
91 #undef PLAT_ppc64_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
92 #undef PLAT_ppc32_aix5 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
93 #undef PLAT_ppc64_aix5 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
94 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
95 #if !defined(_AIX) && defined(__i386__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
96 # define PLAT_x86_linux 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
97 #elif !defined(_AIX) && defined(__x86_64__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
98 # define PLAT_amd64_linux 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
99 #elif !defined(_AIX) && defined(__powerpc__) && !defined(__powerpc64__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
100 # define PLAT_ppc32_linux 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
101 #elif !defined(_AIX) && defined(__powerpc__) && defined(__powerpc64__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
102 # define PLAT_ppc64_linux 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
103 #elif defined(_AIX) && defined(__64BIT__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
104 # define PLAT_ppc64_aix5 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
105 #elif defined(_AIX) && !defined(__64BIT__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
106 # define PLAT_ppc32_aix5 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
107 #endif |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
108 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
109 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
110 /* If we're not compiling for our target platform, don't generate |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
111 any inline asms. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
112 #if !defined(PLAT_x86_linux) && !defined(PLAT_amd64_linux) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
113 && !defined(PLAT_ppc32_linux) && !defined(PLAT_ppc64_linux) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
114 && !defined(PLAT_ppc32_aix5) && !defined(PLAT_ppc64_aix5) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
115 # if !defined(NVALGRIND) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
116 # define NVALGRIND 1 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
117 # endif |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
118 #endif |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
119 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
120 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
121 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
122 /* ARCHITECTURE SPECIFICS for SPECIAL INSTRUCTIONS. There is nothing */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
123 /* in here of use to end-users -- skip to the next section. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
124 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
125 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
126 #if defined(NVALGRIND) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
127 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
128 /* Define NVALGRIND to completely remove the Valgrind magic sequence |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
129 from the compiled code (analogous to NDEBUG's effects on |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
130 assert()) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
131 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
132 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
133 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
134 { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
135 (_zzq_rlval) = (_zzq_default); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
136 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
137 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
138 #else /* ! NVALGRIND */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
139 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
140 /* The following defines the magic code sequences which the JITter |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
141 spots and handles magically. Don't look too closely at them as |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
142 they will rot your brain. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
143 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
144 The assembly code sequences for all architectures is in this one |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
145 file. This is because this file must be stand-alone, and we don't |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
146 want to have multiple files. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
147 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
148 For VALGRIND_DO_CLIENT_REQUEST, we must ensure that the default |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
149 value gets put in the return slot, so that everything works when |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
150 this is executed not under Valgrind. Args are passed in a memory |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
151 block, and so there's no intrinsic limit to the number that could |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
152 be passed, but it's currently five. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
153 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
154 The macro args are: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
155 _zzq_rlval result lvalue |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
156 _zzq_default default value (result returned when running on real CPU) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
157 _zzq_request request code |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
158 _zzq_arg1..5 request params |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
159 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
160 The other two macros are used to support function wrapping, and are |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
161 a lot simpler. VALGRIND_GET_NR_CONTEXT returns the value of the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
162 guest's NRADDR pseudo-register and whatever other information is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
163 needed to safely run the call original from the wrapper: on |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
164 ppc64-linux, the R2 value at the divert point is also needed. This |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
165 information is abstracted into a user-visible type, OrigFn. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
166 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
167 VALGRIND_CALL_NOREDIR_* behaves the same as the following on the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
168 guest, but guarantees that the branch instruction will not be |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
169 redirected: x86: call *%eax, amd64: call *%rax, ppc32/ppc64: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
170 branch-and-link-to-r11. VALGRIND_CALL_NOREDIR is just text, not a |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
171 complete inline asm, since it needs to be combined with more magic |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
172 inline asm stuff to be useful. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
173 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
174 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
175 /* ------------------------- x86-linux ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
176 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
177 #if defined(PLAT_x86_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
178 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
179 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
180 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
181 unsigned int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
182 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
183 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
184 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
185 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
186 "roll $3, %%edi ; roll $13, %%edi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
187 "roll $29, %%edi ; roll $19, %%edi\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
188 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
189 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
190 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
191 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
192 { volatile unsigned int _zzq_args[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
193 volatile unsigned int _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
194 _zzq_args[0] = (unsigned int)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
195 _zzq_args[1] = (unsigned int)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
196 _zzq_args[2] = (unsigned int)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
197 _zzq_args[3] = (unsigned int)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
198 _zzq_args[4] = (unsigned int)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
199 _zzq_args[5] = (unsigned int)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
200 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
201 /* %EDX = client_request ( %EAX ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
202 "xchgl %%ebx,%%ebx" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
203 : "=d" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
204 : "a" (&_zzq_args[0]), "0" (_zzq_default) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
205 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
206 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
207 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
208 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
209 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
210 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
211 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
212 volatile unsigned int __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
213 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
214 /* %EAX = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
215 "xchgl %%ecx,%%ecx" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
216 : "=a" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
217 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
218 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
219 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
220 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
221 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
222 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
223 #define VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
224 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
225 /* call-noredir *%EAX */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
226 "xchgl %%edx,%%edx\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
227 #endif /* PLAT_x86_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
228 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
229 /* ------------------------ amd64-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
230 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
231 #if defined(PLAT_amd64_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
232 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
233 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
234 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
235 unsigned long long int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
236 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
237 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
238 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
239 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
240 "rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
241 "rolq $61, %%rdi ; rolq $51, %%rdi\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
242 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
243 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
244 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
245 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
246 { volatile unsigned long long int _zzq_args[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
247 volatile unsigned long long int _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
248 _zzq_args[0] = (unsigned long long int)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
249 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
250 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
251 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
252 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
253 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
254 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
255 /* %RDX = client_request ( %RAX ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
256 "xchgq %%rbx,%%rbx" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
257 : "=d" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
258 : "a" (&_zzq_args[0]), "0" (_zzq_default) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
259 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
260 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
261 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
262 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
263 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
264 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
265 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
266 volatile unsigned long long int __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
267 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
268 /* %RAX = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
269 "xchgq %%rcx,%%rcx" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
270 : "=a" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
271 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
272 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
273 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
274 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
275 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
276 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
277 #define VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
278 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
279 /* call-noredir *%RAX */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
280 "xchgq %%rdx,%%rdx\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
281 #endif /* PLAT_amd64_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
282 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
283 /* ------------------------ ppc32-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
284 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
285 #if defined(PLAT_ppc32_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
286 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
287 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
288 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
289 unsigned int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
290 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
291 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
292 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
293 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
294 "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
295 "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
296 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
297 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
298 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
299 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
300 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
301 { unsigned int _zzq_args[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
302 unsigned int _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
303 unsigned int* _zzq_ptr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
304 _zzq_args[0] = (unsigned int)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
305 _zzq_args[1] = (unsigned int)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
306 _zzq_args[2] = (unsigned int)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
307 _zzq_args[3] = (unsigned int)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
308 _zzq_args[4] = (unsigned int)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
309 _zzq_args[5] = (unsigned int)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
310 _zzq_ptr = _zzq_args; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
311 __asm__ volatile("mr 3,%1\n\t" /*default*/ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
312 "mr 4,%2\n\t" /*ptr*/ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
313 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
314 /* %R3 = client_request ( %R4 ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
315 "or 1,1,1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
316 "mr %0,3" /*result*/ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
317 : "=b" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
318 : "b" (_zzq_default), "b" (_zzq_ptr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
319 : "cc", "memory", "r3", "r4"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
320 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
321 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
322 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
323 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
324 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
325 unsigned int __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
326 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
327 /* %R3 = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
328 "or 2,2,2\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
329 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
330 : "=b" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
331 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
332 : "cc", "memory", "r3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
333 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
334 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
335 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
336 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
337 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
338 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
339 /* branch-and-link-to-noredir *%R11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
340 "or 3,3,3\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
341 #endif /* PLAT_ppc32_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
342 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
343 /* ------------------------ ppc64-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
344 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
345 #if defined(PLAT_ppc64_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
346 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
347 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
348 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
349 unsigned long long int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
350 unsigned long long int r2; /* what tocptr do we need? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
351 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
352 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
353 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
354 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
355 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
356 "rotldi 0,0,61 ; rotldi 0,0,51\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
357 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
358 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
359 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
360 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
361 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
362 { unsigned long long int _zzq_args[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
363 register unsigned long long int _zzq_result __asm__("r3"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
364 register unsigned long long int* _zzq_ptr __asm__("r4"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
365 _zzq_args[0] = (unsigned long long int)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
366 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
367 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
368 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
369 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
370 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
371 _zzq_ptr = _zzq_args; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
372 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
373 /* %R3 = client_request ( %R4 ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
374 "or 1,1,1" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
375 : "=r" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
376 : "0" (_zzq_default), "r" (_zzq_ptr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
377 : "cc", "memory"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
378 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
379 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
380 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
381 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
382 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
383 register unsigned long long int __addr __asm__("r3"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
384 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
385 /* %R3 = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
386 "or 2,2,2" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
387 : "=r" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
388 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
389 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
390 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
391 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
392 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
393 /* %R3 = guest_NRADDR_GPR2 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
394 "or 4,4,4" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
395 : "=r" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
396 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
397 : "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
398 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
399 _zzq_orig->r2 = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
400 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
401 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
402 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
403 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
404 /* branch-and-link-to-noredir *%R11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
405 "or 3,3,3\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
406 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
407 #endif /* PLAT_ppc64_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
408 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
409 /* ------------------------ ppc32-aix5 ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
410 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
411 #if defined(PLAT_ppc32_aix5) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
412 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
413 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
414 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
415 unsigned int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
416 unsigned int r2; /* what tocptr do we need? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
417 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
418 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
419 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
420 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
421 "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
422 "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
423 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
424 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
425 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
426 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
427 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
428 { unsigned int _zzq_args[7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
429 register unsigned int _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
430 register unsigned int* _zzq_ptr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
431 _zzq_args[0] = (unsigned int)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
432 _zzq_args[1] = (unsigned int)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
433 _zzq_args[2] = (unsigned int)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
434 _zzq_args[3] = (unsigned int)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
435 _zzq_args[4] = (unsigned int)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
436 _zzq_args[5] = (unsigned int)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
437 _zzq_args[6] = (unsigned int)(_zzq_default); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
438 _zzq_ptr = _zzq_args; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
439 __asm__ volatile("mr 4,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
440 "lwz 3, 24(4)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
441 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
442 /* %R3 = client_request ( %R4 ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
443 "or 1,1,1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
444 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
445 : "=b" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
446 : "b" (_zzq_ptr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
447 : "r3", "r4", "cc", "memory"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
448 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
449 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
450 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
451 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
452 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
453 register unsigned int __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
454 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
455 /* %R3 = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
456 "or 2,2,2\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
457 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
458 : "=b" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
459 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
460 : "r3", "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
461 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
462 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
463 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
464 /* %R3 = guest_NRADDR_GPR2 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
465 "or 4,4,4\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
466 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
467 : "=b" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
468 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
469 : "r3", "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
470 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
471 _zzq_orig->r2 = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
472 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
473 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
474 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
475 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
476 /* branch-and-link-to-noredir *%R11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
477 "or 3,3,3\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
478 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
479 #endif /* PLAT_ppc32_aix5 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
480 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
481 /* ------------------------ ppc64-aix5 ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
482 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
483 #if defined(PLAT_ppc64_aix5) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
484 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
485 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
486 struct { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
487 unsigned long long int nraddr; /* where's the code? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
488 unsigned long long int r2; /* what tocptr do we need? */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
489 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
490 OrigFn; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
491 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
492 #define __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
493 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
494 "rotldi 0,0,61 ; rotldi 0,0,51\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
495 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
496 #define VALGRIND_DO_CLIENT_REQUEST( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
497 _zzq_rlval, _zzq_default, _zzq_request, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
498 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
499 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
500 { unsigned long long int _zzq_args[7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
501 register unsigned long long int _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
502 register unsigned long long int* _zzq_ptr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
503 _zzq_args[0] = (unsigned int long long)(_zzq_request); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
504 _zzq_args[1] = (unsigned int long long)(_zzq_arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
505 _zzq_args[2] = (unsigned int long long)(_zzq_arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
506 _zzq_args[3] = (unsigned int long long)(_zzq_arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
507 _zzq_args[4] = (unsigned int long long)(_zzq_arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
508 _zzq_args[5] = (unsigned int long long)(_zzq_arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
509 _zzq_args[6] = (unsigned int long long)(_zzq_default); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
510 _zzq_ptr = _zzq_args; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
511 __asm__ volatile("mr 4,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
512 "ld 3, 48(4)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
513 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
514 /* %R3 = client_request ( %R4 ) */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
515 "or 1,1,1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
516 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
517 : "=b" (_zzq_result) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
518 : "b" (_zzq_ptr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
519 : "r3", "r4", "cc", "memory"); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
520 _zzq_rlval = _zzq_result; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
521 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
522 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
523 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
524 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
525 register unsigned long long int __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
526 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
527 /* %R3 = guest_NRADDR */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
528 "or 2,2,2\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
529 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
530 : "=b" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
531 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
532 : "r3", "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
533 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
534 _zzq_orig->nraddr = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
535 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
536 /* %R3 = guest_NRADDR_GPR2 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
537 "or 4,4,4\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
538 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
539 : "=b" (__addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
540 : \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
541 : "r3", "cc", "memory" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
542 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
543 _zzq_orig->r2 = __addr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
544 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
545 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
546 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
547 __SPECIAL_INSTRUCTION_PREAMBLE \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
548 /* branch-and-link-to-noredir *%R11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
549 "or 3,3,3\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
550 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
551 #endif /* PLAT_ppc64_aix5 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
552 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
553 /* Insert assembly code for other platforms here... */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
554 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
555 #endif /* NVALGRIND */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
556 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
557 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
558 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
559 /* PLATFORM SPECIFICS for FUNCTION WRAPPING. This is all very */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
560 /* ugly. It's the least-worst tradeoff I can think of. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
561 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
562 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
563 /* This section defines magic (a.k.a appalling-hack) macros for doing |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
564 guaranteed-no-redirection macros, so as to get from function |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
565 wrappers to the functions they are wrapping. The whole point is to |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
566 construct standard call sequences, but to do the call itself with a |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
567 special no-redirect call pseudo-instruction that the JIT |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
568 understands and handles specially. This section is long and |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
569 repetitious, and I can't see a way to make it shorter. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
570 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
571 The naming scheme is as follows: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
572 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
573 CALL_FN_{W,v}_{v,W,WW,WWW,WWWW,5W,6W,7W,etc} |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
574 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
575 'W' stands for "word" and 'v' for "void". Hence there are |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
576 different macros for calling arity 0, 1, 2, 3, 4, etc, functions, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
577 and for each, the possibility of returning a word-typed result, or |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
578 no result. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
579 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
580 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
581 /* Use these to write the name of your wrapper. NOTE: duplicates |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
582 VG_WRAP_FUNCTION_Z{U,Z} in pub_tool_redir.h. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
583 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
584 #define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
585 _vgwZU_##soname##_##fnname |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
586 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
587 #define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
588 _vgwZZ_##soname##_##fnname |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
589 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
590 /* Use this macro from within a wrapper function to collect the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
591 context (address and possibly other info) of the original function. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
592 Once you have that you can then use it in one of the CALL_FN_ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
593 macros. The type of the argument _lval is OrigFn. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
594 #define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
595 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
596 /* Derivatives of the main macros below, for calling functions |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
597 returning void. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
598 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
599 #define CALL_FN_v_v(fnptr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
600 do { volatile unsigned long _junk; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
601 CALL_FN_W_v(_junk,fnptr); } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
602 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
603 #define CALL_FN_v_W(fnptr, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
604 do { volatile unsigned long _junk; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
605 CALL_FN_W_W(_junk,fnptr,arg1); } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
606 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
607 #define CALL_FN_v_WW(fnptr, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
608 do { volatile unsigned long _junk; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
609 CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
610 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
611 #define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
612 do { volatile unsigned long _junk; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
613 CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
614 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
615 /* ------------------------- x86-linux ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
616 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
617 #if defined(PLAT_x86_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
618 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
619 /* These regs are trashed by the hidden call. No need to mention eax |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
620 as gcc can already see that, plus causes gcc to bomb. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
621 #define __CALLER_SAVED_REGS /*"eax"*/ "ecx", "edx" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
622 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
623 /* These CALL_FN_ macros assume that on x86-linux, sizeof(unsigned |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
624 long) == 4. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
625 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
626 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
627 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
628 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
629 volatile unsigned long _argvec[1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
630 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
631 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
632 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
633 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
634 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
635 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
636 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
637 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
638 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
639 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
640 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
641 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
642 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
643 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
644 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
645 volatile unsigned long _argvec[2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
646 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
647 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
648 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
649 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
650 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
651 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
652 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
653 "addl $4, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
654 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
655 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
656 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
657 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
658 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
659 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
660 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
661 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
662 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
663 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
664 volatile unsigned long _argvec[3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
665 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
666 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
667 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
668 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
669 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
670 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
671 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
672 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
673 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
674 "addl $8, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
675 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
676 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
677 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
678 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
679 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
680 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
681 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
682 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
683 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
684 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
685 volatile unsigned long _argvec[4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
686 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
687 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
688 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
689 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
690 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
691 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
692 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
693 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
694 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
695 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
696 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
697 "addl $12, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
698 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
699 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
700 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
701 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
702 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
703 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
704 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
705 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
706 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
707 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
708 volatile unsigned long _argvec[5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
709 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
710 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
711 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
712 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
713 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
714 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
715 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
716 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
717 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
718 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
719 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
720 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
721 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
722 "addl $16, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
723 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
724 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
725 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
726 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
727 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
728 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
729 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
730 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
731 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
732 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
733 volatile unsigned long _argvec[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
734 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
735 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
736 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
737 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
738 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
739 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
740 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
741 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
742 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
743 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
744 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
745 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
746 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
747 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
748 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
749 "addl $20, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
750 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
751 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
752 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
753 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
754 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
755 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
756 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
757 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
758 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
759 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
760 volatile unsigned long _argvec[7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
761 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
762 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
763 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
764 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
765 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
766 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
767 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
768 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
769 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
770 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
771 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
772 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
773 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
774 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
775 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
776 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
777 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
778 "addl $24, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
779 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
780 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
781 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
782 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
783 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
784 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
785 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
786 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
787 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
788 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
789 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
790 volatile unsigned long _argvec[8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
791 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
792 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
793 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
794 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
795 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
796 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
797 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
798 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
799 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
800 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
801 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
802 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
803 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
804 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
805 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
806 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
807 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
808 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
809 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
810 "addl $28, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
811 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
812 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
813 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
814 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
815 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
816 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
817 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
818 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
819 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
820 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
821 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
822 volatile unsigned long _argvec[9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
823 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
824 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
825 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
826 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
827 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
828 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
829 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
830 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
831 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
832 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
833 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
834 "pushl 32(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
835 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
836 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
837 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
838 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
839 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
840 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
841 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
842 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
843 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
844 "addl $32, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
845 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
846 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
847 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
848 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
849 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
850 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
851 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
852 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
853 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
854 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
855 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
856 volatile unsigned long _argvec[10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
857 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
858 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
859 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
860 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
861 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
862 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
863 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
864 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
865 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
866 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
867 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
868 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
869 "pushl 36(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
870 "pushl 32(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
871 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
872 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
873 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
874 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
875 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
876 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
877 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
878 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
879 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
880 "addl $36, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
881 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
882 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
883 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
884 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
885 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
886 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
887 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
888 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
889 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
890 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
891 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
892 volatile unsigned long _argvec[11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
893 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
894 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
895 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
896 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
897 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
898 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
899 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
900 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
901 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
902 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
903 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
904 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
905 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
906 "pushl 40(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
907 "pushl 36(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
908 "pushl 32(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
909 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
910 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
911 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
912 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
913 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
914 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
915 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
916 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
917 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
918 "addl $40, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
919 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
920 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
921 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
922 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
923 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
924 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
925 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
926 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
927 arg6,arg7,arg8,arg9,arg10, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
928 arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
929 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
930 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
931 volatile unsigned long _argvec[12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
932 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
933 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
934 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
935 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
936 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
937 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
938 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
939 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
940 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
941 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
942 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
943 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
944 _argvec[11] = (unsigned long)(arg11); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
945 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
946 "pushl 44(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
947 "pushl 40(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
948 "pushl 36(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
949 "pushl 32(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
950 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
951 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
952 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
953 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
954 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
955 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
956 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
957 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
958 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
959 "addl $44, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
960 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
961 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
962 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
963 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
964 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
965 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
966 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
967 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
968 arg6,arg7,arg8,arg9,arg10, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
969 arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
970 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
971 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
972 volatile unsigned long _argvec[13]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
973 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
974 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
975 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
976 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
977 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
978 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
979 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
980 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
981 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
982 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
983 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
984 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
985 _argvec[11] = (unsigned long)(arg11); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
986 _argvec[12] = (unsigned long)(arg12); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
987 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
988 "pushl 48(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
989 "pushl 44(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
990 "pushl 40(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
991 "pushl 36(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
992 "pushl 32(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
993 "pushl 28(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
994 "pushl 24(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
995 "pushl 20(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
996 "pushl 16(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
997 "pushl 12(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
998 "pushl 8(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
999 "pushl 4(%%eax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1000 "movl (%%eax), %%eax\n\t" /* target->%eax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1001 VALGRIND_CALL_NOREDIR_EAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1002 "addl $48, %%esp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1003 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1004 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1005 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1006 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1007 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1008 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1009 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1010 #endif /* PLAT_x86_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1011 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1012 /* ------------------------ amd64-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1013 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1014 #if defined(PLAT_amd64_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1015 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1016 /* ARGREGS: rdi rsi rdx rcx r8 r9 (the rest on stack in R-to-L order) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1017 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1018 /* These regs are trashed by the hidden call. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1019 #define __CALLER_SAVED_REGS /*"rax",*/ "rcx", "rdx", "rsi", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1020 "rdi", "r8", "r9", "r10", "r11" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1021 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1022 /* These CALL_FN_ macros assume that on amd64-linux, sizeof(unsigned |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1023 long) == 8. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1024 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1025 /* NB 9 Sept 07. There is a nasty kludge here in all these CALL_FN_ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1026 macros. In order not to trash the stack redzone, we need to drop |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1027 %rsp by 128 before the hidden call, and restore afterwards. The |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1028 nastyness is that it is only by luck that the stack still appears |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1029 to be unwindable during the hidden call - since then the behaviour |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1030 of any routine using this macro does not match what the CFI data |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1031 says. Sigh. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1032 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1033 Why is this important? Imagine that a wrapper has a stack |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1034 allocated local, and passes to the hidden call, a pointer to it. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1035 Because gcc does not know about the hidden call, it may allocate |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1036 that local in the redzone. Unfortunately the hidden call may then |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1037 trash it before it comes to use it. So we must step clear of the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1038 redzone, for the duration of the hidden call, to make it safe. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1039 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1040 Probably the same problem afflicts the other redzone-style ABIs too |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1041 (ppc64-linux, ppc32-aix5, ppc64-aix5); but for those, the stack is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1042 self describing (none of this CFI nonsense) so at least messing |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1043 with the stack pointer doesn't give a danger of non-unwindable |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1044 stack. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1045 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1046 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1047 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1048 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1049 volatile unsigned long _argvec[1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1050 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1051 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1052 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1053 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1054 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1055 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1056 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1057 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1058 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1059 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1060 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1061 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1062 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1063 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1064 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1065 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1066 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1067 volatile unsigned long _argvec[2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1068 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1069 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1070 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1071 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1072 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1073 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1074 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1075 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1076 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1077 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1078 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1079 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1080 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1081 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1082 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1083 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1084 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1085 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1086 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1087 volatile unsigned long _argvec[3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1088 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1089 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1090 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1091 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1092 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1093 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1094 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1095 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1096 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1097 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1098 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1099 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1100 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1101 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1102 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1103 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1104 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1105 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1106 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1107 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1108 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1109 volatile unsigned long _argvec[4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1110 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1111 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1112 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1113 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1114 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1115 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1116 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1117 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1118 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1119 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1120 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1121 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1122 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1123 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1124 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1125 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1126 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1127 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1128 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1129 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1130 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1131 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1132 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1133 volatile unsigned long _argvec[5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1134 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1135 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1136 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1137 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1138 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1139 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1140 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1141 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1142 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1143 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1144 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1145 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1146 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1147 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1148 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1149 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1150 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1151 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1152 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1153 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1154 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1155 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1156 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1157 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1158 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1159 volatile unsigned long _argvec[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1160 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1161 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1162 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1163 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1164 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1165 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1166 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1167 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1168 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1169 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1170 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1171 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1172 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1173 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1174 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1175 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1176 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1177 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1178 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1179 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1180 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1181 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1182 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1183 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1184 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1185 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1186 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1187 volatile unsigned long _argvec[7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1188 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1189 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1190 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1191 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1192 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1193 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1194 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1195 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1196 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1197 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1198 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1199 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1200 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1201 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1202 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1203 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1204 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1205 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1206 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1207 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1208 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1209 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1210 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1211 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1212 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1213 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1214 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1215 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1216 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1217 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1218 volatile unsigned long _argvec[8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1219 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1220 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1221 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1222 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1223 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1224 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1225 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1226 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1227 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1228 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1229 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1230 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1231 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1232 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1233 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1234 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1235 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1236 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1237 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1238 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1239 "addq $8, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1240 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1241 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1242 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1243 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1244 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1245 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1246 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1247 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1248 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1249 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1250 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1251 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1252 volatile unsigned long _argvec[9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1253 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1254 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1255 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1256 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1257 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1258 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1259 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1260 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1261 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1262 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1263 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1264 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1265 "pushq 64(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1266 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1267 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1268 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1269 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1270 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1271 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1272 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1273 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1274 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1275 "addq $16, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1276 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1277 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1278 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1279 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1280 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1281 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1282 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1283 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1284 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1285 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1286 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1287 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1288 volatile unsigned long _argvec[10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1289 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1290 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1291 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1292 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1293 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1294 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1295 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1296 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1297 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1298 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1299 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1300 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1301 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1302 "pushq 72(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1303 "pushq 64(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1304 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1305 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1306 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1307 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1308 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1309 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1310 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1311 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1312 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1313 "addq $24, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1314 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1315 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1316 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1317 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1318 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1319 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1320 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1321 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1322 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1323 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1324 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1325 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1326 volatile unsigned long _argvec[11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1327 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1328 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1329 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1330 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1331 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1332 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1333 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1334 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1335 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1336 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1337 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1338 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1339 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1340 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1341 "pushq 80(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1342 "pushq 72(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1343 "pushq 64(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1344 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1345 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1346 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1347 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1348 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1349 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1350 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1351 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1352 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1353 "addq $32, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1354 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1355 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1356 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1357 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1358 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1359 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1360 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1361 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1362 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1363 arg7,arg8,arg9,arg10,arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1364 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1365 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1366 volatile unsigned long _argvec[12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1367 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1368 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1369 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1370 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1371 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1372 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1373 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1374 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1375 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1376 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1377 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1378 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1379 _argvec[11] = (unsigned long)(arg11); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1380 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1381 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1382 "pushq 88(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1383 "pushq 80(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1384 "pushq 72(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1385 "pushq 64(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1386 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1387 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1388 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1389 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1390 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1391 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1392 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1393 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1394 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1395 "addq $40, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1396 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1397 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1398 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1399 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1400 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1401 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1402 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1403 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1404 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1405 arg7,arg8,arg9,arg10,arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1406 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1407 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1408 volatile unsigned long _argvec[13]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1409 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1410 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1411 _argvec[1] = (unsigned long)(arg1); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1412 _argvec[2] = (unsigned long)(arg2); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1413 _argvec[3] = (unsigned long)(arg3); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1414 _argvec[4] = (unsigned long)(arg4); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1415 _argvec[5] = (unsigned long)(arg5); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1416 _argvec[6] = (unsigned long)(arg6); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1417 _argvec[7] = (unsigned long)(arg7); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1418 _argvec[8] = (unsigned long)(arg8); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1419 _argvec[9] = (unsigned long)(arg9); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1420 _argvec[10] = (unsigned long)(arg10); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1421 _argvec[11] = (unsigned long)(arg11); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1422 _argvec[12] = (unsigned long)(arg12); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1423 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1424 "subq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1425 "pushq 96(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1426 "pushq 88(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1427 "pushq 80(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1428 "pushq 72(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1429 "pushq 64(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1430 "pushq 56(%%rax)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1431 "movq 48(%%rax), %%r9\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1432 "movq 40(%%rax), %%r8\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1433 "movq 32(%%rax), %%rcx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1434 "movq 24(%%rax), %%rdx\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1435 "movq 16(%%rax), %%rsi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1436 "movq 8(%%rax), %%rdi\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1437 "movq (%%rax), %%rax\n\t" /* target->%rax */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1438 VALGRIND_CALL_NOREDIR_RAX \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1439 "addq $48, %%rsp\n" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1440 "addq $128,%%rsp\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1441 : /*out*/ "=a" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1442 : /*in*/ "a" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1443 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1444 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1445 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1446 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1447 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1448 #endif /* PLAT_amd64_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1449 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1450 /* ------------------------ ppc32-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1451 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1452 #if defined(PLAT_ppc32_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1453 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1454 /* This is useful for finding out about the on-stack stuff: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1455 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1456 extern int f9 ( int,int,int,int,int,int,int,int,int ); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1457 extern int f10 ( int,int,int,int,int,int,int,int,int,int ); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1458 extern int f11 ( int,int,int,int,int,int,int,int,int,int,int ); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1459 extern int f12 ( int,int,int,int,int,int,int,int,int,int,int,int ); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1460 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1461 int g9 ( void ) { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1462 return f9(11,22,33,44,55,66,77,88,99); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1463 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1464 int g10 ( void ) { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1465 return f10(11,22,33,44,55,66,77,88,99,110); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1466 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1467 int g11 ( void ) { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1468 return f11(11,22,33,44,55,66,77,88,99,110,121); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1469 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1470 int g12 ( void ) { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1471 return f12(11,22,33,44,55,66,77,88,99,110,121,132); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1472 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1473 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1474 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1475 /* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1476 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1477 /* These regs are trashed by the hidden call. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1478 #define __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1479 "lr", "ctr", "xer", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1480 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1481 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1482 "r11", "r12", "r13" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1483 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1484 /* These CALL_FN_ macros assume that on ppc32-linux, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1485 sizeof(unsigned long) == 4. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1486 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1487 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1488 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1489 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1490 volatile unsigned long _argvec[1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1491 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1492 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1493 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1494 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1495 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1496 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1497 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1498 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1499 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1500 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1501 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1502 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1503 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1504 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1505 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1506 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1507 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1508 volatile unsigned long _argvec[2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1509 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1510 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1511 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1512 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1513 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1514 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1515 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1516 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1517 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1518 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1519 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1520 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1521 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1522 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1523 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1524 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1525 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1526 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1527 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1528 volatile unsigned long _argvec[3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1529 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1530 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1531 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1532 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1533 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1534 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1535 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1536 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1537 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1538 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1539 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1540 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1541 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1542 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1543 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1544 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1545 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1546 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1547 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1548 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1549 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1550 volatile unsigned long _argvec[4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1551 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1552 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1553 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1554 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1555 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1556 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1557 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1558 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1559 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1560 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1561 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1562 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1563 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1564 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1565 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1566 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1567 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1568 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1569 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1570 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1571 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1572 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1573 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1574 volatile unsigned long _argvec[5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1575 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1576 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1577 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1578 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1579 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1580 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1581 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1582 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1583 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1584 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1585 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1586 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1587 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1588 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1589 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1590 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1591 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1592 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1593 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1594 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1595 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1596 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1597 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1598 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1599 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1600 volatile unsigned long _argvec[6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1601 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1602 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1603 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1604 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1605 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1606 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1607 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1608 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1609 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1610 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1611 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1612 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1613 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1614 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1615 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1616 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1617 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1618 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1619 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1620 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1621 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1622 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1623 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1624 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1625 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1626 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1627 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1628 volatile unsigned long _argvec[7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1629 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1630 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1631 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1632 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1633 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1634 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1635 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1636 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1637 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1638 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1639 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1640 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1641 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1642 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1643 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1644 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1645 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1646 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1647 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1648 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1649 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1650 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1651 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1652 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1653 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1654 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1655 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1656 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1657 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1658 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1659 volatile unsigned long _argvec[8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1660 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1661 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1662 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1663 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1664 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1665 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1666 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1667 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1668 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1669 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1670 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1671 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1672 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1673 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1674 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1675 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1676 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1677 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1678 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1679 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1680 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1681 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1682 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1683 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1684 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1685 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1686 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1687 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1688 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1689 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1690 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1691 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1692 volatile unsigned long _argvec[9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1693 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1694 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1695 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1696 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1697 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1698 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1699 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1700 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1701 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1702 _argvec[8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1703 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1704 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1705 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1706 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1707 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1708 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1709 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1710 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1711 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1712 "lwz 10,32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1713 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1714 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1715 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1716 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1717 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1718 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1719 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1720 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1721 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1722 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1723 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1724 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1725 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1726 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1727 volatile unsigned long _argvec[10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1728 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1729 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1730 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1731 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1732 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1733 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1734 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1735 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1736 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1737 _argvec[8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1738 _argvec[9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1739 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1740 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1741 "addi 1,1,-16\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1742 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1743 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1744 "stw 3,8(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1745 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1746 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1747 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1748 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1749 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1750 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1751 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1752 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1753 "lwz 10,32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1754 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1755 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1756 "addi 1,1,16\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1757 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1758 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1759 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1760 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1761 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1762 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1763 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1764 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1765 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1766 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1767 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1768 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1769 volatile unsigned long _argvec[11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1770 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1771 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1772 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1773 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1774 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1775 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1776 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1777 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1778 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1779 _argvec[8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1780 _argvec[9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1781 _argvec[10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1782 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1783 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1784 "addi 1,1,-16\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1785 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1786 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1787 "stw 3,12(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1788 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1789 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1790 "stw 3,8(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1791 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1792 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1793 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1794 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1795 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1796 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1797 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1798 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1799 "lwz 10,32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1800 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1801 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1802 "addi 1,1,16\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1803 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1804 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1805 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1806 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1807 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1808 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1809 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1810 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1811 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1812 arg7,arg8,arg9,arg10,arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1813 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1814 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1815 volatile unsigned long _argvec[12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1816 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1817 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1818 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1819 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1820 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1821 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1822 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1823 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1824 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1825 _argvec[8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1826 _argvec[9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1827 _argvec[10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1828 _argvec[11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1829 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1830 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1831 "addi 1,1,-32\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1832 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1833 "lwz 3,44(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1834 "stw 3,16(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1835 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1836 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1837 "stw 3,12(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1838 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1839 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1840 "stw 3,8(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1841 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1842 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1843 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1844 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1845 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1846 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1847 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1848 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1849 "lwz 10,32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1850 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1851 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1852 "addi 1,1,32\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1853 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1854 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1855 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1856 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1857 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1858 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1859 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1860 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1861 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1862 arg7,arg8,arg9,arg10,arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1863 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1864 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1865 volatile unsigned long _argvec[13]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1866 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1867 _argvec[0] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1868 _argvec[1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1869 _argvec[2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1870 _argvec[3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1871 _argvec[4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1872 _argvec[5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1873 _argvec[6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1874 _argvec[7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1875 _argvec[8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1876 _argvec[9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1877 _argvec[10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1878 _argvec[11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1879 _argvec[12] = (unsigned long)arg12; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1880 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1881 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1882 "addi 1,1,-32\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1883 /* arg12 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1884 "lwz 3,48(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1885 "stw 3,20(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1886 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1887 "lwz 3,44(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1888 "stw 3,16(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1889 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1890 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1891 "stw 3,12(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1892 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1893 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1894 "stw 3,8(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1895 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1896 "lwz 3,4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1897 "lwz 4,8(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1898 "lwz 5,12(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1899 "lwz 6,16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1900 "lwz 7,20(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1901 "lwz 8,24(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1902 "lwz 9,28(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1903 "lwz 10,32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1904 "lwz 11,0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1905 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1906 "addi 1,1,32\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1907 "mr %0,3" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1908 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1909 : /*in*/ "r" (&_argvec[0]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1910 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1911 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1912 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1913 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1914 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1915 #endif /* PLAT_ppc32_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1916 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1917 /* ------------------------ ppc64-linux ------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1918 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1919 #if defined(PLAT_ppc64_linux) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1920 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1921 /* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1922 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1923 /* These regs are trashed by the hidden call. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1924 #define __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1925 "lr", "ctr", "xer", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1926 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1927 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1928 "r11", "r12", "r13" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1929 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1930 /* These CALL_FN_ macros assume that on ppc64-linux, sizeof(unsigned |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1931 long) == 8. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1932 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1933 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1934 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1935 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1936 volatile unsigned long _argvec[3+0]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1937 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1938 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1939 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1940 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1941 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1942 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1943 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1944 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1945 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1946 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1947 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1948 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1949 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1950 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1951 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1952 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1953 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1954 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1955 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1956 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1957 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1958 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1959 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1960 volatile unsigned long _argvec[3+1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1961 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1962 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1963 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1964 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1965 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1966 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1967 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1968 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1969 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1970 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1971 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1972 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1973 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1974 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1975 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1976 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1977 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1978 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1979 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1980 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1981 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1982 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1983 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1984 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1985 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1986 volatile unsigned long _argvec[3+2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1987 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1988 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1989 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1990 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1991 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1992 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1993 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1994 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1995 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1996 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1997 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1998 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
1999 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2000 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2001 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2002 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2003 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2004 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2005 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2006 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2007 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2008 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2009 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2010 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2011 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2012 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2013 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2014 volatile unsigned long _argvec[3+3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2015 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2016 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2017 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2018 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2019 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2020 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2021 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2022 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2023 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2024 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2025 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2026 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2027 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2028 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2029 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2030 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2031 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2032 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2033 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2034 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2035 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2036 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2037 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2038 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2039 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2040 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2041 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2042 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2043 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2044 volatile unsigned long _argvec[3+4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2045 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2046 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2047 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2048 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2049 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2050 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2051 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2052 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2053 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2054 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2055 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2056 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2057 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2058 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2059 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2060 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2061 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2062 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2063 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2064 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2065 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2066 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2067 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2068 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2069 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2070 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2071 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2072 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2073 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2074 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2075 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2076 volatile unsigned long _argvec[3+5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2077 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2078 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2079 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2080 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2081 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2082 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2083 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2084 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2085 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2086 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2087 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2088 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2089 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2090 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2091 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2092 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2093 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2094 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2095 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2096 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2097 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2098 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2099 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2100 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2101 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2102 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2103 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2104 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2105 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2106 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2107 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2108 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2109 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2110 volatile unsigned long _argvec[3+6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2111 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2112 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2113 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2114 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2115 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2116 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2117 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2118 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2119 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2120 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2121 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2122 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2123 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2124 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2125 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2126 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2127 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2128 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2129 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2130 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2131 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2132 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2133 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2134 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2135 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2136 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2137 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2138 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2139 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2140 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2141 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2142 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2143 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2144 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2145 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2146 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2147 volatile unsigned long _argvec[3+7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2148 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2149 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2150 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2151 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2152 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2153 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2154 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2155 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2156 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2157 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2158 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2159 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2160 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2161 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2162 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2163 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2164 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2165 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2166 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2167 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2168 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2169 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2170 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2171 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2172 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2173 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2174 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2175 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2176 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2177 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2178 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2179 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2180 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2181 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2182 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2183 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2184 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2185 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2186 volatile unsigned long _argvec[3+8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2187 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2188 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2189 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2190 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2191 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2192 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2193 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2194 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2195 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2196 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2197 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2198 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2199 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2200 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2201 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2202 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2203 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2204 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2205 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2206 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2207 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2208 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2209 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2210 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2211 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2212 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2213 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2214 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2215 "ld 2,-16(11)" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2216 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2217 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2218 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2219 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2220 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2221 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2222 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2223 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2224 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2225 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2226 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2227 volatile unsigned long _argvec[3+9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2228 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2229 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2230 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2231 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2232 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2233 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2234 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2235 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2236 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2237 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2238 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2239 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2240 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2241 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2242 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2243 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2244 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2245 "addi 1,1,-128\n\t" /* expand stack frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2246 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2247 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2248 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2249 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2250 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2251 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2252 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2253 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2254 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2255 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2256 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2257 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2258 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2259 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2260 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2261 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2262 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2263 "addi 1,1,128" /* restore frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2264 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2265 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2266 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2267 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2268 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2269 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2270 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2271 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2272 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2273 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2274 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2275 volatile unsigned long _argvec[3+10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2276 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2277 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2278 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2279 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2280 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2281 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2282 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2283 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2284 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2285 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2286 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2287 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2288 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2289 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2290 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2291 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2292 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2293 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2294 "addi 1,1,-128\n\t" /* expand stack frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2295 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2296 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2297 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2298 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2299 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2300 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2301 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2302 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2303 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2304 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2305 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2306 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2307 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2308 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2309 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2310 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2311 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2312 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2313 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2314 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2315 "addi 1,1,128" /* restore frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2316 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2317 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2318 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2319 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2320 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2321 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2322 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2323 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2324 arg7,arg8,arg9,arg10,arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2325 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2326 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2327 volatile unsigned long _argvec[3+11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2328 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2329 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2330 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2331 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2332 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2333 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2334 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2335 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2336 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2337 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2338 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2339 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2340 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2341 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2342 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2343 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2344 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2345 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2346 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2347 "addi 1,1,-144\n\t" /* expand stack frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2348 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2349 "ld 3,88(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2350 "std 3,128(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2351 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2352 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2353 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2354 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2355 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2356 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2357 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2358 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2359 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2360 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2361 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2362 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2363 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2364 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2365 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2366 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2367 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2368 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2369 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2370 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2371 "addi 1,1,144" /* restore frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2372 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2373 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2374 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2375 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2376 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2377 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2378 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2379 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2380 arg7,arg8,arg9,arg10,arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2381 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2382 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2383 volatile unsigned long _argvec[3+12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2384 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2385 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2386 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2387 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2388 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2389 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2390 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2391 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2392 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2393 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2394 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2395 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2396 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2397 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2398 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2399 _argvec[2+12] = (unsigned long)arg12; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2400 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2401 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2402 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2403 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2404 "addi 1,1,-144\n\t" /* expand stack frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2405 /* arg12 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2406 "ld 3,96(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2407 "std 3,136(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2408 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2409 "ld 3,88(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2410 "std 3,128(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2411 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2412 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2413 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2414 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2415 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2416 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2417 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2418 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2419 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2420 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2421 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2422 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2423 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2424 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2425 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2426 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2427 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2428 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2429 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2430 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2431 "addi 1,1,144" /* restore frame */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2432 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2433 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2434 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2435 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2436 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2437 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2438 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2439 #endif /* PLAT_ppc64_linux */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2440 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2441 /* ------------------------ ppc32-aix5 ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2442 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2443 #if defined(PLAT_ppc32_aix5) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2444 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2445 /* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2446 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2447 /* These regs are trashed by the hidden call. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2448 #define __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2449 "lr", "ctr", "xer", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2450 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2451 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2452 "r11", "r12", "r13" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2453 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2454 /* Expand the stack frame, copying enough info that unwinding |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2455 still works. Trashes r3. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2456 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2457 #define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2458 "addi 1,1,-" #_n_fr "\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2459 "lwz 3," #_n_fr "(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2460 "stw 3,0(1)\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2461 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2462 #define VG_CONTRACT_FRAME_BY(_n_fr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2463 "addi 1,1," #_n_fr "\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2464 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2465 /* These CALL_FN_ macros assume that on ppc32-aix5, sizeof(unsigned |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2466 long) == 4. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2467 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2468 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2469 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2470 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2471 volatile unsigned long _argvec[3+0]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2472 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2473 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2474 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2475 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2476 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2477 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2478 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2479 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2480 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2481 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2482 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2483 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2484 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2485 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2486 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2487 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2488 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2489 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2490 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2491 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2492 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2493 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2494 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2495 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2496 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2497 volatile unsigned long _argvec[3+1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2498 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2499 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2500 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2501 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2502 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2503 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2504 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2505 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2506 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2507 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2508 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2509 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2510 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2511 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2512 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2513 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2514 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2515 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2516 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2517 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2518 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2519 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2520 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2521 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2522 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2523 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2524 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2525 volatile unsigned long _argvec[3+2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2526 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2527 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2528 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2529 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2530 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2531 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2532 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2533 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2534 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2535 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2536 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2537 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2538 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2539 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2540 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2541 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2542 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2543 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2544 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2545 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2546 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2547 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2548 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2549 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2550 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2551 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2552 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2553 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2554 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2555 volatile unsigned long _argvec[3+3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2556 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2557 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2558 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2559 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2560 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2561 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2562 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2563 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2564 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2565 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2566 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2567 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2568 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2569 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2570 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2571 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2572 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2573 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2574 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2575 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2576 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2577 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2578 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2579 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2580 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2581 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2582 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2583 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2584 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2585 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2586 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2587 volatile unsigned long _argvec[3+4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2588 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2589 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2590 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2591 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2592 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2593 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2594 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2595 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2596 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2597 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2598 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2599 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2600 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2601 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2602 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2603 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2604 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2605 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2606 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2607 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2608 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2609 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2610 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2611 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2612 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2613 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2614 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2615 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2616 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2617 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2618 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2619 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2620 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2621 volatile unsigned long _argvec[3+5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2622 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2623 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2624 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2625 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2626 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2627 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2628 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2629 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2630 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2631 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2632 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2633 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2634 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2635 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2636 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2637 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2638 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2639 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2640 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2641 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2642 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2643 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2644 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2645 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2646 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2647 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2648 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2649 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2650 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2651 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2652 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2653 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2654 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2655 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2656 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2657 volatile unsigned long _argvec[3+6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2658 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2659 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2660 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2661 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2662 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2663 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2664 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2665 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2666 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2667 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2668 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2669 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2670 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2671 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2672 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2673 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2674 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2675 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2676 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2677 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2678 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2679 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2680 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2681 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2682 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2683 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2684 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2685 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2686 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2687 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2688 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2689 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2690 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2691 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2692 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2693 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2694 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2695 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2696 volatile unsigned long _argvec[3+7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2697 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2698 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2699 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2700 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2701 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2702 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2703 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2704 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2705 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2706 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2707 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2708 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2709 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2710 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2711 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2712 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2713 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2714 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2715 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2716 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2717 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2718 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2719 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2720 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2721 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2722 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2723 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2724 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2725 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2726 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2727 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2728 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2729 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2730 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2731 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2732 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2733 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2734 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2735 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2736 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2737 volatile unsigned long _argvec[3+8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2738 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2739 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2740 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2741 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2742 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2743 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2744 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2745 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2746 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2747 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2748 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2749 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2750 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2751 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2752 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2753 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2754 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2755 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2756 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2757 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2758 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2759 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2760 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2761 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2762 "lwz 10, 32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2763 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2764 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2765 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2766 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2767 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2768 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2769 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2770 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2771 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2772 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2773 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2774 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2775 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2776 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2777 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2778 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2779 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2780 volatile unsigned long _argvec[3+9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2781 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2782 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2783 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2784 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2785 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2786 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2787 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2788 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2789 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2790 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2791 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2792 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2793 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2794 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2795 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2796 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2797 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2798 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2799 VG_EXPAND_FRAME_BY_trashes_r3(64) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2800 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2801 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2802 "stw 3,56(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2803 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2804 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2805 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2806 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2807 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2808 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2809 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2810 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2811 "lwz 10, 32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2812 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2813 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2814 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2815 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2816 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2817 VG_CONTRACT_FRAME_BY(64) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2818 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2819 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2820 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2821 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2822 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2823 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2824 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2825 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2826 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2827 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2828 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2829 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2830 volatile unsigned long _argvec[3+10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2831 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2832 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2833 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2834 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2835 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2836 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2837 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2838 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2839 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2840 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2841 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2842 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2843 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2844 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2845 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2846 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2847 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2848 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2849 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2850 VG_EXPAND_FRAME_BY_trashes_r3(64) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2851 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2852 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2853 "stw 3,60(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2854 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2855 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2856 "stw 3,56(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2857 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2858 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2859 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2860 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2861 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2862 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2863 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2864 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2865 "lwz 10, 32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2866 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2867 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2868 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2869 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2870 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2871 VG_CONTRACT_FRAME_BY(64) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2872 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2873 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2874 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2875 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2876 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2877 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2878 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2879 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2880 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2881 arg7,arg8,arg9,arg10,arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2882 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2883 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2884 volatile unsigned long _argvec[3+11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2885 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2886 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2887 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2888 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2889 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2890 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2891 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2892 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2893 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2894 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2895 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2896 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2897 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2898 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2899 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2900 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2901 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2902 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2903 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2904 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2905 VG_EXPAND_FRAME_BY_trashes_r3(72) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2906 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2907 "lwz 3,44(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2908 "stw 3,64(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2909 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2910 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2911 "stw 3,60(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2912 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2913 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2914 "stw 3,56(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2915 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2916 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2917 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2918 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2919 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2920 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2921 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2922 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2923 "lwz 10, 32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2924 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2925 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2926 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2927 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2928 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2929 VG_CONTRACT_FRAME_BY(72) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2930 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2931 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2932 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2933 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2934 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2935 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2936 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2937 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2938 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2939 arg7,arg8,arg9,arg10,arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2940 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2941 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2942 volatile unsigned long _argvec[3+12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2943 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2944 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2945 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2946 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2947 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2948 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2949 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2950 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2951 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2952 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2953 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2954 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2955 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2956 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2957 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2958 _argvec[2+12] = (unsigned long)arg12; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2959 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2960 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2961 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2962 "stw 2,-8(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2963 "lwz 2,-4(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2964 VG_EXPAND_FRAME_BY_trashes_r3(72) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2965 /* arg12 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2966 "lwz 3,48(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2967 "stw 3,68(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2968 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2969 "lwz 3,44(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2970 "stw 3,64(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2971 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2972 "lwz 3,40(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2973 "stw 3,60(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2974 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2975 "lwz 3,36(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2976 "stw 3,56(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2977 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2978 "lwz 3, 4(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2979 "lwz 4, 8(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2980 "lwz 5, 12(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2981 "lwz 6, 16(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2982 "lwz 7, 20(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2983 "lwz 8, 24(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2984 "lwz 9, 28(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2985 "lwz 10, 32(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2986 "lwz 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2987 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2988 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2989 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2990 "lwz 2,-8(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2991 VG_CONTRACT_FRAME_BY(72) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2992 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2993 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2994 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2995 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2996 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2997 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2998 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2999 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3000 #endif /* PLAT_ppc32_aix5 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3001 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3002 /* ------------------------ ppc64-aix5 ------------------------- */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3003 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3004 #if defined(PLAT_ppc64_aix5) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3005 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3006 /* ARGREGS: r3 r4 r5 r6 r7 r8 r9 r10 (the rest on stack somewhere) */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3007 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3008 /* These regs are trashed by the hidden call. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3009 #define __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3010 "lr", "ctr", "xer", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3011 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3012 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3013 "r11", "r12", "r13" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3014 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3015 /* Expand the stack frame, copying enough info that unwinding |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3016 still works. Trashes r3. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3017 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3018 #define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3019 "addi 1,1,-" #_n_fr "\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3020 "ld 3," #_n_fr "(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3021 "std 3,0(1)\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3022 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3023 #define VG_CONTRACT_FRAME_BY(_n_fr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3024 "addi 1,1," #_n_fr "\n\t" |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3025 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3026 /* These CALL_FN_ macros assume that on ppc64-aix5, sizeof(unsigned |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3027 long) == 8. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3028 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3029 #define CALL_FN_W_v(lval, orig) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3030 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3031 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3032 volatile unsigned long _argvec[3+0]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3033 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3034 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3035 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3036 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3037 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3038 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3039 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3040 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3041 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3042 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3043 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3044 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3045 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3046 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3047 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3048 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3049 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3050 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3051 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3052 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3053 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3054 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3055 #define CALL_FN_W_W(lval, orig, arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3056 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3057 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3058 volatile unsigned long _argvec[3+1]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3059 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3060 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3061 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3062 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3063 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3064 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3065 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3066 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3067 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3068 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3069 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3070 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3071 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3072 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3073 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3074 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3075 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3076 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3077 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3078 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3079 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3080 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3081 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3082 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3083 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3084 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3085 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3086 volatile unsigned long _argvec[3+2]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3087 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3088 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3089 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3090 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3091 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3092 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3093 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3094 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3095 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3096 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3097 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3098 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3099 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3100 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3101 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3102 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3103 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3104 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3105 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3106 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3107 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3108 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3109 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3110 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3111 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3112 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3113 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3114 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3115 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3116 volatile unsigned long _argvec[3+3]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3117 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3118 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3119 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3120 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3121 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3122 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3123 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3124 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3125 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3126 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3127 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3128 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3129 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3130 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3131 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3132 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3133 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3134 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3135 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3136 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3137 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3138 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3139 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3140 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3141 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3142 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3143 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3144 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3145 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3146 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3147 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3148 volatile unsigned long _argvec[3+4]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3149 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3150 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3151 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3152 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3153 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3154 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3155 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3156 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3157 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3158 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3159 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3160 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3161 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3162 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3163 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3164 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3165 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3166 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3167 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3168 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3169 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3170 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3171 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3172 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3173 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3174 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3175 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3176 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3177 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3178 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3179 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3180 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3181 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3182 volatile unsigned long _argvec[3+5]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3183 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3184 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3185 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3186 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3187 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3188 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3189 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3190 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3191 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3192 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3193 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3194 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3195 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3196 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3197 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3198 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3199 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3200 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3201 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3202 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3203 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3204 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3205 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3206 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3207 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3208 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3209 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3210 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3211 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3212 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3213 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3214 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3215 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3216 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3217 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3218 volatile unsigned long _argvec[3+6]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3219 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3220 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3221 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3222 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3223 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3224 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3225 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3226 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3227 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3228 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3229 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3230 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3231 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3232 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3233 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3234 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3235 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3236 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3237 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3238 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3239 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3240 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3241 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3242 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3243 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3244 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3245 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3246 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3247 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3248 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3249 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3250 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3251 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3252 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3253 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3254 arg7) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3255 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3256 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3257 volatile unsigned long _argvec[3+7]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3258 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3259 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3260 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3261 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3262 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3263 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3264 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3265 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3266 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3267 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3268 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3269 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3270 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3271 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3272 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3273 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3274 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3275 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3276 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3277 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3278 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3279 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3280 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3281 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3282 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3283 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3284 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3285 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3286 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3287 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3288 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3289 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3290 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3291 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3292 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3293 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3294 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3295 arg7,arg8) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3296 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3297 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3298 volatile unsigned long _argvec[3+8]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3299 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3300 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3301 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3302 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3303 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3304 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3305 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3306 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3307 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3308 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3309 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3310 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3311 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3312 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3313 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3314 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3315 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3316 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3317 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3318 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3319 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3320 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3321 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3322 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3323 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3324 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3325 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3326 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3327 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3328 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3329 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3330 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3331 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3332 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3333 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3334 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3335 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3336 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3337 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3338 arg7,arg8,arg9) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3339 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3340 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3341 volatile unsigned long _argvec[3+9]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3342 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3343 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3344 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3345 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3346 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3347 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3348 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3349 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3350 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3351 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3352 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3353 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3354 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3355 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3356 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3357 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3358 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3359 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3360 VG_EXPAND_FRAME_BY_trashes_r3(128) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3361 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3362 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3363 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3364 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3365 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3366 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3367 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3368 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3369 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3370 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3371 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3372 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3373 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3374 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3375 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3376 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3377 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3378 VG_CONTRACT_FRAME_BY(128) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3379 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3380 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3381 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3382 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3383 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3384 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3385 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3386 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3387 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3388 arg7,arg8,arg9,arg10) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3389 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3390 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3391 volatile unsigned long _argvec[3+10]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3392 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3393 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3394 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3395 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3396 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3397 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3398 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3399 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3400 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3401 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3402 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3403 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3404 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3405 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3406 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3407 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3408 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3409 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3410 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3411 VG_EXPAND_FRAME_BY_trashes_r3(128) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3412 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3413 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3414 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3415 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3416 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3417 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3418 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3419 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3420 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3421 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3422 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3423 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3424 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3425 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3426 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3427 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3428 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3429 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3430 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3431 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3432 VG_CONTRACT_FRAME_BY(128) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3433 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3434 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3435 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3436 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3437 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3438 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3439 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3440 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3441 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3442 arg7,arg8,arg9,arg10,arg11) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3443 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3444 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3445 volatile unsigned long _argvec[3+11]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3446 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3447 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3448 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3449 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3450 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3451 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3452 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3453 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3454 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3455 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3456 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3457 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3458 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3459 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3460 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3461 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3462 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3463 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3464 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3465 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3466 VG_EXPAND_FRAME_BY_trashes_r3(144) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3467 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3468 "ld 3,88(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3469 "std 3,128(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3470 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3471 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3472 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3473 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3474 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3475 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3476 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3477 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3478 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3479 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3480 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3481 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3482 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3483 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3484 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3485 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3486 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3487 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3488 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3489 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3490 VG_CONTRACT_FRAME_BY(144) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3491 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3492 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3493 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3494 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3495 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3496 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3497 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3498 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3499 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3500 arg7,arg8,arg9,arg10,arg11,arg12) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3501 do { \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3502 volatile OrigFn _orig = (orig); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3503 volatile unsigned long _argvec[3+12]; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3504 volatile unsigned long _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3505 /* _argvec[0] holds current r2 across the call */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3506 _argvec[1] = (unsigned long)_orig.r2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3507 _argvec[2] = (unsigned long)_orig.nraddr; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3508 _argvec[2+1] = (unsigned long)arg1; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3509 _argvec[2+2] = (unsigned long)arg2; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3510 _argvec[2+3] = (unsigned long)arg3; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3511 _argvec[2+4] = (unsigned long)arg4; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3512 _argvec[2+5] = (unsigned long)arg5; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3513 _argvec[2+6] = (unsigned long)arg6; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3514 _argvec[2+7] = (unsigned long)arg7; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3515 _argvec[2+8] = (unsigned long)arg8; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3516 _argvec[2+9] = (unsigned long)arg9; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3517 _argvec[2+10] = (unsigned long)arg10; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3518 _argvec[2+11] = (unsigned long)arg11; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3519 _argvec[2+12] = (unsigned long)arg12; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3520 __asm__ volatile( \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3521 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3522 VG_EXPAND_FRAME_BY_trashes_r3(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3523 "std 2,-16(11)\n\t" /* save tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3524 "ld 2,-8(11)\n\t" /* use nraddr's tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3525 VG_EXPAND_FRAME_BY_trashes_r3(144) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3526 /* arg12 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3527 "ld 3,96(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3528 "std 3,136(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3529 /* arg11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3530 "ld 3,88(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3531 "std 3,128(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3532 /* arg10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3533 "ld 3,80(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3534 "std 3,120(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3535 /* arg9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3536 "ld 3,72(11)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3537 "std 3,112(1)\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3538 /* args1-8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3539 "ld 3, 8(11)\n\t" /* arg1->r3 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3540 "ld 4, 16(11)\n\t" /* arg2->r4 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3541 "ld 5, 24(11)\n\t" /* arg3->r5 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3542 "ld 6, 32(11)\n\t" /* arg4->r6 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3543 "ld 7, 40(11)\n\t" /* arg5->r7 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3544 "ld 8, 48(11)\n\t" /* arg6->r8 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3545 "ld 9, 56(11)\n\t" /* arg7->r9 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3546 "ld 10, 64(11)\n\t" /* arg8->r10 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3547 "ld 11, 0(11)\n\t" /* target->r11 */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3548 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3549 "mr 11,%1\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3550 "mr %0,3\n\t" \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3551 "ld 2,-16(11)\n\t" /* restore tocptr */ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3552 VG_CONTRACT_FRAME_BY(144) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3553 VG_CONTRACT_FRAME_BY(512) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3554 : /*out*/ "=r" (_res) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3555 : /*in*/ "r" (&_argvec[2]) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3556 : /*trash*/ "cc", "memory", __CALLER_SAVED_REGS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3557 ); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3558 lval = (__typeof__(lval)) _res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3559 } while (0) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3560 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3561 #endif /* PLAT_ppc64_aix5 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3562 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3563 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3564 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3565 /* ARCHITECTURE INDEPENDENT MACROS for CLIENT REQUESTS. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3566 /* */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3567 /* ------------------------------------------------------------------ */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3568 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3569 /* Some request codes. There are many more of these, but most are not |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3570 exposed to end-user view. These are the public ones, all of the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3571 form 0x1000 + small_number. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3572 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3573 Core ones are in the range 0x00000000--0x0000ffff. The non-public |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3574 ones start at 0x2000. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3575 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3576 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3577 /* These macros are used by tools -- they must be public, but don't |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3578 embed them into other programs. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3579 #define VG_USERREQ_TOOL_BASE(a,b) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3580 ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16)) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3581 #define VG_IS_TOOL_USERREQ(a, b, v) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3582 (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000)) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3583 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3584 /* !! ABIWARNING !! ABIWARNING !! ABIWARNING !! ABIWARNING !! |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3585 This enum comprises an ABI exported by Valgrind to programs |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3586 which use client requests. DO NOT CHANGE THE ORDER OF THESE |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3587 ENTRIES, NOR DELETE ANY -- add new ones at the end. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3588 typedef |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3589 enum { VG_USERREQ__RUNNING_ON_VALGRIND = 0x1001, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3590 VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3591 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3592 /* These allow any function to be called from the simulated |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3593 CPU but run on the real CPU. Nb: the first arg passed to |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3594 the function is always the ThreadId of the running |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3595 thread! So CLIENT_CALL0 actually requires a 1 arg |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3596 function, etc. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3597 VG_USERREQ__CLIENT_CALL0 = 0x1101, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3598 VG_USERREQ__CLIENT_CALL1 = 0x1102, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3599 VG_USERREQ__CLIENT_CALL2 = 0x1103, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3600 VG_USERREQ__CLIENT_CALL3 = 0x1104, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3601 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3602 /* Can be useful in regression testing suites -- eg. can |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3603 send Valgrind's output to /dev/null and still count |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3604 errors. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3605 VG_USERREQ__COUNT_ERRORS = 0x1201, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3606 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3607 /* These are useful and can be interpreted by any tool that |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3608 tracks malloc() et al, by using vg_replace_malloc.c. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3609 VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3610 VG_USERREQ__FREELIKE_BLOCK = 0x1302, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3611 /* Memory pool support. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3612 VG_USERREQ__CREATE_MEMPOOL = 0x1303, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3613 VG_USERREQ__DESTROY_MEMPOOL = 0x1304, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3614 VG_USERREQ__MEMPOOL_ALLOC = 0x1305, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3615 VG_USERREQ__MEMPOOL_FREE = 0x1306, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3616 VG_USERREQ__MEMPOOL_TRIM = 0x1307, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3617 VG_USERREQ__MOVE_MEMPOOL = 0x1308, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3618 VG_USERREQ__MEMPOOL_CHANGE = 0x1309, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3619 VG_USERREQ__MEMPOOL_EXISTS = 0x130a, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3620 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3621 /* Allow printfs to valgrind log. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3622 VG_USERREQ__PRINTF = 0x1401, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3623 VG_USERREQ__PRINTF_BACKTRACE = 0x1402, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3624 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3625 /* Stack support. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3626 VG_USERREQ__STACK_REGISTER = 0x1501, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3627 VG_USERREQ__STACK_DEREGISTER = 0x1502, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3628 VG_USERREQ__STACK_CHANGE = 0x1503 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3629 } Vg_ClientRequest; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3630 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3631 #if !defined(__GNUC__) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3632 # define __extension__ /* */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3633 #endif |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3634 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3635 /* Returns the number of Valgrinds this code is running under. That |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3636 is, 0 if running natively, 1 if running under Valgrind, 2 if |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3637 running under Valgrind which is running under another Valgrind, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3638 etc. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3639 #define RUNNING_ON_VALGRIND __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3640 ({unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3641 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 /* if not */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3642 VG_USERREQ__RUNNING_ON_VALGRIND, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3643 0, 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3644 _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3645 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3646 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3647 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3648 /* Discard translation of code in the range [_qzz_addr .. _qzz_addr + |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3649 _qzz_len - 1]. Useful if you are debugging a JITter or some such, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3650 since it provides a way to make sure valgrind will retranslate the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3651 invalidated area. Returns no value. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3652 #define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3653 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3654 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3655 VG_USERREQ__DISCARD_TRANSLATIONS, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3656 _qzz_addr, _qzz_len, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3657 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3658 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3659 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3660 /* These requests are for getting Valgrind itself to print something. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3661 Possibly with a backtrace. This is a really ugly hack. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3662 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3663 #if defined(NVALGRIND) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3664 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3665 # define VALGRIND_PRINTF(...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3666 # define VALGRIND_PRINTF_BACKTRACE(...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3667 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3668 #else /* NVALGRIND */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3669 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3670 /* Modern GCC will optimize the static routine out if unused, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3671 and unused attribute will shut down warnings about it. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3672 static int VALGRIND_PRINTF(const char *format, ...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3673 __attribute__((format(__printf__, 1, 2), __unused__)); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3674 static int |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3675 VALGRIND_PRINTF(const char *format, ...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3676 { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3677 unsigned long _qzz_res; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3678 va_list vargs; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3679 va_start(vargs, format); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3680 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3681 (unsigned long)format, (unsigned long)vargs, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3682 0, 0, 0); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3683 va_end(vargs); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3684 return (int)_qzz_res; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3685 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3686 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3687 static int VALGRIND_PRINTF_BACKTRACE(const char *format, ...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3688 __attribute__((format(__printf__, 1, 2), __unused__)); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3689 static int |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3690 VALGRIND_PRINTF_BACKTRACE(const char *format, ...) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3691 { |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3692 unsigned long _qzz_res; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3693 va_list vargs; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3694 va_start(vargs, format); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3695 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3696 (unsigned long)format, (unsigned long)vargs, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3697 0, 0, 0); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3698 va_end(vargs); |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3699 return (int)_qzz_res; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3700 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3701 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3702 #endif /* NVALGRIND */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3703 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3704 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3705 /* These requests allow control to move from the simulated CPU to the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3706 real CPU, calling an arbitary function. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3707 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3708 Note that the current ThreadId is inserted as the first argument. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3709 So this call: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3710 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3711 VALGRIND_NON_SIMD_CALL2(f, arg1, arg2) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3712 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3713 requires f to have this signature: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3714 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3715 Word f(Word tid, Word arg1, Word arg2) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3716 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3717 where "Word" is a word-sized type. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3718 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3719 Note that these client requests are not entirely reliable. For example, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3720 if you call a function with them that subsequently calls printf(), |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3721 there's a high chance Valgrind will crash. Generally, your prospects of |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3722 these working are made higher if the called function does not refer to |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3723 any global variables, and does not refer to any libc or other functions |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3724 (printf et al). Any kind of entanglement with libc or dynamic linking is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3725 likely to have a bad outcome, for tricky reasons which we've grappled |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3726 with a lot in the past. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3727 */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3728 #define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3729 __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3730 ({unsigned long _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3731 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3732 VG_USERREQ__CLIENT_CALL0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3733 _qyy_fn, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3734 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3735 _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3736 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3737 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3738 #define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3739 __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3740 ({unsigned long _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3741 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3742 VG_USERREQ__CLIENT_CALL1, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3743 _qyy_fn, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3744 _qyy_arg1, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3745 _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3746 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3747 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3748 #define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3749 __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3750 ({unsigned long _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3751 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3752 VG_USERREQ__CLIENT_CALL2, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3753 _qyy_fn, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3754 _qyy_arg1, _qyy_arg2, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3755 _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3756 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3757 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3758 #define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3759 __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3760 ({unsigned long _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3761 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3762 VG_USERREQ__CLIENT_CALL3, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3763 _qyy_fn, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3764 _qyy_arg1, _qyy_arg2, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3765 _qyy_arg3, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3766 _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3767 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3768 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3769 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3770 /* Counts the number of errors that have been recorded by a tool. Nb: |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3771 the tool must record the errors with VG_(maybe_record_error)() or |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3772 VG_(unique_error)() for them to be counted. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3773 #define VALGRIND_COUNT_ERRORS \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3774 __extension__ \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3775 ({unsigned int _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3776 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 /* default return */, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3777 VG_USERREQ__COUNT_ERRORS, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3778 0, 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3779 _qyy_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3780 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3781 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3782 /* Mark a block of memory as having been allocated by a malloc()-like |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3783 function. `addr' is the start of the usable block (ie. after any |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3784 redzone) `rzB' is redzone size if the allocator can apply redzones; |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3785 use '0' if not. Adding redzones makes it more likely Valgrind will spot |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3786 block overruns. `is_zeroed' indicates if the memory is zeroed, as it is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3787 for calloc(). Put it immediately after the point where a block is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3788 allocated. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3789 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3790 If you're using Memcheck: If you're allocating memory via superblocks, |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3791 and then handing out small chunks of each superblock, if you don't have |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3792 redzones on your small blocks, it's worth marking the superblock with |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3793 VALGRIND_MAKE_MEM_NOACCESS when it's created, so that block overruns are |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3794 detected. But if you can put redzones on, it's probably better to not do |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3795 this, so that messages for small overruns are described in terms of the |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3796 small block rather than the superblock (but if you have a big overrun |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3797 that skips over a redzone, you could miss an error this way). See |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3798 memcheck/tests/custom_alloc.c for an example. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3799 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3800 WARNING: if your allocator uses malloc() or 'new' to allocate |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3801 superblocks, rather than mmap() or brk(), this will not work properly -- |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3802 you'll likely get assertion failures during leak detection. This is |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3803 because Valgrind doesn't like seeing overlapping heap blocks. Sorry. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3804 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3805 Nb: block must be freed via a free()-like function specified |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3806 with VALGRIND_FREELIKE_BLOCK or mismatch errors will occur. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3807 #define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3808 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3809 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3810 VG_USERREQ__MALLOCLIKE_BLOCK, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3811 addr, sizeB, rzB, is_zeroed, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3812 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3813 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3814 /* Mark a block of memory as having been freed by a free()-like function. |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3815 `rzB' is redzone size; it must match that given to |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3816 VALGRIND_MALLOCLIKE_BLOCK. Memory not freed will be detected by the leak |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3817 checker. Put it immediately after the point where the block is freed. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3818 #define VALGRIND_FREELIKE_BLOCK(addr, rzB) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3819 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3820 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3821 VG_USERREQ__FREELIKE_BLOCK, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3822 addr, rzB, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3823 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3824 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3825 /* Create a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3826 #define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3827 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3828 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3829 VG_USERREQ__CREATE_MEMPOOL, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3830 pool, rzB, is_zeroed, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3831 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3832 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3833 /* Destroy a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3834 #define VALGRIND_DESTROY_MEMPOOL(pool) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3835 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3836 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3837 VG_USERREQ__DESTROY_MEMPOOL, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3838 pool, 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3839 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3840 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3841 /* Associate a piece of memory with a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3842 #define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3843 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3844 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3845 VG_USERREQ__MEMPOOL_ALLOC, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3846 pool, addr, size, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3847 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3848 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3849 /* Disassociate a piece of memory from a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3850 #define VALGRIND_MEMPOOL_FREE(pool, addr) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3851 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3852 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3853 VG_USERREQ__MEMPOOL_FREE, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3854 pool, addr, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3855 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3856 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3857 /* Disassociate any pieces outside a particular range. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3858 #define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3859 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3860 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3861 VG_USERREQ__MEMPOOL_TRIM, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3862 pool, addr, size, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3863 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3864 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3865 /* Resize and/or move a piece associated with a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3866 #define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3867 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3868 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3869 VG_USERREQ__MOVE_MEMPOOL, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3870 poolA, poolB, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3871 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3872 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3873 /* Resize and/or move a piece associated with a memory pool. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3874 #define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3875 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3876 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3877 VG_USERREQ__MEMPOOL_CHANGE, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3878 pool, addrA, addrB, size, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3879 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3880 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3881 /* Return 1 if a mempool exists, else 0. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3882 #define VALGRIND_MEMPOOL_EXISTS(pool) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3883 ({unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3884 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3885 VG_USERREQ__MEMPOOL_EXISTS, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3886 pool, 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3887 _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3888 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3889 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3890 /* Mark a piece of memory as being a stack. Returns a stack id. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3891 #define VALGRIND_STACK_REGISTER(start, end) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3892 ({unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3893 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3894 VG_USERREQ__STACK_REGISTER, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3895 start, end, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3896 _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3897 }) |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3898 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3899 /* Unmark the piece of memory associated with a stack id as being a |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3900 stack. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3901 #define VALGRIND_STACK_DEREGISTER(id) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3902 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3903 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3904 VG_USERREQ__STACK_DEREGISTER, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3905 id, 0, 0, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3906 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3907 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3908 /* Change the start and end address of the stack id. */ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3909 #define VALGRIND_STACK_CHANGE(id, start, end) \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3910 {unsigned int _qzz_res; \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3911 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3912 VG_USERREQ__STACK_CHANGE, \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3913 id, start, end, 0, 0); \ |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3914 } |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3915 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3916 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3917 #undef PLAT_x86_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3918 #undef PLAT_amd64_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3919 #undef PLAT_ppc32_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3920 #undef PLAT_ppc64_linux |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3921 #undef PLAT_ppc32_aix5 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3922 #undef PLAT_ppc64_aix5 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3923 |
c1314a6cefcf
Automatically detect if running under valgrind and don't close plugin
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3924 #endif /* __VALGRIND_H */ |