47#define __VALGRIND_MAJOR__ 3
48#define __VALGRIND_MINOR__ 14
68#undef PLAT_amd64_darwin
70#undef PLAT_amd64_win64
72#undef PLAT_amd64_linux
73#undef PLAT_ppc32_linux
74#undef PLAT_ppc64be_linux
75#undef PLAT_ppc64le_linux
77#undef PLAT_arm64_linux
78#undef PLAT_s390x_linux
79#undef PLAT_mips32_linux
80#undef PLAT_mips64_linux
81#undef PLAT_x86_solaris
82#undef PLAT_amd64_solaris
85#if defined(__APPLE__) && defined(__i386__)
86# define PLAT_x86_darwin 1
87#elif defined(__APPLE__) && defined(__x86_64__)
88# define PLAT_amd64_darwin 1
89#elif (defined(__MINGW32__) && !defined(__MINGW64__)) \
90 || defined(__CYGWIN32__) \
91 || (defined(_WIN32) && defined(_M_IX86))
92# define PLAT_x86_win32 1
93#elif defined(__MINGW64__) \
94 || (defined(_WIN64) && defined(_M_X64))
95# define PLAT_amd64_win64 1
96#elif defined(__linux__) && defined(__i386__)
97# define PLAT_x86_linux 1
98#elif defined(__linux__) && defined(__x86_64__) && !defined(__ILP32__)
99# define PLAT_amd64_linux 1
100#elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
101# define PLAT_ppc32_linux 1
102#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && _CALL_ELF != 2
104# define PLAT_ppc64be_linux 1
105#elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__) && _CALL_ELF == 2
107# define PLAT_ppc64le_linux 1
108#elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
109# define PLAT_arm_linux 1
110#elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
111# define PLAT_arm64_linux 1
112#elif defined(__linux__) && defined(__s390__) && defined(__s390x__)
113# define PLAT_s390x_linux 1
114#elif defined(__linux__) && defined(__mips__) && (__mips==64)
115# define PLAT_mips64_linux 1
116#elif defined(__linux__) && defined(__mips__) && (__mips!=64)
117# define PLAT_mips32_linux 1
118#elif defined(__sun) && defined(__i386__)
119# define PLAT_x86_solaris 1
120#elif defined(__sun) && defined(__x86_64__)
121# define PLAT_amd64_solaris 1
125# if !defined(NVALGRIND)
149#define VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default, \
150 _zzq_request, _zzq_arg1, _zzq_arg2, \
151 _zzq_arg3, _zzq_arg4, _zzq_arg5) \
152 do { (_zzq_rlval) = VALGRIND_DO_CLIENT_REQUEST_EXPR((_zzq_default), \
153 (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
154 (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
156#define VALGRIND_DO_CLIENT_REQUEST_STMT(_zzq_request, _zzq_arg1, \
157 _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
158 do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
159 (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
160 (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
162#if defined(NVALGRIND)
167#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
168 _zzq_default, _zzq_request, \
169 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
211#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
212 || (defined(PLAT_x86_win32) && defined(__GNUC__)) \
213 || defined(PLAT_x86_solaris)
221#define __SPECIAL_INSTRUCTION_PREAMBLE \
222 "roll $3, %%edi ; roll $13, %%edi\n\t" \
223 "roll $29, %%edi ; roll $19, %%edi\n\t"
225#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
226 _zzq_default, _zzq_request, \
227 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
229 ({volatile unsigned int _zzq_args[6]; \
230 volatile unsigned int _zzq_result; \
231 _zzq_args[0] = (unsigned int)(_zzq_request); \
232 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
233 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
234 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
235 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
236 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
237 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
239 "xchgl %%ebx,%%ebx" \
240 : "=d" (_zzq_result) \
241 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
247#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
248 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
249 volatile unsigned int __addr; \
250 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
252 "xchgl %%ecx,%%ecx" \
257 _zzq_orig->nraddr = __addr; \
260#define VALGRIND_CALL_NOREDIR_EAX \
261 __SPECIAL_INSTRUCTION_PREAMBLE \
263 "xchgl %%edx,%%edx\n\t"
265#define VALGRIND_VEX_INJECT_IR() \
267 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
268 "xchgl %%edi,%%edi\n\t" \
269 : : : "cc", "memory" \
278#if defined(PLAT_x86_win32) && !defined(__GNUC__)
288#define __SPECIAL_INSTRUCTION_PREAMBLE \
289 __asm rol edi, 3 __asm rol edi, 13 \
290 __asm rol edi, 29 __asm rol edi, 19
292#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
293 _zzq_default, _zzq_request, \
294 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
295 valgrind_do_client_request_expr((uintptr_t)(_zzq_default), \
296 (uintptr_t)(_zzq_request), (uintptr_t)(_zzq_arg1), \
297 (uintptr_t)(_zzq_arg2), (uintptr_t)(_zzq_arg3), \
298 (uintptr_t)(_zzq_arg4), (uintptr_t)(_zzq_arg5))
300static __inline uintptr_t
301valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
302 uintptr_t _zzq_arg1, uintptr_t _zzq_arg2,
303 uintptr_t _zzq_arg3, uintptr_t _zzq_arg4,
306 volatile uintptr_t _zzq_args[6];
307 volatile unsigned int _zzq_result;
308 _zzq_args[0] = (uintptr_t)(_zzq_request);
309 _zzq_args[1] = (uintptr_t)(_zzq_arg1);
310 _zzq_args[2] = (uintptr_t)(_zzq_arg2);
311 _zzq_args[3] = (uintptr_t)(_zzq_arg3);
312 _zzq_args[4] = (uintptr_t)(_zzq_arg4);
313 _zzq_args[5] = (uintptr_t)(_zzq_arg5);
314 __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default
315 __SPECIAL_INSTRUCTION_PREAMBLE
318 __asm mov _zzq_result, edx
323#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
324 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
325 volatile unsigned int __addr; \
326 __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
329 __asm mov __addr, eax \
331 _zzq_orig->nraddr = __addr; \
334#define VALGRIND_CALL_NOREDIR_EAX ERROR
336#define VALGRIND_VEX_INJECT_IR() \
338 __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
344#error Unsupported compiler.
351#if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin) \
352 || defined(PLAT_amd64_solaris) \
353 || (defined(PLAT_amd64_win64) && defined(__GNUC__))
357 unsigned long int nraddr;
361#define __SPECIAL_INSTRUCTION_PREAMBLE \
362 "rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \
363 "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
365#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
366 _zzq_default, _zzq_request, \
367 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
369 ({ volatile unsigned long int _zzq_args[6]; \
370 volatile unsigned long int _zzq_result; \
371 _zzq_args[0] = (unsigned long int)(_zzq_request); \
372 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
373 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
374 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
375 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
376 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
377 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
379 "xchgq %%rbx,%%rbx" \
380 : "=d" (_zzq_result) \
381 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
387#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
388 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
389 volatile unsigned long int __addr; \
390 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
392 "xchgq %%rcx,%%rcx" \
397 _zzq_orig->nraddr = __addr; \
400#define VALGRIND_CALL_NOREDIR_RAX \
401 __SPECIAL_INSTRUCTION_PREAMBLE \
403 "xchgq %%rdx,%%rdx\n\t"
405#define VALGRIND_VEX_INJECT_IR() \
407 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
408 "xchgq %%rdi,%%rdi\n\t" \
409 : : : "cc", "memory" \
417#if defined(PLAT_amd64_win64) && !defined(__GNUC__)
419#error Unsupported compiler.
425#if defined(PLAT_ppc32_linux)
433#define __SPECIAL_INSTRUCTION_PREAMBLE \
434 "rlwinm 0,0,3,0,31 ; rlwinm 0,0,13,0,31\n\t" \
435 "rlwinm 0,0,29,0,31 ; rlwinm 0,0,19,0,31\n\t"
437#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
438 _zzq_default, _zzq_request, \
439 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
442 ({ unsigned int _zzq_args[6]; \
443 unsigned int _zzq_result; \
444 unsigned int* _zzq_ptr; \
445 _zzq_args[0] = (unsigned int)(_zzq_request); \
446 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
447 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
448 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
449 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
450 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
451 _zzq_ptr = _zzq_args; \
452 __asm__ volatile("mr 3,%1\n\t" \
454 __SPECIAL_INSTRUCTION_PREAMBLE \
458 : "=b" (_zzq_result) \
459 : "b" (_zzq_default), "b" (_zzq_ptr) \
460 : "cc", "memory", "r3", "r4"); \
464#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
465 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
466 unsigned int __addr; \
467 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
473 : "cc", "memory", "r3" \
475 _zzq_orig->nraddr = __addr; \
478#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
479 __SPECIAL_INSTRUCTION_PREAMBLE \
483#define VALGRIND_VEX_INJECT_IR() \
485 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
494#if defined(PLAT_ppc64be_linux)
498 unsigned long int nraddr;
499 unsigned long int r2;
503#define __SPECIAL_INSTRUCTION_PREAMBLE \
504 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
505 "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
507#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
508 _zzq_default, _zzq_request, \
509 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
512 ({ unsigned long int _zzq_args[6]; \
513 unsigned long int _zzq_result; \
514 unsigned long int* _zzq_ptr; \
515 _zzq_args[0] = (unsigned long int)(_zzq_request); \
516 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
517 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
518 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
519 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
520 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
521 _zzq_ptr = _zzq_args; \
522 __asm__ volatile("mr 3,%1\n\t" \
524 __SPECIAL_INSTRUCTION_PREAMBLE \
528 : "=b" (_zzq_result) \
529 : "b" (_zzq_default), "b" (_zzq_ptr) \
530 : "cc", "memory", "r3", "r4"); \
534#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
535 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
536 unsigned long int __addr; \
537 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
543 : "cc", "memory", "r3" \
545 _zzq_orig->nraddr = __addr; \
546 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
552 : "cc", "memory", "r3" \
554 _zzq_orig->r2 = __addr; \
557#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
558 __SPECIAL_INSTRUCTION_PREAMBLE \
562#define VALGRIND_VEX_INJECT_IR() \
564 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
571#if defined(PLAT_ppc64le_linux)
575 unsigned long int nraddr;
576 unsigned long int r2;
580#define __SPECIAL_INSTRUCTION_PREAMBLE \
581 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
582 "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
584#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
585 _zzq_default, _zzq_request, \
586 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
589 ({ unsigned long int _zzq_args[6]; \
590 unsigned long int _zzq_result; \
591 unsigned long int* _zzq_ptr; \
592 _zzq_args[0] = (unsigned long int)(_zzq_request); \
593 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
594 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
595 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
596 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
597 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
598 _zzq_ptr = _zzq_args; \
599 __asm__ volatile("mr 3,%1\n\t" \
601 __SPECIAL_INSTRUCTION_PREAMBLE \
605 : "=b" (_zzq_result) \
606 : "b" (_zzq_default), "b" (_zzq_ptr) \
607 : "cc", "memory", "r3", "r4"); \
611#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
612 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
613 unsigned long int __addr; \
614 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
620 : "cc", "memory", "r3" \
622 _zzq_orig->nraddr = __addr; \
623 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
629 : "cc", "memory", "r3" \
631 _zzq_orig->r2 = __addr; \
634#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
635 __SPECIAL_INSTRUCTION_PREAMBLE \
639#define VALGRIND_VEX_INJECT_IR() \
641 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
650#if defined(PLAT_arm_linux)
658#define __SPECIAL_INSTRUCTION_PREAMBLE \
659 "mov r12, r12, ror #3 ; mov r12, r12, ror #13 \n\t" \
660 "mov r12, r12, ror #29 ; mov r12, r12, ror #19 \n\t"
662#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
663 _zzq_default, _zzq_request, \
664 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
667 ({volatile unsigned int _zzq_args[6]; \
668 volatile unsigned int _zzq_result; \
669 _zzq_args[0] = (unsigned int)(_zzq_request); \
670 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
671 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
672 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
673 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
674 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
675 __asm__ volatile("mov r3, %1\n\t" \
677 __SPECIAL_INSTRUCTION_PREAMBLE \
679 "orr r10, r10, r10\n\t" \
681 : "=r" (_zzq_result) \
682 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
683 : "cc","memory", "r3", "r4"); \
687#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
688 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
689 unsigned int __addr; \
690 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
692 "orr r11, r11, r11\n\t" \
696 : "cc", "memory", "r3" \
698 _zzq_orig->nraddr = __addr; \
701#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
702 __SPECIAL_INSTRUCTION_PREAMBLE \
704 "orr r12, r12, r12\n\t"
706#define VALGRIND_VEX_INJECT_IR() \
708 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
709 "orr r9, r9, r9\n\t" \
710 : : : "cc", "memory" \
718#if defined(PLAT_arm64_linux)
722 unsigned long int nraddr;
726#define __SPECIAL_INSTRUCTION_PREAMBLE \
727 "ror x12, x12, #3 ; ror x12, x12, #13 \n\t" \
728 "ror x12, x12, #51 ; ror x12, x12, #61 \n\t"
730#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
731 _zzq_default, _zzq_request, \
732 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
735 ({volatile unsigned long int _zzq_args[6]; \
736 volatile unsigned long int _zzq_result; \
737 _zzq_args[0] = (unsigned long int)(_zzq_request); \
738 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
739 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
740 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
741 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
742 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
743 __asm__ volatile("mov x3, %1\n\t" \
745 __SPECIAL_INSTRUCTION_PREAMBLE \
747 "orr x10, x10, x10\n\t" \
749 : "=r" (_zzq_result) \
750 : "r" ((unsigned long int)(_zzq_default)), \
751 "r" (&_zzq_args[0]) \
752 : "cc","memory", "x3", "x4"); \
756#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
757 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
758 unsigned long int __addr; \
759 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
761 "orr x11, x11, x11\n\t" \
765 : "cc", "memory", "x3" \
767 _zzq_orig->nraddr = __addr; \
770#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
771 __SPECIAL_INSTRUCTION_PREAMBLE \
773 "orr x12, x12, x12\n\t"
775#define VALGRIND_VEX_INJECT_IR() \
777 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
778 "orr x9, x9, x9\n\t" \
779 : : : "cc", "memory" \
787#if defined(PLAT_s390x_linux)
791 unsigned long int nraddr;
799#define __SPECIAL_INSTRUCTION_PREAMBLE \
805#define __CLIENT_REQUEST_CODE "lr 2,2\n\t"
806#define __GET_NR_CONTEXT_CODE "lr 3,3\n\t"
807#define __CALL_NO_REDIR_CODE "lr 4,4\n\t"
808#define __VEX_INJECT_IR_CODE "lr 5,5\n\t"
810#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
811 _zzq_default, _zzq_request, \
812 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
814 ({volatile unsigned long int _zzq_args[6]; \
815 volatile unsigned long int _zzq_result; \
816 _zzq_args[0] = (unsigned long int)(_zzq_request); \
817 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
818 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
819 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
820 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
821 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
826 __SPECIAL_INSTRUCTION_PREAMBLE \
827 __CLIENT_REQUEST_CODE \
830 : "=d" (_zzq_result) \
831 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
832 : "cc", "2", "3", "memory" \
837#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
838 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
839 volatile unsigned long int __addr; \
840 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
841 __GET_NR_CONTEXT_CODE \
845 : "cc", "3", "memory" \
847 _zzq_orig->nraddr = __addr; \
850#define VALGRIND_CALL_NOREDIR_R1 \
851 __SPECIAL_INSTRUCTION_PREAMBLE \
854#define VALGRIND_VEX_INJECT_IR() \
856 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
857 __VEX_INJECT_IR_CODE); \
864#if defined(PLAT_mips32_linux)
876#define __SPECIAL_INSTRUCTION_PREAMBLE \
877 "srl $0, $0, 13\n\t" \
878 "srl $0, $0, 29\n\t" \
879 "srl $0, $0, 3\n\t" \
882#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
883 _zzq_default, _zzq_request, \
884 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
886 ({ volatile unsigned int _zzq_args[6]; \
887 volatile unsigned int _zzq_result; \
888 _zzq_args[0] = (unsigned int)(_zzq_request); \
889 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
890 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
891 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
892 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
893 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
894 __asm__ volatile("move $11, %1\n\t" \
896 __SPECIAL_INSTRUCTION_PREAMBLE \
898 "or $13, $13, $13\n\t" \
900 : "=r" (_zzq_result) \
901 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
902 : "$11", "$12", "memory"); \
906#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
907 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
908 volatile unsigned int __addr; \
909 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
911 "or $14, $14, $14\n\t" \
917 _zzq_orig->nraddr = __addr; \
920#define VALGRIND_CALL_NOREDIR_T9 \
921 __SPECIAL_INSTRUCTION_PREAMBLE \
923 "or $15, $15, $15\n\t"
925#define VALGRIND_VEX_INJECT_IR() \
927 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
928 "or $11, $11, $11\n\t" \
937#if defined(PLAT_mips64_linux)
941 unsigned long nraddr;
949#define __SPECIAL_INSTRUCTION_PREAMBLE \
950 "dsll $0,$0, 3 ; dsll $0,$0,13\n\t" \
951 "dsll $0,$0,29 ; dsll $0,$0,19\n\t"
953#define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
954 _zzq_default, _zzq_request, \
955 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
957 ({ volatile unsigned long int _zzq_args[6]; \
958 volatile unsigned long int _zzq_result; \
959 _zzq_args[0] = (unsigned long int)(_zzq_request); \
960 _zzq_args[1] = (unsigned long int)(_zzq_arg1); \
961 _zzq_args[2] = (unsigned long int)(_zzq_arg2); \
962 _zzq_args[3] = (unsigned long int)(_zzq_arg3); \
963 _zzq_args[4] = (unsigned long int)(_zzq_arg4); \
964 _zzq_args[5] = (unsigned long int)(_zzq_arg5); \
965 __asm__ volatile("move $11, %1\n\t" \
967 __SPECIAL_INSTRUCTION_PREAMBLE \
969 "or $13, $13, $13\n\t" \
971 : "=r" (_zzq_result) \
972 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
973 : "$11", "$12", "memory"); \
977#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
978 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
979 volatile unsigned long int __addr; \
980 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
982 "or $14, $14, $14\n\t" \
987 _zzq_orig->nraddr = __addr; \
990#define VALGRIND_CALL_NOREDIR_T9 \
991 __SPECIAL_INSTRUCTION_PREAMBLE \
993 "or $15, $15, $15\n\t"
995#define VALGRIND_VEX_INJECT_IR() \
997 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
998 "or $11, $11, $11\n\t" \
1040#define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
1042#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
1043 VG_CONCAT4(_vgw00000ZU_,soname,_,fnname)
1045#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
1046 VG_CONCAT4(_vgw00000ZZ_,soname,_,fnname)
1052#define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval)
1060#define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname) \
1061 VG_CONCAT4(_vgr00000ZU_,soname,_,fnname)
1063#define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname) \
1064 VG_CONCAT4(_vgr00000ZZ_,soname,_,fnname)
1069#define CALL_FN_v_v(fnptr) \
1070 do { volatile unsigned long _junk; \
1071 CALL_FN_W_v(_junk,fnptr); } while (0)
1073#define CALL_FN_v_W(fnptr, arg1) \
1074 do { volatile unsigned long _junk; \
1075 CALL_FN_W_W(_junk,fnptr,arg1); } while (0)
1077#define CALL_FN_v_WW(fnptr, arg1,arg2) \
1078 do { volatile unsigned long _junk; \
1079 CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)
1081#define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3) \
1082 do { volatile unsigned long _junk; \
1083 CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
1085#define CALL_FN_v_WWWW(fnptr, arg1,arg2,arg3,arg4) \
1086 do { volatile unsigned long _junk; \
1087 CALL_FN_W_WWWW(_junk,fnptr,arg1,arg2,arg3,arg4); } while (0)
1089#define CALL_FN_v_5W(fnptr, arg1,arg2,arg3,arg4,arg5) \
1090 do { volatile unsigned long _junk; \
1091 CALL_FN_W_5W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5); } while (0)
1093#define CALL_FN_v_6W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6) \
1094 do { volatile unsigned long _junk; \
1095 CALL_FN_W_6W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6); } while (0)
1097#define CALL_FN_v_7W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg7) \
1098 do { volatile unsigned long _junk; \
1099 CALL_FN_W_7W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6,arg7); } while (0)
1103#if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
1104 || defined(PLAT_x86_solaris)
1108#define __CALLER_SAVED_REGS "ecx", "edx"
1115#define VALGRIND_ALIGN_STACK \
1116 "movl %%esp,%%edi\n\t" \
1117 "andl $0xfffffff0,%%esp\n\t"
1118#define VALGRIND_RESTORE_STACK \
1119 "movl %%edi,%%esp\n\t"
1124#define CALL_FN_W_v(lval, orig) \
1126 volatile OrigFn _orig = (orig); \
1127 volatile unsigned long _argvec[1]; \
1128 volatile unsigned long _res; \
1129 _argvec[0] = (unsigned long)_orig.nraddr; \
1131 VALGRIND_ALIGN_STACK \
1132 "movl (%%eax), %%eax\n\t" \
1133 VALGRIND_CALL_NOREDIR_EAX \
1134 VALGRIND_RESTORE_STACK \
1136 : "a" (&_argvec[0]) \
1137 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1139 lval = (__typeof__(lval)) _res; \
1142#define CALL_FN_W_W(lval, orig, arg1) \
1144 volatile OrigFn _orig = (orig); \
1145 volatile unsigned long _argvec[2]; \
1146 volatile unsigned long _res; \
1147 _argvec[0] = (unsigned long)_orig.nraddr; \
1148 _argvec[1] = (unsigned long)(arg1); \
1150 VALGRIND_ALIGN_STACK \
1151 "subl $12, %%esp\n\t" \
1152 "pushl 4(%%eax)\n\t" \
1153 "movl (%%eax), %%eax\n\t" \
1154 VALGRIND_CALL_NOREDIR_EAX \
1155 VALGRIND_RESTORE_STACK \
1157 : "a" (&_argvec[0]) \
1158 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1160 lval = (__typeof__(lval)) _res; \
1163#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1165 volatile OrigFn _orig = (orig); \
1166 volatile unsigned long _argvec[3]; \
1167 volatile unsigned long _res; \
1168 _argvec[0] = (unsigned long)_orig.nraddr; \
1169 _argvec[1] = (unsigned long)(arg1); \
1170 _argvec[2] = (unsigned long)(arg2); \
1172 VALGRIND_ALIGN_STACK \
1173 "subl $8, %%esp\n\t" \
1174 "pushl 8(%%eax)\n\t" \
1175 "pushl 4(%%eax)\n\t" \
1176 "movl (%%eax), %%eax\n\t" \
1177 VALGRIND_CALL_NOREDIR_EAX \
1178 VALGRIND_RESTORE_STACK \
1180 : "a" (&_argvec[0]) \
1181 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1183 lval = (__typeof__(lval)) _res; \
1186#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1188 volatile OrigFn _orig = (orig); \
1189 volatile unsigned long _argvec[4]; \
1190 volatile unsigned long _res; \
1191 _argvec[0] = (unsigned long)_orig.nraddr; \
1192 _argvec[1] = (unsigned long)(arg1); \
1193 _argvec[2] = (unsigned long)(arg2); \
1194 _argvec[3] = (unsigned long)(arg3); \
1196 VALGRIND_ALIGN_STACK \
1197 "subl $4, %%esp\n\t" \
1198 "pushl 12(%%eax)\n\t" \
1199 "pushl 8(%%eax)\n\t" \
1200 "pushl 4(%%eax)\n\t" \
1201 "movl (%%eax), %%eax\n\t" \
1202 VALGRIND_CALL_NOREDIR_EAX \
1203 VALGRIND_RESTORE_STACK \
1205 : "a" (&_argvec[0]) \
1206 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1208 lval = (__typeof__(lval)) _res; \
1211#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1213 volatile OrigFn _orig = (orig); \
1214 volatile unsigned long _argvec[5]; \
1215 volatile unsigned long _res; \
1216 _argvec[0] = (unsigned long)_orig.nraddr; \
1217 _argvec[1] = (unsigned long)(arg1); \
1218 _argvec[2] = (unsigned long)(arg2); \
1219 _argvec[3] = (unsigned long)(arg3); \
1220 _argvec[4] = (unsigned long)(arg4); \
1222 VALGRIND_ALIGN_STACK \
1223 "pushl 16(%%eax)\n\t" \
1224 "pushl 12(%%eax)\n\t" \
1225 "pushl 8(%%eax)\n\t" \
1226 "pushl 4(%%eax)\n\t" \
1227 "movl (%%eax), %%eax\n\t" \
1228 VALGRIND_CALL_NOREDIR_EAX \
1229 VALGRIND_RESTORE_STACK \
1231 : "a" (&_argvec[0]) \
1232 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1234 lval = (__typeof__(lval)) _res; \
1237#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1239 volatile OrigFn _orig = (orig); \
1240 volatile unsigned long _argvec[6]; \
1241 volatile unsigned long _res; \
1242 _argvec[0] = (unsigned long)_orig.nraddr; \
1243 _argvec[1] = (unsigned long)(arg1); \
1244 _argvec[2] = (unsigned long)(arg2); \
1245 _argvec[3] = (unsigned long)(arg3); \
1246 _argvec[4] = (unsigned long)(arg4); \
1247 _argvec[5] = (unsigned long)(arg5); \
1249 VALGRIND_ALIGN_STACK \
1250 "subl $12, %%esp\n\t" \
1251 "pushl 20(%%eax)\n\t" \
1252 "pushl 16(%%eax)\n\t" \
1253 "pushl 12(%%eax)\n\t" \
1254 "pushl 8(%%eax)\n\t" \
1255 "pushl 4(%%eax)\n\t" \
1256 "movl (%%eax), %%eax\n\t" \
1257 VALGRIND_CALL_NOREDIR_EAX \
1258 VALGRIND_RESTORE_STACK \
1260 : "a" (&_argvec[0]) \
1261 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1263 lval = (__typeof__(lval)) _res; \
1266#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1268 volatile OrigFn _orig = (orig); \
1269 volatile unsigned long _argvec[7]; \
1270 volatile unsigned long _res; \
1271 _argvec[0] = (unsigned long)_orig.nraddr; \
1272 _argvec[1] = (unsigned long)(arg1); \
1273 _argvec[2] = (unsigned long)(arg2); \
1274 _argvec[3] = (unsigned long)(arg3); \
1275 _argvec[4] = (unsigned long)(arg4); \
1276 _argvec[5] = (unsigned long)(arg5); \
1277 _argvec[6] = (unsigned long)(arg6); \
1279 VALGRIND_ALIGN_STACK \
1280 "subl $8, %%esp\n\t" \
1281 "pushl 24(%%eax)\n\t" \
1282 "pushl 20(%%eax)\n\t" \
1283 "pushl 16(%%eax)\n\t" \
1284 "pushl 12(%%eax)\n\t" \
1285 "pushl 8(%%eax)\n\t" \
1286 "pushl 4(%%eax)\n\t" \
1287 "movl (%%eax), %%eax\n\t" \
1288 VALGRIND_CALL_NOREDIR_EAX \
1289 VALGRIND_RESTORE_STACK \
1291 : "a" (&_argvec[0]) \
1292 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1294 lval = (__typeof__(lval)) _res; \
1297#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1300 volatile OrigFn _orig = (orig); \
1301 volatile unsigned long _argvec[8]; \
1302 volatile unsigned long _res; \
1303 _argvec[0] = (unsigned long)_orig.nraddr; \
1304 _argvec[1] = (unsigned long)(arg1); \
1305 _argvec[2] = (unsigned long)(arg2); \
1306 _argvec[3] = (unsigned long)(arg3); \
1307 _argvec[4] = (unsigned long)(arg4); \
1308 _argvec[5] = (unsigned long)(arg5); \
1309 _argvec[6] = (unsigned long)(arg6); \
1310 _argvec[7] = (unsigned long)(arg7); \
1312 VALGRIND_ALIGN_STACK \
1313 "subl $4, %%esp\n\t" \
1314 "pushl 28(%%eax)\n\t" \
1315 "pushl 24(%%eax)\n\t" \
1316 "pushl 20(%%eax)\n\t" \
1317 "pushl 16(%%eax)\n\t" \
1318 "pushl 12(%%eax)\n\t" \
1319 "pushl 8(%%eax)\n\t" \
1320 "pushl 4(%%eax)\n\t" \
1321 "movl (%%eax), %%eax\n\t" \
1322 VALGRIND_CALL_NOREDIR_EAX \
1323 VALGRIND_RESTORE_STACK \
1325 : "a" (&_argvec[0]) \
1326 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1328 lval = (__typeof__(lval)) _res; \
1331#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1334 volatile OrigFn _orig = (orig); \
1335 volatile unsigned long _argvec[9]; \
1336 volatile unsigned long _res; \
1337 _argvec[0] = (unsigned long)_orig.nraddr; \
1338 _argvec[1] = (unsigned long)(arg1); \
1339 _argvec[2] = (unsigned long)(arg2); \
1340 _argvec[3] = (unsigned long)(arg3); \
1341 _argvec[4] = (unsigned long)(arg4); \
1342 _argvec[5] = (unsigned long)(arg5); \
1343 _argvec[6] = (unsigned long)(arg6); \
1344 _argvec[7] = (unsigned long)(arg7); \
1345 _argvec[8] = (unsigned long)(arg8); \
1347 VALGRIND_ALIGN_STACK \
1348 "pushl 32(%%eax)\n\t" \
1349 "pushl 28(%%eax)\n\t" \
1350 "pushl 24(%%eax)\n\t" \
1351 "pushl 20(%%eax)\n\t" \
1352 "pushl 16(%%eax)\n\t" \
1353 "pushl 12(%%eax)\n\t" \
1354 "pushl 8(%%eax)\n\t" \
1355 "pushl 4(%%eax)\n\t" \
1356 "movl (%%eax), %%eax\n\t" \
1357 VALGRIND_CALL_NOREDIR_EAX \
1358 VALGRIND_RESTORE_STACK \
1360 : "a" (&_argvec[0]) \
1361 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1363 lval = (__typeof__(lval)) _res; \
1366#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1369 volatile OrigFn _orig = (orig); \
1370 volatile unsigned long _argvec[10]; \
1371 volatile unsigned long _res; \
1372 _argvec[0] = (unsigned long)_orig.nraddr; \
1373 _argvec[1] = (unsigned long)(arg1); \
1374 _argvec[2] = (unsigned long)(arg2); \
1375 _argvec[3] = (unsigned long)(arg3); \
1376 _argvec[4] = (unsigned long)(arg4); \
1377 _argvec[5] = (unsigned long)(arg5); \
1378 _argvec[6] = (unsigned long)(arg6); \
1379 _argvec[7] = (unsigned long)(arg7); \
1380 _argvec[8] = (unsigned long)(arg8); \
1381 _argvec[9] = (unsigned long)(arg9); \
1383 VALGRIND_ALIGN_STACK \
1384 "subl $12, %%esp\n\t" \
1385 "pushl 36(%%eax)\n\t" \
1386 "pushl 32(%%eax)\n\t" \
1387 "pushl 28(%%eax)\n\t" \
1388 "pushl 24(%%eax)\n\t" \
1389 "pushl 20(%%eax)\n\t" \
1390 "pushl 16(%%eax)\n\t" \
1391 "pushl 12(%%eax)\n\t" \
1392 "pushl 8(%%eax)\n\t" \
1393 "pushl 4(%%eax)\n\t" \
1394 "movl (%%eax), %%eax\n\t" \
1395 VALGRIND_CALL_NOREDIR_EAX \
1396 VALGRIND_RESTORE_STACK \
1398 : "a" (&_argvec[0]) \
1399 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1401 lval = (__typeof__(lval)) _res; \
1404#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1405 arg7,arg8,arg9,arg10) \
1407 volatile OrigFn _orig = (orig); \
1408 volatile unsigned long _argvec[11]; \
1409 volatile unsigned long _res; \
1410 _argvec[0] = (unsigned long)_orig.nraddr; \
1411 _argvec[1] = (unsigned long)(arg1); \
1412 _argvec[2] = (unsigned long)(arg2); \
1413 _argvec[3] = (unsigned long)(arg3); \
1414 _argvec[4] = (unsigned long)(arg4); \
1415 _argvec[5] = (unsigned long)(arg5); \
1416 _argvec[6] = (unsigned long)(arg6); \
1417 _argvec[7] = (unsigned long)(arg7); \
1418 _argvec[8] = (unsigned long)(arg8); \
1419 _argvec[9] = (unsigned long)(arg9); \
1420 _argvec[10] = (unsigned long)(arg10); \
1422 VALGRIND_ALIGN_STACK \
1423 "subl $8, %%esp\n\t" \
1424 "pushl 40(%%eax)\n\t" \
1425 "pushl 36(%%eax)\n\t" \
1426 "pushl 32(%%eax)\n\t" \
1427 "pushl 28(%%eax)\n\t" \
1428 "pushl 24(%%eax)\n\t" \
1429 "pushl 20(%%eax)\n\t" \
1430 "pushl 16(%%eax)\n\t" \
1431 "pushl 12(%%eax)\n\t" \
1432 "pushl 8(%%eax)\n\t" \
1433 "pushl 4(%%eax)\n\t" \
1434 "movl (%%eax), %%eax\n\t" \
1435 VALGRIND_CALL_NOREDIR_EAX \
1436 VALGRIND_RESTORE_STACK \
1438 : "a" (&_argvec[0]) \
1439 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1441 lval = (__typeof__(lval)) _res; \
1444#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
1445 arg6,arg7,arg8,arg9,arg10, \
1448 volatile OrigFn _orig = (orig); \
1449 volatile unsigned long _argvec[12]; \
1450 volatile unsigned long _res; \
1451 _argvec[0] = (unsigned long)_orig.nraddr; \
1452 _argvec[1] = (unsigned long)(arg1); \
1453 _argvec[2] = (unsigned long)(arg2); \
1454 _argvec[3] = (unsigned long)(arg3); \
1455 _argvec[4] = (unsigned long)(arg4); \
1456 _argvec[5] = (unsigned long)(arg5); \
1457 _argvec[6] = (unsigned long)(arg6); \
1458 _argvec[7] = (unsigned long)(arg7); \
1459 _argvec[8] = (unsigned long)(arg8); \
1460 _argvec[9] = (unsigned long)(arg9); \
1461 _argvec[10] = (unsigned long)(arg10); \
1462 _argvec[11] = (unsigned long)(arg11); \
1464 VALGRIND_ALIGN_STACK \
1465 "subl $4, %%esp\n\t" \
1466 "pushl 44(%%eax)\n\t" \
1467 "pushl 40(%%eax)\n\t" \
1468 "pushl 36(%%eax)\n\t" \
1469 "pushl 32(%%eax)\n\t" \
1470 "pushl 28(%%eax)\n\t" \
1471 "pushl 24(%%eax)\n\t" \
1472 "pushl 20(%%eax)\n\t" \
1473 "pushl 16(%%eax)\n\t" \
1474 "pushl 12(%%eax)\n\t" \
1475 "pushl 8(%%eax)\n\t" \
1476 "pushl 4(%%eax)\n\t" \
1477 "movl (%%eax), %%eax\n\t" \
1478 VALGRIND_CALL_NOREDIR_EAX \
1479 VALGRIND_RESTORE_STACK \
1481 : "a" (&_argvec[0]) \
1482 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1484 lval = (__typeof__(lval)) _res; \
1487#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
1488 arg6,arg7,arg8,arg9,arg10, \
1491 volatile OrigFn _orig = (orig); \
1492 volatile unsigned long _argvec[13]; \
1493 volatile unsigned long _res; \
1494 _argvec[0] = (unsigned long)_orig.nraddr; \
1495 _argvec[1] = (unsigned long)(arg1); \
1496 _argvec[2] = (unsigned long)(arg2); \
1497 _argvec[3] = (unsigned long)(arg3); \
1498 _argvec[4] = (unsigned long)(arg4); \
1499 _argvec[5] = (unsigned long)(arg5); \
1500 _argvec[6] = (unsigned long)(arg6); \
1501 _argvec[7] = (unsigned long)(arg7); \
1502 _argvec[8] = (unsigned long)(arg8); \
1503 _argvec[9] = (unsigned long)(arg9); \
1504 _argvec[10] = (unsigned long)(arg10); \
1505 _argvec[11] = (unsigned long)(arg11); \
1506 _argvec[12] = (unsigned long)(arg12); \
1508 VALGRIND_ALIGN_STACK \
1509 "pushl 48(%%eax)\n\t" \
1510 "pushl 44(%%eax)\n\t" \
1511 "pushl 40(%%eax)\n\t" \
1512 "pushl 36(%%eax)\n\t" \
1513 "pushl 32(%%eax)\n\t" \
1514 "pushl 28(%%eax)\n\t" \
1515 "pushl 24(%%eax)\n\t" \
1516 "pushl 20(%%eax)\n\t" \
1517 "pushl 16(%%eax)\n\t" \
1518 "pushl 12(%%eax)\n\t" \
1519 "pushl 8(%%eax)\n\t" \
1520 "pushl 4(%%eax)\n\t" \
1521 "movl (%%eax), %%eax\n\t" \
1522 VALGRIND_CALL_NOREDIR_EAX \
1523 VALGRIND_RESTORE_STACK \
1525 : "a" (&_argvec[0]) \
1526 : "cc", "memory", __CALLER_SAVED_REGS, "edi" \
1528 lval = (__typeof__(lval)) _res; \
1535#if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin) \
1536 || defined(PLAT_amd64_solaris)
1541#define __CALLER_SAVED_REGS "rcx", "rdx", "rsi", \
1542 "rdi", "r8", "r9", "r10", "r11"
1598#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
1599# define __FRAME_POINTER \
1600 ,"r"(__builtin_dwarf_cfa())
1601# define VALGRIND_CFI_PROLOGUE \
1602 "movq %%rbp, %%r15\n\t" \
1603 "movq %2, %%rbp\n\t" \
1604 ".cfi_remember_state\n\t" \
1605 ".cfi_def_cfa rbp, 0\n\t"
1606# define VALGRIND_CFI_EPILOGUE \
1607 "movq %%r15, %%rbp\n\t" \
1608 ".cfi_restore_state\n\t"
1610# define __FRAME_POINTER
1611# define VALGRIND_CFI_PROLOGUE
1612# define VALGRIND_CFI_EPILOGUE
1620#define VALGRIND_ALIGN_STACK \
1621 "movq %%rsp,%%r14\n\t" \
1622 "andq $0xfffffffffffffff0,%%rsp\n\t"
1623#define VALGRIND_RESTORE_STACK \
1624 "movq %%r14,%%rsp\n\t"
1650#define CALL_FN_W_v(lval, orig) \
1652 volatile OrigFn _orig = (orig); \
1653 volatile unsigned long _argvec[1]; \
1654 volatile unsigned long _res; \
1655 _argvec[0] = (unsigned long)_orig.nraddr; \
1657 VALGRIND_CFI_PROLOGUE \
1658 VALGRIND_ALIGN_STACK \
1659 "subq $128,%%rsp\n\t" \
1660 "movq (%%rax), %%rax\n\t" \
1661 VALGRIND_CALL_NOREDIR_RAX \
1662 VALGRIND_RESTORE_STACK \
1663 VALGRIND_CFI_EPILOGUE \
1665 : "a" (&_argvec[0]) __FRAME_POINTER \
1666 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1668 lval = (__typeof__(lval)) _res; \
1671#define CALL_FN_W_W(lval, orig, arg1) \
1673 volatile OrigFn _orig = (orig); \
1674 volatile unsigned long _argvec[2]; \
1675 volatile unsigned long _res; \
1676 _argvec[0] = (unsigned long)_orig.nraddr; \
1677 _argvec[1] = (unsigned long)(arg1); \
1679 VALGRIND_CFI_PROLOGUE \
1680 VALGRIND_ALIGN_STACK \
1681 "subq $128,%%rsp\n\t" \
1682 "movq 8(%%rax), %%rdi\n\t" \
1683 "movq (%%rax), %%rax\n\t" \
1684 VALGRIND_CALL_NOREDIR_RAX \
1685 VALGRIND_RESTORE_STACK \
1686 VALGRIND_CFI_EPILOGUE \
1688 : "a" (&_argvec[0]) __FRAME_POINTER \
1689 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1691 lval = (__typeof__(lval)) _res; \
1694#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1696 volatile OrigFn _orig = (orig); \
1697 volatile unsigned long _argvec[3]; \
1698 volatile unsigned long _res; \
1699 _argvec[0] = (unsigned long)_orig.nraddr; \
1700 _argvec[1] = (unsigned long)(arg1); \
1701 _argvec[2] = (unsigned long)(arg2); \
1703 VALGRIND_CFI_PROLOGUE \
1704 VALGRIND_ALIGN_STACK \
1705 "subq $128,%%rsp\n\t" \
1706 "movq 16(%%rax), %%rsi\n\t" \
1707 "movq 8(%%rax), %%rdi\n\t" \
1708 "movq (%%rax), %%rax\n\t" \
1709 VALGRIND_CALL_NOREDIR_RAX \
1710 VALGRIND_RESTORE_STACK \
1711 VALGRIND_CFI_EPILOGUE \
1713 : "a" (&_argvec[0]) __FRAME_POINTER \
1714 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1716 lval = (__typeof__(lval)) _res; \
1719#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1721 volatile OrigFn _orig = (orig); \
1722 volatile unsigned long _argvec[4]; \
1723 volatile unsigned long _res; \
1724 _argvec[0] = (unsigned long)_orig.nraddr; \
1725 _argvec[1] = (unsigned long)(arg1); \
1726 _argvec[2] = (unsigned long)(arg2); \
1727 _argvec[3] = (unsigned long)(arg3); \
1729 VALGRIND_CFI_PROLOGUE \
1730 VALGRIND_ALIGN_STACK \
1731 "subq $128,%%rsp\n\t" \
1732 "movq 24(%%rax), %%rdx\n\t" \
1733 "movq 16(%%rax), %%rsi\n\t" \
1734 "movq 8(%%rax), %%rdi\n\t" \
1735 "movq (%%rax), %%rax\n\t" \
1736 VALGRIND_CALL_NOREDIR_RAX \
1737 VALGRIND_RESTORE_STACK \
1738 VALGRIND_CFI_EPILOGUE \
1740 : "a" (&_argvec[0]) __FRAME_POINTER \
1741 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1743 lval = (__typeof__(lval)) _res; \
1746#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1748 volatile OrigFn _orig = (orig); \
1749 volatile unsigned long _argvec[5]; \
1750 volatile unsigned long _res; \
1751 _argvec[0] = (unsigned long)_orig.nraddr; \
1752 _argvec[1] = (unsigned long)(arg1); \
1753 _argvec[2] = (unsigned long)(arg2); \
1754 _argvec[3] = (unsigned long)(arg3); \
1755 _argvec[4] = (unsigned long)(arg4); \
1757 VALGRIND_CFI_PROLOGUE \
1758 VALGRIND_ALIGN_STACK \
1759 "subq $128,%%rsp\n\t" \
1760 "movq 32(%%rax), %%rcx\n\t" \
1761 "movq 24(%%rax), %%rdx\n\t" \
1762 "movq 16(%%rax), %%rsi\n\t" \
1763 "movq 8(%%rax), %%rdi\n\t" \
1764 "movq (%%rax), %%rax\n\t" \
1765 VALGRIND_CALL_NOREDIR_RAX \
1766 VALGRIND_RESTORE_STACK \
1767 VALGRIND_CFI_EPILOGUE \
1769 : "a" (&_argvec[0]) __FRAME_POINTER \
1770 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1772 lval = (__typeof__(lval)) _res; \
1775#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1777 volatile OrigFn _orig = (orig); \
1778 volatile unsigned long _argvec[6]; \
1779 volatile unsigned long _res; \
1780 _argvec[0] = (unsigned long)_orig.nraddr; \
1781 _argvec[1] = (unsigned long)(arg1); \
1782 _argvec[2] = (unsigned long)(arg2); \
1783 _argvec[3] = (unsigned long)(arg3); \
1784 _argvec[4] = (unsigned long)(arg4); \
1785 _argvec[5] = (unsigned long)(arg5); \
1787 VALGRIND_CFI_PROLOGUE \
1788 VALGRIND_ALIGN_STACK \
1789 "subq $128,%%rsp\n\t" \
1790 "movq 40(%%rax), %%r8\n\t" \
1791 "movq 32(%%rax), %%rcx\n\t" \
1792 "movq 24(%%rax), %%rdx\n\t" \
1793 "movq 16(%%rax), %%rsi\n\t" \
1794 "movq 8(%%rax), %%rdi\n\t" \
1795 "movq (%%rax), %%rax\n\t" \
1796 VALGRIND_CALL_NOREDIR_RAX \
1797 VALGRIND_RESTORE_STACK \
1798 VALGRIND_CFI_EPILOGUE \
1800 : "a" (&_argvec[0]) __FRAME_POINTER \
1801 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1803 lval = (__typeof__(lval)) _res; \
1806#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1808 volatile OrigFn _orig = (orig); \
1809 volatile unsigned long _argvec[7]; \
1810 volatile unsigned long _res; \
1811 _argvec[0] = (unsigned long)_orig.nraddr; \
1812 _argvec[1] = (unsigned long)(arg1); \
1813 _argvec[2] = (unsigned long)(arg2); \
1814 _argvec[3] = (unsigned long)(arg3); \
1815 _argvec[4] = (unsigned long)(arg4); \
1816 _argvec[5] = (unsigned long)(arg5); \
1817 _argvec[6] = (unsigned long)(arg6); \
1819 VALGRIND_CFI_PROLOGUE \
1820 VALGRIND_ALIGN_STACK \
1821 "subq $128,%%rsp\n\t" \
1822 "movq 48(%%rax), %%r9\n\t" \
1823 "movq 40(%%rax), %%r8\n\t" \
1824 "movq 32(%%rax), %%rcx\n\t" \
1825 "movq 24(%%rax), %%rdx\n\t" \
1826 "movq 16(%%rax), %%rsi\n\t" \
1827 "movq 8(%%rax), %%rdi\n\t" \
1828 "movq (%%rax), %%rax\n\t" \
1829 VALGRIND_CALL_NOREDIR_RAX \
1830 VALGRIND_RESTORE_STACK \
1831 VALGRIND_CFI_EPILOGUE \
1833 : "a" (&_argvec[0]) __FRAME_POINTER \
1834 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1836 lval = (__typeof__(lval)) _res; \
1839#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1842 volatile OrigFn _orig = (orig); \
1843 volatile unsigned long _argvec[8]; \
1844 volatile unsigned long _res; \
1845 _argvec[0] = (unsigned long)_orig.nraddr; \
1846 _argvec[1] = (unsigned long)(arg1); \
1847 _argvec[2] = (unsigned long)(arg2); \
1848 _argvec[3] = (unsigned long)(arg3); \
1849 _argvec[4] = (unsigned long)(arg4); \
1850 _argvec[5] = (unsigned long)(arg5); \
1851 _argvec[6] = (unsigned long)(arg6); \
1852 _argvec[7] = (unsigned long)(arg7); \
1854 VALGRIND_CFI_PROLOGUE \
1855 VALGRIND_ALIGN_STACK \
1856 "subq $136,%%rsp\n\t" \
1857 "pushq 56(%%rax)\n\t" \
1858 "movq 48(%%rax), %%r9\n\t" \
1859 "movq 40(%%rax), %%r8\n\t" \
1860 "movq 32(%%rax), %%rcx\n\t" \
1861 "movq 24(%%rax), %%rdx\n\t" \
1862 "movq 16(%%rax), %%rsi\n\t" \
1863 "movq 8(%%rax), %%rdi\n\t" \
1864 "movq (%%rax), %%rax\n\t" \
1865 VALGRIND_CALL_NOREDIR_RAX \
1866 VALGRIND_RESTORE_STACK \
1867 VALGRIND_CFI_EPILOGUE \
1869 : "a" (&_argvec[0]) __FRAME_POINTER \
1870 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1872 lval = (__typeof__(lval)) _res; \
1875#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1878 volatile OrigFn _orig = (orig); \
1879 volatile unsigned long _argvec[9]; \
1880 volatile unsigned long _res; \
1881 _argvec[0] = (unsigned long)_orig.nraddr; \
1882 _argvec[1] = (unsigned long)(arg1); \
1883 _argvec[2] = (unsigned long)(arg2); \
1884 _argvec[3] = (unsigned long)(arg3); \
1885 _argvec[4] = (unsigned long)(arg4); \
1886 _argvec[5] = (unsigned long)(arg5); \
1887 _argvec[6] = (unsigned long)(arg6); \
1888 _argvec[7] = (unsigned long)(arg7); \
1889 _argvec[8] = (unsigned long)(arg8); \
1891 VALGRIND_CFI_PROLOGUE \
1892 VALGRIND_ALIGN_STACK \
1893 "subq $128,%%rsp\n\t" \
1894 "pushq 64(%%rax)\n\t" \
1895 "pushq 56(%%rax)\n\t" \
1896 "movq 48(%%rax), %%r9\n\t" \
1897 "movq 40(%%rax), %%r8\n\t" \
1898 "movq 32(%%rax), %%rcx\n\t" \
1899 "movq 24(%%rax), %%rdx\n\t" \
1900 "movq 16(%%rax), %%rsi\n\t" \
1901 "movq 8(%%rax), %%rdi\n\t" \
1902 "movq (%%rax), %%rax\n\t" \
1903 VALGRIND_CALL_NOREDIR_RAX \
1904 VALGRIND_RESTORE_STACK \
1905 VALGRIND_CFI_EPILOGUE \
1907 : "a" (&_argvec[0]) __FRAME_POINTER \
1908 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1910 lval = (__typeof__(lval)) _res; \
1913#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1916 volatile OrigFn _orig = (orig); \
1917 volatile unsigned long _argvec[10]; \
1918 volatile unsigned long _res; \
1919 _argvec[0] = (unsigned long)_orig.nraddr; \
1920 _argvec[1] = (unsigned long)(arg1); \
1921 _argvec[2] = (unsigned long)(arg2); \
1922 _argvec[3] = (unsigned long)(arg3); \
1923 _argvec[4] = (unsigned long)(arg4); \
1924 _argvec[5] = (unsigned long)(arg5); \
1925 _argvec[6] = (unsigned long)(arg6); \
1926 _argvec[7] = (unsigned long)(arg7); \
1927 _argvec[8] = (unsigned long)(arg8); \
1928 _argvec[9] = (unsigned long)(arg9); \
1930 VALGRIND_CFI_PROLOGUE \
1931 VALGRIND_ALIGN_STACK \
1932 "subq $136,%%rsp\n\t" \
1933 "pushq 72(%%rax)\n\t" \
1934 "pushq 64(%%rax)\n\t" \
1935 "pushq 56(%%rax)\n\t" \
1936 "movq 48(%%rax), %%r9\n\t" \
1937 "movq 40(%%rax), %%r8\n\t" \
1938 "movq 32(%%rax), %%rcx\n\t" \
1939 "movq 24(%%rax), %%rdx\n\t" \
1940 "movq 16(%%rax), %%rsi\n\t" \
1941 "movq 8(%%rax), %%rdi\n\t" \
1942 "movq (%%rax), %%rax\n\t" \
1943 VALGRIND_CALL_NOREDIR_RAX \
1944 VALGRIND_RESTORE_STACK \
1945 VALGRIND_CFI_EPILOGUE \
1947 : "a" (&_argvec[0]) __FRAME_POINTER \
1948 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1950 lval = (__typeof__(lval)) _res; \
1953#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1954 arg7,arg8,arg9,arg10) \
1956 volatile OrigFn _orig = (orig); \
1957 volatile unsigned long _argvec[11]; \
1958 volatile unsigned long _res; \
1959 _argvec[0] = (unsigned long)_orig.nraddr; \
1960 _argvec[1] = (unsigned long)(arg1); \
1961 _argvec[2] = (unsigned long)(arg2); \
1962 _argvec[3] = (unsigned long)(arg3); \
1963 _argvec[4] = (unsigned long)(arg4); \
1964 _argvec[5] = (unsigned long)(arg5); \
1965 _argvec[6] = (unsigned long)(arg6); \
1966 _argvec[7] = (unsigned long)(arg7); \
1967 _argvec[8] = (unsigned long)(arg8); \
1968 _argvec[9] = (unsigned long)(arg9); \
1969 _argvec[10] = (unsigned long)(arg10); \
1971 VALGRIND_CFI_PROLOGUE \
1972 VALGRIND_ALIGN_STACK \
1973 "subq $128,%%rsp\n\t" \
1974 "pushq 80(%%rax)\n\t" \
1975 "pushq 72(%%rax)\n\t" \
1976 "pushq 64(%%rax)\n\t" \
1977 "pushq 56(%%rax)\n\t" \
1978 "movq 48(%%rax), %%r9\n\t" \
1979 "movq 40(%%rax), %%r8\n\t" \
1980 "movq 32(%%rax), %%rcx\n\t" \
1981 "movq 24(%%rax), %%rdx\n\t" \
1982 "movq 16(%%rax), %%rsi\n\t" \
1983 "movq 8(%%rax), %%rdi\n\t" \
1984 "movq (%%rax), %%rax\n\t" \
1985 VALGRIND_CALL_NOREDIR_RAX \
1986 VALGRIND_RESTORE_STACK \
1987 VALGRIND_CFI_EPILOGUE \
1989 : "a" (&_argvec[0]) __FRAME_POINTER \
1990 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1992 lval = (__typeof__(lval)) _res; \
1995#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1996 arg7,arg8,arg9,arg10,arg11) \
1998 volatile OrigFn _orig = (orig); \
1999 volatile unsigned long _argvec[12]; \
2000 volatile unsigned long _res; \
2001 _argvec[0] = (unsigned long)_orig.nraddr; \
2002 _argvec[1] = (unsigned long)(arg1); \
2003 _argvec[2] = (unsigned long)(arg2); \
2004 _argvec[3] = (unsigned long)(arg3); \
2005 _argvec[4] = (unsigned long)(arg4); \
2006 _argvec[5] = (unsigned long)(arg5); \
2007 _argvec[6] = (unsigned long)(arg6); \
2008 _argvec[7] = (unsigned long)(arg7); \
2009 _argvec[8] = (unsigned long)(arg8); \
2010 _argvec[9] = (unsigned long)(arg9); \
2011 _argvec[10] = (unsigned long)(arg10); \
2012 _argvec[11] = (unsigned long)(arg11); \
2014 VALGRIND_CFI_PROLOGUE \
2015 VALGRIND_ALIGN_STACK \
2016 "subq $136,%%rsp\n\t" \
2017 "pushq 88(%%rax)\n\t" \
2018 "pushq 80(%%rax)\n\t" \
2019 "pushq 72(%%rax)\n\t" \
2020 "pushq 64(%%rax)\n\t" \
2021 "pushq 56(%%rax)\n\t" \
2022 "movq 48(%%rax), %%r9\n\t" \
2023 "movq 40(%%rax), %%r8\n\t" \
2024 "movq 32(%%rax), %%rcx\n\t" \
2025 "movq 24(%%rax), %%rdx\n\t" \
2026 "movq 16(%%rax), %%rsi\n\t" \
2027 "movq 8(%%rax), %%rdi\n\t" \
2028 "movq (%%rax), %%rax\n\t" \
2029 VALGRIND_CALL_NOREDIR_RAX \
2030 VALGRIND_RESTORE_STACK \
2031 VALGRIND_CFI_EPILOGUE \
2033 : "a" (&_argvec[0]) __FRAME_POINTER \
2034 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
2036 lval = (__typeof__(lval)) _res; \
2039#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2040 arg7,arg8,arg9,arg10,arg11,arg12) \
2042 volatile OrigFn _orig = (orig); \
2043 volatile unsigned long _argvec[13]; \
2044 volatile unsigned long _res; \
2045 _argvec[0] = (unsigned long)_orig.nraddr; \
2046 _argvec[1] = (unsigned long)(arg1); \
2047 _argvec[2] = (unsigned long)(arg2); \
2048 _argvec[3] = (unsigned long)(arg3); \
2049 _argvec[4] = (unsigned long)(arg4); \
2050 _argvec[5] = (unsigned long)(arg5); \
2051 _argvec[6] = (unsigned long)(arg6); \
2052 _argvec[7] = (unsigned long)(arg7); \
2053 _argvec[8] = (unsigned long)(arg8); \
2054 _argvec[9] = (unsigned long)(arg9); \
2055 _argvec[10] = (unsigned long)(arg10); \
2056 _argvec[11] = (unsigned long)(arg11); \
2057 _argvec[12] = (unsigned long)(arg12); \
2059 VALGRIND_CFI_PROLOGUE \
2060 VALGRIND_ALIGN_STACK \
2061 "subq $128,%%rsp\n\t" \
2062 "pushq 96(%%rax)\n\t" \
2063 "pushq 88(%%rax)\n\t" \
2064 "pushq 80(%%rax)\n\t" \
2065 "pushq 72(%%rax)\n\t" \
2066 "pushq 64(%%rax)\n\t" \
2067 "pushq 56(%%rax)\n\t" \
2068 "movq 48(%%rax), %%r9\n\t" \
2069 "movq 40(%%rax), %%r8\n\t" \
2070 "movq 32(%%rax), %%rcx\n\t" \
2071 "movq 24(%%rax), %%rdx\n\t" \
2072 "movq 16(%%rax), %%rsi\n\t" \
2073 "movq 8(%%rax), %%rdi\n\t" \
2074 "movq (%%rax), %%rax\n\t" \
2075 VALGRIND_CALL_NOREDIR_RAX \
2076 VALGRIND_RESTORE_STACK \
2077 VALGRIND_CFI_EPILOGUE \
2079 : "a" (&_argvec[0]) __FRAME_POINTER \
2080 : "cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
2082 lval = (__typeof__(lval)) _res; \
2089#if defined(PLAT_ppc32_linux)
2115#define __CALLER_SAVED_REGS \
2116 "lr", "ctr", "xer", \
2117 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2118 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
2126#define VALGRIND_ALIGN_STACK \
2128 "rlwinm 1,1,0,0,27\n\t"
2129#define VALGRIND_RESTORE_STACK \
2135#define CALL_FN_W_v(lval, orig) \
2137 volatile OrigFn _orig = (orig); \
2138 volatile unsigned long _argvec[1]; \
2139 volatile unsigned long _res; \
2140 _argvec[0] = (unsigned long)_orig.nraddr; \
2142 VALGRIND_ALIGN_STACK \
2144 "lwz 11,0(11)\n\t" \
2145 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2146 VALGRIND_RESTORE_STACK \
2149 : "r" (&_argvec[0]) \
2150 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2152 lval = (__typeof__(lval)) _res; \
2155#define CALL_FN_W_W(lval, orig, arg1) \
2157 volatile OrigFn _orig = (orig); \
2158 volatile unsigned long _argvec[2]; \
2159 volatile unsigned long _res; \
2160 _argvec[0] = (unsigned long)_orig.nraddr; \
2161 _argvec[1] = (unsigned long)arg1; \
2163 VALGRIND_ALIGN_STACK \
2166 "lwz 11,0(11)\n\t" \
2167 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2168 VALGRIND_RESTORE_STACK \
2171 : "r" (&_argvec[0]) \
2172 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2174 lval = (__typeof__(lval)) _res; \
2177#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
2179 volatile OrigFn _orig = (orig); \
2180 volatile unsigned long _argvec[3]; \
2181 volatile unsigned long _res; \
2182 _argvec[0] = (unsigned long)_orig.nraddr; \
2183 _argvec[1] = (unsigned long)arg1; \
2184 _argvec[2] = (unsigned long)arg2; \
2186 VALGRIND_ALIGN_STACK \
2190 "lwz 11,0(11)\n\t" \
2191 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2192 VALGRIND_RESTORE_STACK \
2195 : "r" (&_argvec[0]) \
2196 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2198 lval = (__typeof__(lval)) _res; \
2201#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2203 volatile OrigFn _orig = (orig); \
2204 volatile unsigned long _argvec[4]; \
2205 volatile unsigned long _res; \
2206 _argvec[0] = (unsigned long)_orig.nraddr; \
2207 _argvec[1] = (unsigned long)arg1; \
2208 _argvec[2] = (unsigned long)arg2; \
2209 _argvec[3] = (unsigned long)arg3; \
2211 VALGRIND_ALIGN_STACK \
2215 "lwz 5,12(11)\n\t" \
2216 "lwz 11,0(11)\n\t" \
2217 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2218 VALGRIND_RESTORE_STACK \
2221 : "r" (&_argvec[0]) \
2222 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2224 lval = (__typeof__(lval)) _res; \
2227#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2229 volatile OrigFn _orig = (orig); \
2230 volatile unsigned long _argvec[5]; \
2231 volatile unsigned long _res; \
2232 _argvec[0] = (unsigned long)_orig.nraddr; \
2233 _argvec[1] = (unsigned long)arg1; \
2234 _argvec[2] = (unsigned long)arg2; \
2235 _argvec[3] = (unsigned long)arg3; \
2236 _argvec[4] = (unsigned long)arg4; \
2238 VALGRIND_ALIGN_STACK \
2242 "lwz 5,12(11)\n\t" \
2243 "lwz 6,16(11)\n\t" \
2244 "lwz 11,0(11)\n\t" \
2245 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2246 VALGRIND_RESTORE_STACK \
2249 : "r" (&_argvec[0]) \
2250 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2252 lval = (__typeof__(lval)) _res; \
2255#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2257 volatile OrigFn _orig = (orig); \
2258 volatile unsigned long _argvec[6]; \
2259 volatile unsigned long _res; \
2260 _argvec[0] = (unsigned long)_orig.nraddr; \
2261 _argvec[1] = (unsigned long)arg1; \
2262 _argvec[2] = (unsigned long)arg2; \
2263 _argvec[3] = (unsigned long)arg3; \
2264 _argvec[4] = (unsigned long)arg4; \
2265 _argvec[5] = (unsigned long)arg5; \
2267 VALGRIND_ALIGN_STACK \
2271 "lwz 5,12(11)\n\t" \
2272 "lwz 6,16(11)\n\t" \
2273 "lwz 7,20(11)\n\t" \
2274 "lwz 11,0(11)\n\t" \
2275 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2276 VALGRIND_RESTORE_STACK \
2279 : "r" (&_argvec[0]) \
2280 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2282 lval = (__typeof__(lval)) _res; \
2285#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2287 volatile OrigFn _orig = (orig); \
2288 volatile unsigned long _argvec[7]; \
2289 volatile unsigned long _res; \
2290 _argvec[0] = (unsigned long)_orig.nraddr; \
2291 _argvec[1] = (unsigned long)arg1; \
2292 _argvec[2] = (unsigned long)arg2; \
2293 _argvec[3] = (unsigned long)arg3; \
2294 _argvec[4] = (unsigned long)arg4; \
2295 _argvec[5] = (unsigned long)arg5; \
2296 _argvec[6] = (unsigned long)arg6; \
2298 VALGRIND_ALIGN_STACK \
2302 "lwz 5,12(11)\n\t" \
2303 "lwz 6,16(11)\n\t" \
2304 "lwz 7,20(11)\n\t" \
2305 "lwz 8,24(11)\n\t" \
2306 "lwz 11,0(11)\n\t" \
2307 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2308 VALGRIND_RESTORE_STACK \
2311 : "r" (&_argvec[0]) \
2312 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2314 lval = (__typeof__(lval)) _res; \
2317#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2320 volatile OrigFn _orig = (orig); \
2321 volatile unsigned long _argvec[8]; \
2322 volatile unsigned long _res; \
2323 _argvec[0] = (unsigned long)_orig.nraddr; \
2324 _argvec[1] = (unsigned long)arg1; \
2325 _argvec[2] = (unsigned long)arg2; \
2326 _argvec[3] = (unsigned long)arg3; \
2327 _argvec[4] = (unsigned long)arg4; \
2328 _argvec[5] = (unsigned long)arg5; \
2329 _argvec[6] = (unsigned long)arg6; \
2330 _argvec[7] = (unsigned long)arg7; \
2332 VALGRIND_ALIGN_STACK \
2336 "lwz 5,12(11)\n\t" \
2337 "lwz 6,16(11)\n\t" \
2338 "lwz 7,20(11)\n\t" \
2339 "lwz 8,24(11)\n\t" \
2340 "lwz 9,28(11)\n\t" \
2341 "lwz 11,0(11)\n\t" \
2342 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2343 VALGRIND_RESTORE_STACK \
2346 : "r" (&_argvec[0]) \
2347 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2349 lval = (__typeof__(lval)) _res; \
2352#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2355 volatile OrigFn _orig = (orig); \
2356 volatile unsigned long _argvec[9]; \
2357 volatile unsigned long _res; \
2358 _argvec[0] = (unsigned long)_orig.nraddr; \
2359 _argvec[1] = (unsigned long)arg1; \
2360 _argvec[2] = (unsigned long)arg2; \
2361 _argvec[3] = (unsigned long)arg3; \
2362 _argvec[4] = (unsigned long)arg4; \
2363 _argvec[5] = (unsigned long)arg5; \
2364 _argvec[6] = (unsigned long)arg6; \
2365 _argvec[7] = (unsigned long)arg7; \
2366 _argvec[8] = (unsigned long)arg8; \
2368 VALGRIND_ALIGN_STACK \
2372 "lwz 5,12(11)\n\t" \
2373 "lwz 6,16(11)\n\t" \
2374 "lwz 7,20(11)\n\t" \
2375 "lwz 8,24(11)\n\t" \
2376 "lwz 9,28(11)\n\t" \
2377 "lwz 10,32(11)\n\t" \
2378 "lwz 11,0(11)\n\t" \
2379 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2380 VALGRIND_RESTORE_STACK \
2383 : "r" (&_argvec[0]) \
2384 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2386 lval = (__typeof__(lval)) _res; \
2389#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2392 volatile OrigFn _orig = (orig); \
2393 volatile unsigned long _argvec[10]; \
2394 volatile unsigned long _res; \
2395 _argvec[0] = (unsigned long)_orig.nraddr; \
2396 _argvec[1] = (unsigned long)arg1; \
2397 _argvec[2] = (unsigned long)arg2; \
2398 _argvec[3] = (unsigned long)arg3; \
2399 _argvec[4] = (unsigned long)arg4; \
2400 _argvec[5] = (unsigned long)arg5; \
2401 _argvec[6] = (unsigned long)arg6; \
2402 _argvec[7] = (unsigned long)arg7; \
2403 _argvec[8] = (unsigned long)arg8; \
2404 _argvec[9] = (unsigned long)arg9; \
2406 VALGRIND_ALIGN_STACK \
2408 "addi 1,1,-16\n\t" \
2410 "lwz 3,36(11)\n\t" \
2415 "lwz 5,12(11)\n\t" \
2416 "lwz 6,16(11)\n\t" \
2417 "lwz 7,20(11)\n\t" \
2418 "lwz 8,24(11)\n\t" \
2419 "lwz 9,28(11)\n\t" \
2420 "lwz 10,32(11)\n\t" \
2421 "lwz 11,0(11)\n\t" \
2422 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2423 VALGRIND_RESTORE_STACK \
2426 : "r" (&_argvec[0]) \
2427 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2429 lval = (__typeof__(lval)) _res; \
2432#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2433 arg7,arg8,arg9,arg10) \
2435 volatile OrigFn _orig = (orig); \
2436 volatile unsigned long _argvec[11]; \
2437 volatile unsigned long _res; \
2438 _argvec[0] = (unsigned long)_orig.nraddr; \
2439 _argvec[1] = (unsigned long)arg1; \
2440 _argvec[2] = (unsigned long)arg2; \
2441 _argvec[3] = (unsigned long)arg3; \
2442 _argvec[4] = (unsigned long)arg4; \
2443 _argvec[5] = (unsigned long)arg5; \
2444 _argvec[6] = (unsigned long)arg6; \
2445 _argvec[7] = (unsigned long)arg7; \
2446 _argvec[8] = (unsigned long)arg8; \
2447 _argvec[9] = (unsigned long)arg9; \
2448 _argvec[10] = (unsigned long)arg10; \
2450 VALGRIND_ALIGN_STACK \
2452 "addi 1,1,-16\n\t" \
2454 "lwz 3,40(11)\n\t" \
2457 "lwz 3,36(11)\n\t" \
2462 "lwz 5,12(11)\n\t" \
2463 "lwz 6,16(11)\n\t" \
2464 "lwz 7,20(11)\n\t" \
2465 "lwz 8,24(11)\n\t" \
2466 "lwz 9,28(11)\n\t" \
2467 "lwz 10,32(11)\n\t" \
2468 "lwz 11,0(11)\n\t" \
2469 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2470 VALGRIND_RESTORE_STACK \
2473 : "r" (&_argvec[0]) \
2474 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2476 lval = (__typeof__(lval)) _res; \
2479#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2480 arg7,arg8,arg9,arg10,arg11) \
2482 volatile OrigFn _orig = (orig); \
2483 volatile unsigned long _argvec[12]; \
2484 volatile unsigned long _res; \
2485 _argvec[0] = (unsigned long)_orig.nraddr; \
2486 _argvec[1] = (unsigned long)arg1; \
2487 _argvec[2] = (unsigned long)arg2; \
2488 _argvec[3] = (unsigned long)arg3; \
2489 _argvec[4] = (unsigned long)arg4; \
2490 _argvec[5] = (unsigned long)arg5; \
2491 _argvec[6] = (unsigned long)arg6; \
2492 _argvec[7] = (unsigned long)arg7; \
2493 _argvec[8] = (unsigned long)arg8; \
2494 _argvec[9] = (unsigned long)arg9; \
2495 _argvec[10] = (unsigned long)arg10; \
2496 _argvec[11] = (unsigned long)arg11; \
2498 VALGRIND_ALIGN_STACK \
2500 "addi 1,1,-32\n\t" \
2502 "lwz 3,44(11)\n\t" \
2505 "lwz 3,40(11)\n\t" \
2508 "lwz 3,36(11)\n\t" \
2513 "lwz 5,12(11)\n\t" \
2514 "lwz 6,16(11)\n\t" \
2515 "lwz 7,20(11)\n\t" \
2516 "lwz 8,24(11)\n\t" \
2517 "lwz 9,28(11)\n\t" \
2518 "lwz 10,32(11)\n\t" \
2519 "lwz 11,0(11)\n\t" \
2520 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2521 VALGRIND_RESTORE_STACK \
2524 : "r" (&_argvec[0]) \
2525 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2527 lval = (__typeof__(lval)) _res; \
2530#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2531 arg7,arg8,arg9,arg10,arg11,arg12) \
2533 volatile OrigFn _orig = (orig); \
2534 volatile unsigned long _argvec[13]; \
2535 volatile unsigned long _res; \
2536 _argvec[0] = (unsigned long)_orig.nraddr; \
2537 _argvec[1] = (unsigned long)arg1; \
2538 _argvec[2] = (unsigned long)arg2; \
2539 _argvec[3] = (unsigned long)arg3; \
2540 _argvec[4] = (unsigned long)arg4; \
2541 _argvec[5] = (unsigned long)arg5; \
2542 _argvec[6] = (unsigned long)arg6; \
2543 _argvec[7] = (unsigned long)arg7; \
2544 _argvec[8] = (unsigned long)arg8; \
2545 _argvec[9] = (unsigned long)arg9; \
2546 _argvec[10] = (unsigned long)arg10; \
2547 _argvec[11] = (unsigned long)arg11; \
2548 _argvec[12] = (unsigned long)arg12; \
2550 VALGRIND_ALIGN_STACK \
2552 "addi 1,1,-32\n\t" \
2554 "lwz 3,48(11)\n\t" \
2557 "lwz 3,44(11)\n\t" \
2560 "lwz 3,40(11)\n\t" \
2563 "lwz 3,36(11)\n\t" \
2568 "lwz 5,12(11)\n\t" \
2569 "lwz 6,16(11)\n\t" \
2570 "lwz 7,20(11)\n\t" \
2571 "lwz 8,24(11)\n\t" \
2572 "lwz 9,28(11)\n\t" \
2573 "lwz 10,32(11)\n\t" \
2574 "lwz 11,0(11)\n\t" \
2575 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2576 VALGRIND_RESTORE_STACK \
2579 : "r" (&_argvec[0]) \
2580 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2582 lval = (__typeof__(lval)) _res; \
2589#if defined(PLAT_ppc64be_linux)
2594#define __CALLER_SAVED_REGS \
2595 "lr", "ctr", "xer", \
2596 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2597 "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
2605#define VALGRIND_ALIGN_STACK \
2607 "rldicr 1,1,0,59\n\t"
2608#define VALGRIND_RESTORE_STACK \
2614#define CALL_FN_W_v(lval, orig) \
2616 volatile OrigFn _orig = (orig); \
2617 volatile unsigned long _argvec[3+0]; \
2618 volatile unsigned long _res; \
2620 _argvec[1] = (unsigned long)_orig.r2; \
2621 _argvec[2] = (unsigned long)_orig.nraddr; \
2623 VALGRIND_ALIGN_STACK \
2625 "std 2,-16(11)\n\t" \
2627 "ld 11, 0(11)\n\t" \
2628 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2631 "ld 2,-16(11)\n\t" \
2632 VALGRIND_RESTORE_STACK \
2634 : "r" (&_argvec[2]) \
2635 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2637 lval = (__typeof__(lval)) _res; \
2640#define CALL_FN_W_W(lval, orig, arg1) \
2642 volatile OrigFn _orig = (orig); \
2643 volatile unsigned long _argvec[3+1]; \
2644 volatile unsigned long _res; \
2646 _argvec[1] = (unsigned long)_orig.r2; \
2647 _argvec[2] = (unsigned long)_orig.nraddr; \
2648 _argvec[2+1] = (unsigned long)arg1; \
2650 VALGRIND_ALIGN_STACK \
2652 "std 2,-16(11)\n\t" \
2655 "ld 11, 0(11)\n\t" \
2656 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2659 "ld 2,-16(11)\n\t" \
2660 VALGRIND_RESTORE_STACK \
2662 : "r" (&_argvec[2]) \
2663 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2665 lval = (__typeof__(lval)) _res; \
2668#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
2670 volatile OrigFn _orig = (orig); \
2671 volatile unsigned long _argvec[3+2]; \
2672 volatile unsigned long _res; \
2674 _argvec[1] = (unsigned long)_orig.r2; \
2675 _argvec[2] = (unsigned long)_orig.nraddr; \
2676 _argvec[2+1] = (unsigned long)arg1; \
2677 _argvec[2+2] = (unsigned long)arg2; \
2679 VALGRIND_ALIGN_STACK \
2681 "std 2,-16(11)\n\t" \
2684 "ld 4, 16(11)\n\t" \
2685 "ld 11, 0(11)\n\t" \
2686 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2689 "ld 2,-16(11)\n\t" \
2690 VALGRIND_RESTORE_STACK \
2692 : "r" (&_argvec[2]) \
2693 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2695 lval = (__typeof__(lval)) _res; \
2698#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2700 volatile OrigFn _orig = (orig); \
2701 volatile unsigned long _argvec[3+3]; \
2702 volatile unsigned long _res; \
2704 _argvec[1] = (unsigned long)_orig.r2; \
2705 _argvec[2] = (unsigned long)_orig.nraddr; \
2706 _argvec[2+1] = (unsigned long)arg1; \
2707 _argvec[2+2] = (unsigned long)arg2; \
2708 _argvec[2+3] = (unsigned long)arg3; \
2710 VALGRIND_ALIGN_STACK \
2712 "std 2,-16(11)\n\t" \
2715 "ld 4, 16(11)\n\t" \
2716 "ld 5, 24(11)\n\t" \
2717 "ld 11, 0(11)\n\t" \
2718 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2721 "ld 2,-16(11)\n\t" \
2722 VALGRIND_RESTORE_STACK \
2724 : "r" (&_argvec[2]) \
2725 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2727 lval = (__typeof__(lval)) _res; \
2730#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2732 volatile OrigFn _orig = (orig); \
2733 volatile unsigned long _argvec[3+4]; \
2734 volatile unsigned long _res; \
2736 _argvec[1] = (unsigned long)_orig.r2; \
2737 _argvec[2] = (unsigned long)_orig.nraddr; \
2738 _argvec[2+1] = (unsigned long)arg1; \
2739 _argvec[2+2] = (unsigned long)arg2; \
2740 _argvec[2+3] = (unsigned long)arg3; \
2741 _argvec[2+4] = (unsigned long)arg4; \
2743 VALGRIND_ALIGN_STACK \
2745 "std 2,-16(11)\n\t" \
2748 "ld 4, 16(11)\n\t" \
2749 "ld 5, 24(11)\n\t" \
2750 "ld 6, 32(11)\n\t" \
2751 "ld 11, 0(11)\n\t" \
2752 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2755 "ld 2,-16(11)\n\t" \
2756 VALGRIND_RESTORE_STACK \
2758 : "r" (&_argvec[2]) \
2759 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2761 lval = (__typeof__(lval)) _res; \
2764#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2766 volatile OrigFn _orig = (orig); \
2767 volatile unsigned long _argvec[3+5]; \
2768 volatile unsigned long _res; \
2770 _argvec[1] = (unsigned long)_orig.r2; \
2771 _argvec[2] = (unsigned long)_orig.nraddr; \
2772 _argvec[2+1] = (unsigned long)arg1; \
2773 _argvec[2+2] = (unsigned long)arg2; \
2774 _argvec[2+3] = (unsigned long)arg3; \
2775 _argvec[2+4] = (unsigned long)arg4; \
2776 _argvec[2+5] = (unsigned long)arg5; \
2778 VALGRIND_ALIGN_STACK \
2780 "std 2,-16(11)\n\t" \
2783 "ld 4, 16(11)\n\t" \
2784 "ld 5, 24(11)\n\t" \
2785 "ld 6, 32(11)\n\t" \
2786 "ld 7, 40(11)\n\t" \
2787 "ld 11, 0(11)\n\t" \
2788 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2791 "ld 2,-16(11)\n\t" \
2792 VALGRIND_RESTORE_STACK \
2794 : "r" (&_argvec[2]) \
2795 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2797 lval = (__typeof__(lval)) _res; \
2800#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2802 volatile OrigFn _orig = (orig); \
2803 volatile unsigned long _argvec[3+6]; \
2804 volatile unsigned long _res; \
2806 _argvec[1] = (unsigned long)_orig.r2; \
2807 _argvec[2] = (unsigned long)_orig.nraddr; \
2808 _argvec[2+1] = (unsigned long)arg1; \
2809 _argvec[2+2] = (unsigned long)arg2; \
2810 _argvec[2+3] = (unsigned long)arg3; \
2811 _argvec[2+4] = (unsigned long)arg4; \
2812 _argvec[2+5] = (unsigned long)arg5; \
2813 _argvec[2+6] = (unsigned long)arg6; \
2815 VALGRIND_ALIGN_STACK \
2817 "std 2,-16(11)\n\t" \
2820 "ld 4, 16(11)\n\t" \
2821 "ld 5, 24(11)\n\t" \
2822 "ld 6, 32(11)\n\t" \
2823 "ld 7, 40(11)\n\t" \
2824 "ld 8, 48(11)\n\t" \
2825 "ld 11, 0(11)\n\t" \
2826 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2829 "ld 2,-16(11)\n\t" \
2830 VALGRIND_RESTORE_STACK \
2832 : "r" (&_argvec[2]) \
2833 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2835 lval = (__typeof__(lval)) _res; \
2838#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2841 volatile OrigFn _orig = (orig); \
2842 volatile unsigned long _argvec[3+7]; \
2843 volatile unsigned long _res; \
2845 _argvec[1] = (unsigned long)_orig.r2; \
2846 _argvec[2] = (unsigned long)_orig.nraddr; \
2847 _argvec[2+1] = (unsigned long)arg1; \
2848 _argvec[2+2] = (unsigned long)arg2; \
2849 _argvec[2+3] = (unsigned long)arg3; \
2850 _argvec[2+4] = (unsigned long)arg4; \
2851 _argvec[2+5] = (unsigned long)arg5; \
2852 _argvec[2+6] = (unsigned long)arg6; \
2853 _argvec[2+7] = (unsigned long)arg7; \
2855 VALGRIND_ALIGN_STACK \
2857 "std 2,-16(11)\n\t" \
2860 "ld 4, 16(11)\n\t" \
2861 "ld 5, 24(11)\n\t" \
2862 "ld 6, 32(11)\n\t" \
2863 "ld 7, 40(11)\n\t" \
2864 "ld 8, 48(11)\n\t" \
2865 "ld 9, 56(11)\n\t" \
2866 "ld 11, 0(11)\n\t" \
2867 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2870 "ld 2,-16(11)\n\t" \
2871 VALGRIND_RESTORE_STACK \
2873 : "r" (&_argvec[2]) \
2874 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2876 lval = (__typeof__(lval)) _res; \
2879#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2882 volatile OrigFn _orig = (orig); \
2883 volatile unsigned long _argvec[3+8]; \
2884 volatile unsigned long _res; \
2886 _argvec[1] = (unsigned long)_orig.r2; \
2887 _argvec[2] = (unsigned long)_orig.nraddr; \
2888 _argvec[2+1] = (unsigned long)arg1; \
2889 _argvec[2+2] = (unsigned long)arg2; \
2890 _argvec[2+3] = (unsigned long)arg3; \
2891 _argvec[2+4] = (unsigned long)arg4; \
2892 _argvec[2+5] = (unsigned long)arg5; \
2893 _argvec[2+6] = (unsigned long)arg6; \
2894 _argvec[2+7] = (unsigned long)arg7; \
2895 _argvec[2+8] = (unsigned long)arg8; \
2897 VALGRIND_ALIGN_STACK \
2899 "std 2,-16(11)\n\t" \
2902 "ld 4, 16(11)\n\t" \
2903 "ld 5, 24(11)\n\t" \
2904 "ld 6, 32(11)\n\t" \
2905 "ld 7, 40(11)\n\t" \
2906 "ld 8, 48(11)\n\t" \
2907 "ld 9, 56(11)\n\t" \
2908 "ld 10, 64(11)\n\t" \
2909 "ld 11, 0(11)\n\t" \
2910 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2913 "ld 2,-16(11)\n\t" \
2914 VALGRIND_RESTORE_STACK \
2916 : "r" (&_argvec[2]) \
2917 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2919 lval = (__typeof__(lval)) _res; \
2922#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2925 volatile OrigFn _orig = (orig); \
2926 volatile unsigned long _argvec[3+9]; \
2927 volatile unsigned long _res; \
2929 _argvec[1] = (unsigned long)_orig.r2; \
2930 _argvec[2] = (unsigned long)_orig.nraddr; \
2931 _argvec[2+1] = (unsigned long)arg1; \
2932 _argvec[2+2] = (unsigned long)arg2; \
2933 _argvec[2+3] = (unsigned long)arg3; \
2934 _argvec[2+4] = (unsigned long)arg4; \
2935 _argvec[2+5] = (unsigned long)arg5; \
2936 _argvec[2+6] = (unsigned long)arg6; \
2937 _argvec[2+7] = (unsigned long)arg7; \
2938 _argvec[2+8] = (unsigned long)arg8; \
2939 _argvec[2+9] = (unsigned long)arg9; \
2941 VALGRIND_ALIGN_STACK \
2943 "std 2,-16(11)\n\t" \
2945 "addi 1,1,-128\n\t" \
2948 "std 3,112(1)\n\t" \
2951 "ld 4, 16(11)\n\t" \
2952 "ld 5, 24(11)\n\t" \
2953 "ld 6, 32(11)\n\t" \
2954 "ld 7, 40(11)\n\t" \
2955 "ld 8, 48(11)\n\t" \
2956 "ld 9, 56(11)\n\t" \
2957 "ld 10, 64(11)\n\t" \
2958 "ld 11, 0(11)\n\t" \
2959 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2962 "ld 2,-16(11)\n\t" \
2963 VALGRIND_RESTORE_STACK \
2965 : "r" (&_argvec[2]) \
2966 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
2968 lval = (__typeof__(lval)) _res; \
2971#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2972 arg7,arg8,arg9,arg10) \
2974 volatile OrigFn _orig = (orig); \
2975 volatile unsigned long _argvec[3+10]; \
2976 volatile unsigned long _res; \
2978 _argvec[1] = (unsigned long)_orig.r2; \
2979 _argvec[2] = (unsigned long)_orig.nraddr; \
2980 _argvec[2+1] = (unsigned long)arg1; \
2981 _argvec[2+2] = (unsigned long)arg2; \
2982 _argvec[2+3] = (unsigned long)arg3; \
2983 _argvec[2+4] = (unsigned long)arg4; \
2984 _argvec[2+5] = (unsigned long)arg5; \
2985 _argvec[2+6] = (unsigned long)arg6; \
2986 _argvec[2+7] = (unsigned long)arg7; \
2987 _argvec[2+8] = (unsigned long)arg8; \
2988 _argvec[2+9] = (unsigned long)arg9; \
2989 _argvec[2+10] = (unsigned long)arg10; \
2991 VALGRIND_ALIGN_STACK \
2993 "std 2,-16(11)\n\t" \
2995 "addi 1,1,-128\n\t" \
2998 "std 3,120(1)\n\t" \
3001 "std 3,112(1)\n\t" \
3004 "ld 4, 16(11)\n\t" \
3005 "ld 5, 24(11)\n\t" \
3006 "ld 6, 32(11)\n\t" \
3007 "ld 7, 40(11)\n\t" \
3008 "ld 8, 48(11)\n\t" \
3009 "ld 9, 56(11)\n\t" \
3010 "ld 10, 64(11)\n\t" \
3011 "ld 11, 0(11)\n\t" \
3012 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3015 "ld 2,-16(11)\n\t" \
3016 VALGRIND_RESTORE_STACK \
3018 : "r" (&_argvec[2]) \
3019 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3021 lval = (__typeof__(lval)) _res; \
3024#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3025 arg7,arg8,arg9,arg10,arg11) \
3027 volatile OrigFn _orig = (orig); \
3028 volatile unsigned long _argvec[3+11]; \
3029 volatile unsigned long _res; \
3031 _argvec[1] = (unsigned long)_orig.r2; \
3032 _argvec[2] = (unsigned long)_orig.nraddr; \
3033 _argvec[2+1] = (unsigned long)arg1; \
3034 _argvec[2+2] = (unsigned long)arg2; \
3035 _argvec[2+3] = (unsigned long)arg3; \
3036 _argvec[2+4] = (unsigned long)arg4; \
3037 _argvec[2+5] = (unsigned long)arg5; \
3038 _argvec[2+6] = (unsigned long)arg6; \
3039 _argvec[2+7] = (unsigned long)arg7; \
3040 _argvec[2+8] = (unsigned long)arg8; \
3041 _argvec[2+9] = (unsigned long)arg9; \
3042 _argvec[2+10] = (unsigned long)arg10; \
3043 _argvec[2+11] = (unsigned long)arg11; \
3045 VALGRIND_ALIGN_STACK \
3047 "std 2,-16(11)\n\t" \
3049 "addi 1,1,-144\n\t" \
3052 "std 3,128(1)\n\t" \
3055 "std 3,120(1)\n\t" \
3058 "std 3,112(1)\n\t" \
3061 "ld 4, 16(11)\n\t" \
3062 "ld 5, 24(11)\n\t" \
3063 "ld 6, 32(11)\n\t" \
3064 "ld 7, 40(11)\n\t" \
3065 "ld 8, 48(11)\n\t" \
3066 "ld 9, 56(11)\n\t" \
3067 "ld 10, 64(11)\n\t" \
3068 "ld 11, 0(11)\n\t" \
3069 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3072 "ld 2,-16(11)\n\t" \
3073 VALGRIND_RESTORE_STACK \
3075 : "r" (&_argvec[2]) \
3076 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3078 lval = (__typeof__(lval)) _res; \
3081#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3082 arg7,arg8,arg9,arg10,arg11,arg12) \
3084 volatile OrigFn _orig = (orig); \
3085 volatile unsigned long _argvec[3+12]; \
3086 volatile unsigned long _res; \
3088 _argvec[1] = (unsigned long)_orig.r2; \
3089 _argvec[2] = (unsigned long)_orig.nraddr; \
3090 _argvec[2+1] = (unsigned long)arg1; \
3091 _argvec[2+2] = (unsigned long)arg2; \
3092 _argvec[2+3] = (unsigned long)arg3; \
3093 _argvec[2+4] = (unsigned long)arg4; \
3094 _argvec[2+5] = (unsigned long)arg5; \
3095 _argvec[2+6] = (unsigned long)arg6; \
3096 _argvec[2+7] = (unsigned long)arg7; \
3097 _argvec[2+8] = (unsigned long)arg8; \
3098 _argvec[2+9] = (unsigned long)arg9; \
3099 _argvec[2+10] = (unsigned long)arg10; \
3100 _argvec[2+11] = (unsigned long)arg11; \
3101 _argvec[2+12] = (unsigned long)arg12; \
3103 VALGRIND_ALIGN_STACK \
3105 "std 2,-16(11)\n\t" \
3107 "addi 1,1,-144\n\t" \
3110 "std 3,136(1)\n\t" \
3113 "std 3,128(1)\n\t" \
3116 "std 3,120(1)\n\t" \
3119 "std 3,112(1)\n\t" \
3122 "ld 4, 16(11)\n\t" \
3123 "ld 5, 24(11)\n\t" \
3124 "ld 6, 32(11)\n\t" \
3125 "ld 7, 40(11)\n\t" \
3126 "ld 8, 48(11)\n\t" \
3127 "ld 9, 56(11)\n\t" \
3128 "ld 10, 64(11)\n\t" \
3129 "ld 11, 0(11)\n\t" \
3130 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3133 "ld 2,-16(11)\n\t" \
3134 VALGRIND_RESTORE_STACK \
3136 : "r" (&_argvec[2]) \
3137 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3139 lval = (__typeof__(lval)) _res; \
3145#if defined(PLAT_ppc64le_linux)
3150#define __CALLER_SAVED_REGS \
3151 "lr", "ctr", "xer", \
3152 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
3153 "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
3161#define VALGRIND_ALIGN_STACK \
3163 "rldicr 1,1,0,59\n\t"
3164#define VALGRIND_RESTORE_STACK \
3170#define CALL_FN_W_v(lval, orig) \
3172 volatile OrigFn _orig = (orig); \
3173 volatile unsigned long _argvec[3+0]; \
3174 volatile unsigned long _res; \
3176 _argvec[1] = (unsigned long)_orig.r2; \
3177 _argvec[2] = (unsigned long)_orig.nraddr; \
3179 VALGRIND_ALIGN_STACK \
3181 "std 2,-16(12)\n\t" \
3183 "ld 12, 0(12)\n\t" \
3184 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3187 "ld 2,-16(12)\n\t" \
3188 VALGRIND_RESTORE_STACK \
3190 : "r" (&_argvec[2]) \
3191 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3193 lval = (__typeof__(lval)) _res; \
3196#define CALL_FN_W_W(lval, orig, arg1) \
3198 volatile OrigFn _orig = (orig); \
3199 volatile unsigned long _argvec[3+1]; \
3200 volatile unsigned long _res; \
3202 _argvec[1] = (unsigned long)_orig.r2; \
3203 _argvec[2] = (unsigned long)_orig.nraddr; \
3204 _argvec[2+1] = (unsigned long)arg1; \
3206 VALGRIND_ALIGN_STACK \
3208 "std 2,-16(12)\n\t" \
3211 "ld 12, 0(12)\n\t" \
3212 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3215 "ld 2,-16(12)\n\t" \
3216 VALGRIND_RESTORE_STACK \
3218 : "r" (&_argvec[2]) \
3219 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3221 lval = (__typeof__(lval)) _res; \
3224#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
3226 volatile OrigFn _orig = (orig); \
3227 volatile unsigned long _argvec[3+2]; \
3228 volatile unsigned long _res; \
3230 _argvec[1] = (unsigned long)_orig.r2; \
3231 _argvec[2] = (unsigned long)_orig.nraddr; \
3232 _argvec[2+1] = (unsigned long)arg1; \
3233 _argvec[2+2] = (unsigned long)arg2; \
3235 VALGRIND_ALIGN_STACK \
3237 "std 2,-16(12)\n\t" \
3240 "ld 4, 16(12)\n\t" \
3241 "ld 12, 0(12)\n\t" \
3242 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3245 "ld 2,-16(12)\n\t" \
3246 VALGRIND_RESTORE_STACK \
3248 : "r" (&_argvec[2]) \
3249 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3251 lval = (__typeof__(lval)) _res; \
3254#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
3256 volatile OrigFn _orig = (orig); \
3257 volatile unsigned long _argvec[3+3]; \
3258 volatile unsigned long _res; \
3260 _argvec[1] = (unsigned long)_orig.r2; \
3261 _argvec[2] = (unsigned long)_orig.nraddr; \
3262 _argvec[2+1] = (unsigned long)arg1; \
3263 _argvec[2+2] = (unsigned long)arg2; \
3264 _argvec[2+3] = (unsigned long)arg3; \
3266 VALGRIND_ALIGN_STACK \
3268 "std 2,-16(12)\n\t" \
3271 "ld 4, 16(12)\n\t" \
3272 "ld 5, 24(12)\n\t" \
3273 "ld 12, 0(12)\n\t" \
3274 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3277 "ld 2,-16(12)\n\t" \
3278 VALGRIND_RESTORE_STACK \
3280 : "r" (&_argvec[2]) \
3281 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3283 lval = (__typeof__(lval)) _res; \
3286#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
3288 volatile OrigFn _orig = (orig); \
3289 volatile unsigned long _argvec[3+4]; \
3290 volatile unsigned long _res; \
3292 _argvec[1] = (unsigned long)_orig.r2; \
3293 _argvec[2] = (unsigned long)_orig.nraddr; \
3294 _argvec[2+1] = (unsigned long)arg1; \
3295 _argvec[2+2] = (unsigned long)arg2; \
3296 _argvec[2+3] = (unsigned long)arg3; \
3297 _argvec[2+4] = (unsigned long)arg4; \
3299 VALGRIND_ALIGN_STACK \
3301 "std 2,-16(12)\n\t" \
3304 "ld 4, 16(12)\n\t" \
3305 "ld 5, 24(12)\n\t" \
3306 "ld 6, 32(12)\n\t" \
3307 "ld 12, 0(12)\n\t" \
3308 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3311 "ld 2,-16(12)\n\t" \
3312 VALGRIND_RESTORE_STACK \
3314 : "r" (&_argvec[2]) \
3315 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3317 lval = (__typeof__(lval)) _res; \
3320#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
3322 volatile OrigFn _orig = (orig); \
3323 volatile unsigned long _argvec[3+5]; \
3324 volatile unsigned long _res; \
3326 _argvec[1] = (unsigned long)_orig.r2; \
3327 _argvec[2] = (unsigned long)_orig.nraddr; \
3328 _argvec[2+1] = (unsigned long)arg1; \
3329 _argvec[2+2] = (unsigned long)arg2; \
3330 _argvec[2+3] = (unsigned long)arg3; \
3331 _argvec[2+4] = (unsigned long)arg4; \
3332 _argvec[2+5] = (unsigned long)arg5; \
3334 VALGRIND_ALIGN_STACK \
3336 "std 2,-16(12)\n\t" \
3339 "ld 4, 16(12)\n\t" \
3340 "ld 5, 24(12)\n\t" \
3341 "ld 6, 32(12)\n\t" \
3342 "ld 7, 40(12)\n\t" \
3343 "ld 12, 0(12)\n\t" \
3344 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3347 "ld 2,-16(12)\n\t" \
3348 VALGRIND_RESTORE_STACK \
3350 : "r" (&_argvec[2]) \
3351 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3353 lval = (__typeof__(lval)) _res; \
3356#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
3358 volatile OrigFn _orig = (orig); \
3359 volatile unsigned long _argvec[3+6]; \
3360 volatile unsigned long _res; \
3362 _argvec[1] = (unsigned long)_orig.r2; \
3363 _argvec[2] = (unsigned long)_orig.nraddr; \
3364 _argvec[2+1] = (unsigned long)arg1; \
3365 _argvec[2+2] = (unsigned long)arg2; \
3366 _argvec[2+3] = (unsigned long)arg3; \
3367 _argvec[2+4] = (unsigned long)arg4; \
3368 _argvec[2+5] = (unsigned long)arg5; \
3369 _argvec[2+6] = (unsigned long)arg6; \
3371 VALGRIND_ALIGN_STACK \
3373 "std 2,-16(12)\n\t" \
3376 "ld 4, 16(12)\n\t" \
3377 "ld 5, 24(12)\n\t" \
3378 "ld 6, 32(12)\n\t" \
3379 "ld 7, 40(12)\n\t" \
3380 "ld 8, 48(12)\n\t" \
3381 "ld 12, 0(12)\n\t" \
3382 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3385 "ld 2,-16(12)\n\t" \
3386 VALGRIND_RESTORE_STACK \
3388 : "r" (&_argvec[2]) \
3389 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3391 lval = (__typeof__(lval)) _res; \
3394#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3397 volatile OrigFn _orig = (orig); \
3398 volatile unsigned long _argvec[3+7]; \
3399 volatile unsigned long _res; \
3401 _argvec[1] = (unsigned long)_orig.r2; \
3402 _argvec[2] = (unsigned long)_orig.nraddr; \
3403 _argvec[2+1] = (unsigned long)arg1; \
3404 _argvec[2+2] = (unsigned long)arg2; \
3405 _argvec[2+3] = (unsigned long)arg3; \
3406 _argvec[2+4] = (unsigned long)arg4; \
3407 _argvec[2+5] = (unsigned long)arg5; \
3408 _argvec[2+6] = (unsigned long)arg6; \
3409 _argvec[2+7] = (unsigned long)arg7; \
3411 VALGRIND_ALIGN_STACK \
3413 "std 2,-16(12)\n\t" \
3416 "ld 4, 16(12)\n\t" \
3417 "ld 5, 24(12)\n\t" \
3418 "ld 6, 32(12)\n\t" \
3419 "ld 7, 40(12)\n\t" \
3420 "ld 8, 48(12)\n\t" \
3421 "ld 9, 56(12)\n\t" \
3422 "ld 12, 0(12)\n\t" \
3423 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3426 "ld 2,-16(12)\n\t" \
3427 VALGRIND_RESTORE_STACK \
3429 : "r" (&_argvec[2]) \
3430 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3432 lval = (__typeof__(lval)) _res; \
3435#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3438 volatile OrigFn _orig = (orig); \
3439 volatile unsigned long _argvec[3+8]; \
3440 volatile unsigned long _res; \
3442 _argvec[1] = (unsigned long)_orig.r2; \
3443 _argvec[2] = (unsigned long)_orig.nraddr; \
3444 _argvec[2+1] = (unsigned long)arg1; \
3445 _argvec[2+2] = (unsigned long)arg2; \
3446 _argvec[2+3] = (unsigned long)arg3; \
3447 _argvec[2+4] = (unsigned long)arg4; \
3448 _argvec[2+5] = (unsigned long)arg5; \
3449 _argvec[2+6] = (unsigned long)arg6; \
3450 _argvec[2+7] = (unsigned long)arg7; \
3451 _argvec[2+8] = (unsigned long)arg8; \
3453 VALGRIND_ALIGN_STACK \
3455 "std 2,-16(12)\n\t" \
3458 "ld 4, 16(12)\n\t" \
3459 "ld 5, 24(12)\n\t" \
3460 "ld 6, 32(12)\n\t" \
3461 "ld 7, 40(12)\n\t" \
3462 "ld 8, 48(12)\n\t" \
3463 "ld 9, 56(12)\n\t" \
3464 "ld 10, 64(12)\n\t" \
3465 "ld 12, 0(12)\n\t" \
3466 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3469 "ld 2,-16(12)\n\t" \
3470 VALGRIND_RESTORE_STACK \
3472 : "r" (&_argvec[2]) \
3473 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3475 lval = (__typeof__(lval)) _res; \
3478#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3481 volatile OrigFn _orig = (orig); \
3482 volatile unsigned long _argvec[3+9]; \
3483 volatile unsigned long _res; \
3485 _argvec[1] = (unsigned long)_orig.r2; \
3486 _argvec[2] = (unsigned long)_orig.nraddr; \
3487 _argvec[2+1] = (unsigned long)arg1; \
3488 _argvec[2+2] = (unsigned long)arg2; \
3489 _argvec[2+3] = (unsigned long)arg3; \
3490 _argvec[2+4] = (unsigned long)arg4; \
3491 _argvec[2+5] = (unsigned long)arg5; \
3492 _argvec[2+6] = (unsigned long)arg6; \
3493 _argvec[2+7] = (unsigned long)arg7; \
3494 _argvec[2+8] = (unsigned long)arg8; \
3495 _argvec[2+9] = (unsigned long)arg9; \
3497 VALGRIND_ALIGN_STACK \
3499 "std 2,-16(12)\n\t" \
3501 "addi 1,1,-128\n\t" \
3507 "ld 4, 16(12)\n\t" \
3508 "ld 5, 24(12)\n\t" \
3509 "ld 6, 32(12)\n\t" \
3510 "ld 7, 40(12)\n\t" \
3511 "ld 8, 48(12)\n\t" \
3512 "ld 9, 56(12)\n\t" \
3513 "ld 10, 64(12)\n\t" \
3514 "ld 12, 0(12)\n\t" \
3515 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3518 "ld 2,-16(12)\n\t" \
3519 VALGRIND_RESTORE_STACK \
3521 : "r" (&_argvec[2]) \
3522 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3524 lval = (__typeof__(lval)) _res; \
3527#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3528 arg7,arg8,arg9,arg10) \
3530 volatile OrigFn _orig = (orig); \
3531 volatile unsigned long _argvec[3+10]; \
3532 volatile unsigned long _res; \
3534 _argvec[1] = (unsigned long)_orig.r2; \
3535 _argvec[2] = (unsigned long)_orig.nraddr; \
3536 _argvec[2+1] = (unsigned long)arg1; \
3537 _argvec[2+2] = (unsigned long)arg2; \
3538 _argvec[2+3] = (unsigned long)arg3; \
3539 _argvec[2+4] = (unsigned long)arg4; \
3540 _argvec[2+5] = (unsigned long)arg5; \
3541 _argvec[2+6] = (unsigned long)arg6; \
3542 _argvec[2+7] = (unsigned long)arg7; \
3543 _argvec[2+8] = (unsigned long)arg8; \
3544 _argvec[2+9] = (unsigned long)arg9; \
3545 _argvec[2+10] = (unsigned long)arg10; \
3547 VALGRIND_ALIGN_STACK \
3549 "std 2,-16(12)\n\t" \
3551 "addi 1,1,-128\n\t" \
3554 "std 3,104(1)\n\t" \
3560 "ld 4, 16(12)\n\t" \
3561 "ld 5, 24(12)\n\t" \
3562 "ld 6, 32(12)\n\t" \
3563 "ld 7, 40(12)\n\t" \
3564 "ld 8, 48(12)\n\t" \
3565 "ld 9, 56(12)\n\t" \
3566 "ld 10, 64(12)\n\t" \
3567 "ld 12, 0(12)\n\t" \
3568 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3571 "ld 2,-16(12)\n\t" \
3572 VALGRIND_RESTORE_STACK \
3574 : "r" (&_argvec[2]) \
3575 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3577 lval = (__typeof__(lval)) _res; \
3580#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3581 arg7,arg8,arg9,arg10,arg11) \
3583 volatile OrigFn _orig = (orig); \
3584 volatile unsigned long _argvec[3+11]; \
3585 volatile unsigned long _res; \
3587 _argvec[1] = (unsigned long)_orig.r2; \
3588 _argvec[2] = (unsigned long)_orig.nraddr; \
3589 _argvec[2+1] = (unsigned long)arg1; \
3590 _argvec[2+2] = (unsigned long)arg2; \
3591 _argvec[2+3] = (unsigned long)arg3; \
3592 _argvec[2+4] = (unsigned long)arg4; \
3593 _argvec[2+5] = (unsigned long)arg5; \
3594 _argvec[2+6] = (unsigned long)arg6; \
3595 _argvec[2+7] = (unsigned long)arg7; \
3596 _argvec[2+8] = (unsigned long)arg8; \
3597 _argvec[2+9] = (unsigned long)arg9; \
3598 _argvec[2+10] = (unsigned long)arg10; \
3599 _argvec[2+11] = (unsigned long)arg11; \
3601 VALGRIND_ALIGN_STACK \
3603 "std 2,-16(12)\n\t" \
3605 "addi 1,1,-144\n\t" \
3608 "std 3,112(1)\n\t" \
3611 "std 3,104(1)\n\t" \
3617 "ld 4, 16(12)\n\t" \
3618 "ld 5, 24(12)\n\t" \
3619 "ld 6, 32(12)\n\t" \
3620 "ld 7, 40(12)\n\t" \
3621 "ld 8, 48(12)\n\t" \
3622 "ld 9, 56(12)\n\t" \
3623 "ld 10, 64(12)\n\t" \
3624 "ld 12, 0(12)\n\t" \
3625 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3628 "ld 2,-16(12)\n\t" \
3629 VALGRIND_RESTORE_STACK \
3631 : "r" (&_argvec[2]) \
3632 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3634 lval = (__typeof__(lval)) _res; \
3637#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3638 arg7,arg8,arg9,arg10,arg11,arg12) \
3640 volatile OrigFn _orig = (orig); \
3641 volatile unsigned long _argvec[3+12]; \
3642 volatile unsigned long _res; \
3644 _argvec[1] = (unsigned long)_orig.r2; \
3645 _argvec[2] = (unsigned long)_orig.nraddr; \
3646 _argvec[2+1] = (unsigned long)arg1; \
3647 _argvec[2+2] = (unsigned long)arg2; \
3648 _argvec[2+3] = (unsigned long)arg3; \
3649 _argvec[2+4] = (unsigned long)arg4; \
3650 _argvec[2+5] = (unsigned long)arg5; \
3651 _argvec[2+6] = (unsigned long)arg6; \
3652 _argvec[2+7] = (unsigned long)arg7; \
3653 _argvec[2+8] = (unsigned long)arg8; \
3654 _argvec[2+9] = (unsigned long)arg9; \
3655 _argvec[2+10] = (unsigned long)arg10; \
3656 _argvec[2+11] = (unsigned long)arg11; \
3657 _argvec[2+12] = (unsigned long)arg12; \
3659 VALGRIND_ALIGN_STACK \
3661 "std 2,-16(12)\n\t" \
3663 "addi 1,1,-144\n\t" \
3666 "std 3,120(1)\n\t" \
3669 "std 3,112(1)\n\t" \
3672 "std 3,104(1)\n\t" \
3678 "ld 4, 16(12)\n\t" \
3679 "ld 5, 24(12)\n\t" \
3680 "ld 6, 32(12)\n\t" \
3681 "ld 7, 40(12)\n\t" \
3682 "ld 8, 48(12)\n\t" \
3683 "ld 9, 56(12)\n\t" \
3684 "ld 10, 64(12)\n\t" \
3685 "ld 12, 0(12)\n\t" \
3686 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R12 \
3689 "ld 2,-16(12)\n\t" \
3690 VALGRIND_RESTORE_STACK \
3692 : "r" (&_argvec[2]) \
3693 : "cc", "memory", __CALLER_SAVED_REGS, "r28" \
3695 lval = (__typeof__(lval)) _res; \
3702#if defined(PLAT_arm_linux)
3705#define __CALLER_SAVED_REGS "r0", "r1", "r2", "r3","r4", "r12", "r14"
3720#define VALGRIND_ALIGN_STACK \
3723 "bic r4, r4, #7\n\t" \
3725#define VALGRIND_RESTORE_STACK \
3731#define CALL_FN_W_v(lval, orig) \
3733 volatile OrigFn _orig = (orig); \
3734 volatile unsigned long _argvec[1]; \
3735 volatile unsigned long _res; \
3736 _argvec[0] = (unsigned long)_orig.nraddr; \
3738 VALGRIND_ALIGN_STACK \
3739 "ldr r4, [%1] \n\t" \
3740 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3741 VALGRIND_RESTORE_STACK \
3744 : "0" (&_argvec[0]) \
3745 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3747 lval = (__typeof__(lval)) _res; \
3750#define CALL_FN_W_W(lval, orig, arg1) \
3752 volatile OrigFn _orig = (orig); \
3753 volatile unsigned long _argvec[2]; \
3754 volatile unsigned long _res; \
3755 _argvec[0] = (unsigned long)_orig.nraddr; \
3756 _argvec[1] = (unsigned long)(arg1); \
3758 VALGRIND_ALIGN_STACK \
3759 "ldr r0, [%1, #4] \n\t" \
3760 "ldr r4, [%1] \n\t" \
3761 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3762 VALGRIND_RESTORE_STACK \
3765 : "0" (&_argvec[0]) \
3766 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3768 lval = (__typeof__(lval)) _res; \
3771#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
3773 volatile OrigFn _orig = (orig); \
3774 volatile unsigned long _argvec[3]; \
3775 volatile unsigned long _res; \
3776 _argvec[0] = (unsigned long)_orig.nraddr; \
3777 _argvec[1] = (unsigned long)(arg1); \
3778 _argvec[2] = (unsigned long)(arg2); \
3780 VALGRIND_ALIGN_STACK \
3781 "ldr r0, [%1, #4] \n\t" \
3782 "ldr r1, [%1, #8] \n\t" \
3783 "ldr r4, [%1] \n\t" \
3784 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3785 VALGRIND_RESTORE_STACK \
3788 : "0" (&_argvec[0]) \
3789 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3791 lval = (__typeof__(lval)) _res; \
3794#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
3796 volatile OrigFn _orig = (orig); \
3797 volatile unsigned long _argvec[4]; \
3798 volatile unsigned long _res; \
3799 _argvec[0] = (unsigned long)_orig.nraddr; \
3800 _argvec[1] = (unsigned long)(arg1); \
3801 _argvec[2] = (unsigned long)(arg2); \
3802 _argvec[3] = (unsigned long)(arg3); \
3804 VALGRIND_ALIGN_STACK \
3805 "ldr r0, [%1, #4] \n\t" \
3806 "ldr r1, [%1, #8] \n\t" \
3807 "ldr r2, [%1, #12] \n\t" \
3808 "ldr r4, [%1] \n\t" \
3809 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3810 VALGRIND_RESTORE_STACK \
3813 : "0" (&_argvec[0]) \
3814 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3816 lval = (__typeof__(lval)) _res; \
3819#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
3821 volatile OrigFn _orig = (orig); \
3822 volatile unsigned long _argvec[5]; \
3823 volatile unsigned long _res; \
3824 _argvec[0] = (unsigned long)_orig.nraddr; \
3825 _argvec[1] = (unsigned long)(arg1); \
3826 _argvec[2] = (unsigned long)(arg2); \
3827 _argvec[3] = (unsigned long)(arg3); \
3828 _argvec[4] = (unsigned long)(arg4); \
3830 VALGRIND_ALIGN_STACK \
3831 "ldr r0, [%1, #4] \n\t" \
3832 "ldr r1, [%1, #8] \n\t" \
3833 "ldr r2, [%1, #12] \n\t" \
3834 "ldr r3, [%1, #16] \n\t" \
3835 "ldr r4, [%1] \n\t" \
3836 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3837 VALGRIND_RESTORE_STACK \
3840 : "0" (&_argvec[0]) \
3841 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3843 lval = (__typeof__(lval)) _res; \
3846#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
3848 volatile OrigFn _orig = (orig); \
3849 volatile unsigned long _argvec[6]; \
3850 volatile unsigned long _res; \
3851 _argvec[0] = (unsigned long)_orig.nraddr; \
3852 _argvec[1] = (unsigned long)(arg1); \
3853 _argvec[2] = (unsigned long)(arg2); \
3854 _argvec[3] = (unsigned long)(arg3); \
3855 _argvec[4] = (unsigned long)(arg4); \
3856 _argvec[5] = (unsigned long)(arg5); \
3858 VALGRIND_ALIGN_STACK \
3859 "sub sp, sp, #4 \n\t" \
3860 "ldr r0, [%1, #20] \n\t" \
3862 "ldr r0, [%1, #4] \n\t" \
3863 "ldr r1, [%1, #8] \n\t" \
3864 "ldr r2, [%1, #12] \n\t" \
3865 "ldr r3, [%1, #16] \n\t" \
3866 "ldr r4, [%1] \n\t" \
3867 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3868 VALGRIND_RESTORE_STACK \
3871 : "0" (&_argvec[0]) \
3872 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3874 lval = (__typeof__(lval)) _res; \
3877#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
3879 volatile OrigFn _orig = (orig); \
3880 volatile unsigned long _argvec[7]; \
3881 volatile unsigned long _res; \
3882 _argvec[0] = (unsigned long)_orig.nraddr; \
3883 _argvec[1] = (unsigned long)(arg1); \
3884 _argvec[2] = (unsigned long)(arg2); \
3885 _argvec[3] = (unsigned long)(arg3); \
3886 _argvec[4] = (unsigned long)(arg4); \
3887 _argvec[5] = (unsigned long)(arg5); \
3888 _argvec[6] = (unsigned long)(arg6); \
3890 VALGRIND_ALIGN_STACK \
3891 "ldr r0, [%1, #20] \n\t" \
3892 "ldr r1, [%1, #24] \n\t" \
3893 "push {r0, r1} \n\t" \
3894 "ldr r0, [%1, #4] \n\t" \
3895 "ldr r1, [%1, #8] \n\t" \
3896 "ldr r2, [%1, #12] \n\t" \
3897 "ldr r3, [%1, #16] \n\t" \
3898 "ldr r4, [%1] \n\t" \
3899 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3900 VALGRIND_RESTORE_STACK \
3903 : "0" (&_argvec[0]) \
3904 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3906 lval = (__typeof__(lval)) _res; \
3909#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3912 volatile OrigFn _orig = (orig); \
3913 volatile unsigned long _argvec[8]; \
3914 volatile unsigned long _res; \
3915 _argvec[0] = (unsigned long)_orig.nraddr; \
3916 _argvec[1] = (unsigned long)(arg1); \
3917 _argvec[2] = (unsigned long)(arg2); \
3918 _argvec[3] = (unsigned long)(arg3); \
3919 _argvec[4] = (unsigned long)(arg4); \
3920 _argvec[5] = (unsigned long)(arg5); \
3921 _argvec[6] = (unsigned long)(arg6); \
3922 _argvec[7] = (unsigned long)(arg7); \
3924 VALGRIND_ALIGN_STACK \
3925 "sub sp, sp, #4 \n\t" \
3926 "ldr r0, [%1, #20] \n\t" \
3927 "ldr r1, [%1, #24] \n\t" \
3928 "ldr r2, [%1, #28] \n\t" \
3929 "push {r0, r1, r2} \n\t" \
3930 "ldr r0, [%1, #4] \n\t" \
3931 "ldr r1, [%1, #8] \n\t" \
3932 "ldr r2, [%1, #12] \n\t" \
3933 "ldr r3, [%1, #16] \n\t" \
3934 "ldr r4, [%1] \n\t" \
3935 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3936 VALGRIND_RESTORE_STACK \
3939 : "0" (&_argvec[0]) \
3940 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3942 lval = (__typeof__(lval)) _res; \
3945#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3948 volatile OrigFn _orig = (orig); \
3949 volatile unsigned long _argvec[9]; \
3950 volatile unsigned long _res; \
3951 _argvec[0] = (unsigned long)_orig.nraddr; \
3952 _argvec[1] = (unsigned long)(arg1); \
3953 _argvec[2] = (unsigned long)(arg2); \
3954 _argvec[3] = (unsigned long)(arg3); \
3955 _argvec[4] = (unsigned long)(arg4); \
3956 _argvec[5] = (unsigned long)(arg5); \
3957 _argvec[6] = (unsigned long)(arg6); \
3958 _argvec[7] = (unsigned long)(arg7); \
3959 _argvec[8] = (unsigned long)(arg8); \
3961 VALGRIND_ALIGN_STACK \
3962 "ldr r0, [%1, #20] \n\t" \
3963 "ldr r1, [%1, #24] \n\t" \
3964 "ldr r2, [%1, #28] \n\t" \
3965 "ldr r3, [%1, #32] \n\t" \
3966 "push {r0, r1, r2, r3} \n\t" \
3967 "ldr r0, [%1, #4] \n\t" \
3968 "ldr r1, [%1, #8] \n\t" \
3969 "ldr r2, [%1, #12] \n\t" \
3970 "ldr r3, [%1, #16] \n\t" \
3971 "ldr r4, [%1] \n\t" \
3972 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3973 VALGRIND_RESTORE_STACK \
3976 : "0" (&_argvec[0]) \
3977 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
3979 lval = (__typeof__(lval)) _res; \
3982#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3985 volatile OrigFn _orig = (orig); \
3986 volatile unsigned long _argvec[10]; \
3987 volatile unsigned long _res; \
3988 _argvec[0] = (unsigned long)_orig.nraddr; \
3989 _argvec[1] = (unsigned long)(arg1); \
3990 _argvec[2] = (unsigned long)(arg2); \
3991 _argvec[3] = (unsigned long)(arg3); \
3992 _argvec[4] = (unsigned long)(arg4); \
3993 _argvec[5] = (unsigned long)(arg5); \
3994 _argvec[6] = (unsigned long)(arg6); \
3995 _argvec[7] = (unsigned long)(arg7); \
3996 _argvec[8] = (unsigned long)(arg8); \
3997 _argvec[9] = (unsigned long)(arg9); \
3999 VALGRIND_ALIGN_STACK \
4000 "sub sp, sp, #4 \n\t" \
4001 "ldr r0, [%1, #20] \n\t" \
4002 "ldr r1, [%1, #24] \n\t" \
4003 "ldr r2, [%1, #28] \n\t" \
4004 "ldr r3, [%1, #32] \n\t" \
4005 "ldr r4, [%1, #36] \n\t" \
4006 "push {r0, r1, r2, r3, r4} \n\t" \
4007 "ldr r0, [%1, #4] \n\t" \
4008 "ldr r1, [%1, #8] \n\t" \
4009 "ldr r2, [%1, #12] \n\t" \
4010 "ldr r3, [%1, #16] \n\t" \
4011 "ldr r4, [%1] \n\t" \
4012 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
4013 VALGRIND_RESTORE_STACK \
4016 : "0" (&_argvec[0]) \
4017 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
4019 lval = (__typeof__(lval)) _res; \
4022#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4023 arg7,arg8,arg9,arg10) \
4025 volatile OrigFn _orig = (orig); \
4026 volatile unsigned long _argvec[11]; \
4027 volatile unsigned long _res; \
4028 _argvec[0] = (unsigned long)_orig.nraddr; \
4029 _argvec[1] = (unsigned long)(arg1); \
4030 _argvec[2] = (unsigned long)(arg2); \
4031 _argvec[3] = (unsigned long)(arg3); \
4032 _argvec[4] = (unsigned long)(arg4); \
4033 _argvec[5] = (unsigned long)(arg5); \
4034 _argvec[6] = (unsigned long)(arg6); \
4035 _argvec[7] = (unsigned long)(arg7); \
4036 _argvec[8] = (unsigned long)(arg8); \
4037 _argvec[9] = (unsigned long)(arg9); \
4038 _argvec[10] = (unsigned long)(arg10); \
4040 VALGRIND_ALIGN_STACK \
4041 "ldr r0, [%1, #40] \n\t" \
4043 "ldr r0, [%1, #20] \n\t" \
4044 "ldr r1, [%1, #24] \n\t" \
4045 "ldr r2, [%1, #28] \n\t" \
4046 "ldr r3, [%1, #32] \n\t" \
4047 "ldr r4, [%1, #36] \n\t" \
4048 "push {r0, r1, r2, r3, r4} \n\t" \
4049 "ldr r0, [%1, #4] \n\t" \
4050 "ldr r1, [%1, #8] \n\t" \
4051 "ldr r2, [%1, #12] \n\t" \
4052 "ldr r3, [%1, #16] \n\t" \
4053 "ldr r4, [%1] \n\t" \
4054 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
4055 VALGRIND_RESTORE_STACK \
4058 : "0" (&_argvec[0]) \
4059 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
4061 lval = (__typeof__(lval)) _res; \
4064#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
4065 arg6,arg7,arg8,arg9,arg10, \
4068 volatile OrigFn _orig = (orig); \
4069 volatile unsigned long _argvec[12]; \
4070 volatile unsigned long _res; \
4071 _argvec[0] = (unsigned long)_orig.nraddr; \
4072 _argvec[1] = (unsigned long)(arg1); \
4073 _argvec[2] = (unsigned long)(arg2); \
4074 _argvec[3] = (unsigned long)(arg3); \
4075 _argvec[4] = (unsigned long)(arg4); \
4076 _argvec[5] = (unsigned long)(arg5); \
4077 _argvec[6] = (unsigned long)(arg6); \
4078 _argvec[7] = (unsigned long)(arg7); \
4079 _argvec[8] = (unsigned long)(arg8); \
4080 _argvec[9] = (unsigned long)(arg9); \
4081 _argvec[10] = (unsigned long)(arg10); \
4082 _argvec[11] = (unsigned long)(arg11); \
4084 VALGRIND_ALIGN_STACK \
4085 "sub sp, sp, #4 \n\t" \
4086 "ldr r0, [%1, #40] \n\t" \
4087 "ldr r1, [%1, #44] \n\t" \
4088 "push {r0, r1} \n\t" \
4089 "ldr r0, [%1, #20] \n\t" \
4090 "ldr r1, [%1, #24] \n\t" \
4091 "ldr r2, [%1, #28] \n\t" \
4092 "ldr r3, [%1, #32] \n\t" \
4093 "ldr r4, [%1, #36] \n\t" \
4094 "push {r0, r1, r2, r3, r4} \n\t" \
4095 "ldr r0, [%1, #4] \n\t" \
4096 "ldr r1, [%1, #8] \n\t" \
4097 "ldr r2, [%1, #12] \n\t" \
4098 "ldr r3, [%1, #16] \n\t" \
4099 "ldr r4, [%1] \n\t" \
4100 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
4101 VALGRIND_RESTORE_STACK \
4104 : "0" (&_argvec[0]) \
4105 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
4107 lval = (__typeof__(lval)) _res; \
4110#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
4111 arg6,arg7,arg8,arg9,arg10, \
4114 volatile OrigFn _orig = (orig); \
4115 volatile unsigned long _argvec[13]; \
4116 volatile unsigned long _res; \
4117 _argvec[0] = (unsigned long)_orig.nraddr; \
4118 _argvec[1] = (unsigned long)(arg1); \
4119 _argvec[2] = (unsigned long)(arg2); \
4120 _argvec[3] = (unsigned long)(arg3); \
4121 _argvec[4] = (unsigned long)(arg4); \
4122 _argvec[5] = (unsigned long)(arg5); \
4123 _argvec[6] = (unsigned long)(arg6); \
4124 _argvec[7] = (unsigned long)(arg7); \
4125 _argvec[8] = (unsigned long)(arg8); \
4126 _argvec[9] = (unsigned long)(arg9); \
4127 _argvec[10] = (unsigned long)(arg10); \
4128 _argvec[11] = (unsigned long)(arg11); \
4129 _argvec[12] = (unsigned long)(arg12); \
4131 VALGRIND_ALIGN_STACK \
4132 "ldr r0, [%1, #40] \n\t" \
4133 "ldr r1, [%1, #44] \n\t" \
4134 "ldr r2, [%1, #48] \n\t" \
4135 "push {r0, r1, r2} \n\t" \
4136 "ldr r0, [%1, #20] \n\t" \
4137 "ldr r1, [%1, #24] \n\t" \
4138 "ldr r2, [%1, #28] \n\t" \
4139 "ldr r3, [%1, #32] \n\t" \
4140 "ldr r4, [%1, #36] \n\t" \
4141 "push {r0, r1, r2, r3, r4} \n\t" \
4142 "ldr r0, [%1, #4] \n\t" \
4143 "ldr r1, [%1, #8] \n\t" \
4144 "ldr r2, [%1, #12] \n\t" \
4145 "ldr r3, [%1, #16] \n\t" \
4146 "ldr r4, [%1] \n\t" \
4147 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
4148 VALGRIND_RESTORE_STACK \
4151 : "0" (&_argvec[0]) \
4152 : "cc", "memory", __CALLER_SAVED_REGS, "r10" \
4154 lval = (__typeof__(lval)) _res; \
4161#if defined(PLAT_arm64_linux)
4164#define __CALLER_SAVED_REGS \
4165 "x0", "x1", "x2", "x3","x4", "x5", "x6", "x7", "x8", "x9", \
4166 "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", \
4167 "x18", "x19", "x20", "x30", \
4168 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", \
4169 "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", \
4170 "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", \
4171 "v26", "v27", "v28", "v29", "v30", "v31"
4175#define VALGRIND_ALIGN_STACK \
4177 "bic sp, x21, #15\n\t"
4178#define VALGRIND_RESTORE_STACK \
4184#define CALL_FN_W_v(lval, orig) \
4186 volatile OrigFn _orig = (orig); \
4187 volatile unsigned long _argvec[1]; \
4188 volatile unsigned long _res; \
4189 _argvec[0] = (unsigned long)_orig.nraddr; \
4191 VALGRIND_ALIGN_STACK \
4192 "ldr x8, [%1] \n\t" \
4193 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4194 VALGRIND_RESTORE_STACK \
4197 : "0" (&_argvec[0]) \
4198 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4200 lval = (__typeof__(lval)) _res; \
4203#define CALL_FN_W_W(lval, orig, arg1) \
4205 volatile OrigFn _orig = (orig); \
4206 volatile unsigned long _argvec[2]; \
4207 volatile unsigned long _res; \
4208 _argvec[0] = (unsigned long)_orig.nraddr; \
4209 _argvec[1] = (unsigned long)(arg1); \
4211 VALGRIND_ALIGN_STACK \
4212 "ldr x0, [%1, #8] \n\t" \
4213 "ldr x8, [%1] \n\t" \
4214 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4215 VALGRIND_RESTORE_STACK \
4218 : "0" (&_argvec[0]) \
4219 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4221 lval = (__typeof__(lval)) _res; \
4224#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
4226 volatile OrigFn _orig = (orig); \
4227 volatile unsigned long _argvec[3]; \
4228 volatile unsigned long _res; \
4229 _argvec[0] = (unsigned long)_orig.nraddr; \
4230 _argvec[1] = (unsigned long)(arg1); \
4231 _argvec[2] = (unsigned long)(arg2); \
4233 VALGRIND_ALIGN_STACK \
4234 "ldr x0, [%1, #8] \n\t" \
4235 "ldr x1, [%1, #16] \n\t" \
4236 "ldr x8, [%1] \n\t" \
4237 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4238 VALGRIND_RESTORE_STACK \
4241 : "0" (&_argvec[0]) \
4242 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4244 lval = (__typeof__(lval)) _res; \
4247#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
4249 volatile OrigFn _orig = (orig); \
4250 volatile unsigned long _argvec[4]; \
4251 volatile unsigned long _res; \
4252 _argvec[0] = (unsigned long)_orig.nraddr; \
4253 _argvec[1] = (unsigned long)(arg1); \
4254 _argvec[2] = (unsigned long)(arg2); \
4255 _argvec[3] = (unsigned long)(arg3); \
4257 VALGRIND_ALIGN_STACK \
4258 "ldr x0, [%1, #8] \n\t" \
4259 "ldr x1, [%1, #16] \n\t" \
4260 "ldr x2, [%1, #24] \n\t" \
4261 "ldr x8, [%1] \n\t" \
4262 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4263 VALGRIND_RESTORE_STACK \
4266 : "0" (&_argvec[0]) \
4267 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4269 lval = (__typeof__(lval)) _res; \
4272#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
4274 volatile OrigFn _orig = (orig); \
4275 volatile unsigned long _argvec[5]; \
4276 volatile unsigned long _res; \
4277 _argvec[0] = (unsigned long)_orig.nraddr; \
4278 _argvec[1] = (unsigned long)(arg1); \
4279 _argvec[2] = (unsigned long)(arg2); \
4280 _argvec[3] = (unsigned long)(arg3); \
4281 _argvec[4] = (unsigned long)(arg4); \
4283 VALGRIND_ALIGN_STACK \
4284 "ldr x0, [%1, #8] \n\t" \
4285 "ldr x1, [%1, #16] \n\t" \
4286 "ldr x2, [%1, #24] \n\t" \
4287 "ldr x3, [%1, #32] \n\t" \
4288 "ldr x8, [%1] \n\t" \
4289 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4290 VALGRIND_RESTORE_STACK \
4293 : "0" (&_argvec[0]) \
4294 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4296 lval = (__typeof__(lval)) _res; \
4299#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
4301 volatile OrigFn _orig = (orig); \
4302 volatile unsigned long _argvec[6]; \
4303 volatile unsigned long _res; \
4304 _argvec[0] = (unsigned long)_orig.nraddr; \
4305 _argvec[1] = (unsigned long)(arg1); \
4306 _argvec[2] = (unsigned long)(arg2); \
4307 _argvec[3] = (unsigned long)(arg3); \
4308 _argvec[4] = (unsigned long)(arg4); \
4309 _argvec[5] = (unsigned long)(arg5); \
4311 VALGRIND_ALIGN_STACK \
4312 "ldr x0, [%1, #8] \n\t" \
4313 "ldr x1, [%1, #16] \n\t" \
4314 "ldr x2, [%1, #24] \n\t" \
4315 "ldr x3, [%1, #32] \n\t" \
4316 "ldr x4, [%1, #40] \n\t" \
4317 "ldr x8, [%1] \n\t" \
4318 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4319 VALGRIND_RESTORE_STACK \
4322 : "0" (&_argvec[0]) \
4323 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4325 lval = (__typeof__(lval)) _res; \
4328#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
4330 volatile OrigFn _orig = (orig); \
4331 volatile unsigned long _argvec[7]; \
4332 volatile unsigned long _res; \
4333 _argvec[0] = (unsigned long)_orig.nraddr; \
4334 _argvec[1] = (unsigned long)(arg1); \
4335 _argvec[2] = (unsigned long)(arg2); \
4336 _argvec[3] = (unsigned long)(arg3); \
4337 _argvec[4] = (unsigned long)(arg4); \
4338 _argvec[5] = (unsigned long)(arg5); \
4339 _argvec[6] = (unsigned long)(arg6); \
4341 VALGRIND_ALIGN_STACK \
4342 "ldr x0, [%1, #8] \n\t" \
4343 "ldr x1, [%1, #16] \n\t" \
4344 "ldr x2, [%1, #24] \n\t" \
4345 "ldr x3, [%1, #32] \n\t" \
4346 "ldr x4, [%1, #40] \n\t" \
4347 "ldr x5, [%1, #48] \n\t" \
4348 "ldr x8, [%1] \n\t" \
4349 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4350 VALGRIND_RESTORE_STACK \
4353 : "0" (&_argvec[0]) \
4354 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4356 lval = (__typeof__(lval)) _res; \
4359#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4362 volatile OrigFn _orig = (orig); \
4363 volatile unsigned long _argvec[8]; \
4364 volatile unsigned long _res; \
4365 _argvec[0] = (unsigned long)_orig.nraddr; \
4366 _argvec[1] = (unsigned long)(arg1); \
4367 _argvec[2] = (unsigned long)(arg2); \
4368 _argvec[3] = (unsigned long)(arg3); \
4369 _argvec[4] = (unsigned long)(arg4); \
4370 _argvec[5] = (unsigned long)(arg5); \
4371 _argvec[6] = (unsigned long)(arg6); \
4372 _argvec[7] = (unsigned long)(arg7); \
4374 VALGRIND_ALIGN_STACK \
4375 "ldr x0, [%1, #8] \n\t" \
4376 "ldr x1, [%1, #16] \n\t" \
4377 "ldr x2, [%1, #24] \n\t" \
4378 "ldr x3, [%1, #32] \n\t" \
4379 "ldr x4, [%1, #40] \n\t" \
4380 "ldr x5, [%1, #48] \n\t" \
4381 "ldr x6, [%1, #56] \n\t" \
4382 "ldr x8, [%1] \n\t" \
4383 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4384 VALGRIND_RESTORE_STACK \
4387 : "0" (&_argvec[0]) \
4388 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4390 lval = (__typeof__(lval)) _res; \
4393#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4396 volatile OrigFn _orig = (orig); \
4397 volatile unsigned long _argvec[9]; \
4398 volatile unsigned long _res; \
4399 _argvec[0] = (unsigned long)_orig.nraddr; \
4400 _argvec[1] = (unsigned long)(arg1); \
4401 _argvec[2] = (unsigned long)(arg2); \
4402 _argvec[3] = (unsigned long)(arg3); \
4403 _argvec[4] = (unsigned long)(arg4); \
4404 _argvec[5] = (unsigned long)(arg5); \
4405 _argvec[6] = (unsigned long)(arg6); \
4406 _argvec[7] = (unsigned long)(arg7); \
4407 _argvec[8] = (unsigned long)(arg8); \
4409 VALGRIND_ALIGN_STACK \
4410 "ldr x0, [%1, #8] \n\t" \
4411 "ldr x1, [%1, #16] \n\t" \
4412 "ldr x2, [%1, #24] \n\t" \
4413 "ldr x3, [%1, #32] \n\t" \
4414 "ldr x4, [%1, #40] \n\t" \
4415 "ldr x5, [%1, #48] \n\t" \
4416 "ldr x6, [%1, #56] \n\t" \
4417 "ldr x7, [%1, #64] \n\t" \
4418 "ldr x8, [%1] \n\t" \
4419 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4420 VALGRIND_RESTORE_STACK \
4423 : "0" (&_argvec[0]) \
4424 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4426 lval = (__typeof__(lval)) _res; \
4429#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4432 volatile OrigFn _orig = (orig); \
4433 volatile unsigned long _argvec[10]; \
4434 volatile unsigned long _res; \
4435 _argvec[0] = (unsigned long)_orig.nraddr; \
4436 _argvec[1] = (unsigned long)(arg1); \
4437 _argvec[2] = (unsigned long)(arg2); \
4438 _argvec[3] = (unsigned long)(arg3); \
4439 _argvec[4] = (unsigned long)(arg4); \
4440 _argvec[5] = (unsigned long)(arg5); \
4441 _argvec[6] = (unsigned long)(arg6); \
4442 _argvec[7] = (unsigned long)(arg7); \
4443 _argvec[8] = (unsigned long)(arg8); \
4444 _argvec[9] = (unsigned long)(arg9); \
4446 VALGRIND_ALIGN_STACK \
4447 "sub sp, sp, #0x20 \n\t" \
4448 "ldr x0, [%1, #8] \n\t" \
4449 "ldr x1, [%1, #16] \n\t" \
4450 "ldr x2, [%1, #24] \n\t" \
4451 "ldr x3, [%1, #32] \n\t" \
4452 "ldr x4, [%1, #40] \n\t" \
4453 "ldr x5, [%1, #48] \n\t" \
4454 "ldr x6, [%1, #56] \n\t" \
4455 "ldr x7, [%1, #64] \n\t" \
4456 "ldr x8, [%1, #72] \n\t" \
4457 "str x8, [sp, #0] \n\t" \
4458 "ldr x8, [%1] \n\t" \
4459 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4460 VALGRIND_RESTORE_STACK \
4463 : "0" (&_argvec[0]) \
4464 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4466 lval = (__typeof__(lval)) _res; \
4469#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4470 arg7,arg8,arg9,arg10) \
4472 volatile OrigFn _orig = (orig); \
4473 volatile unsigned long _argvec[11]; \
4474 volatile unsigned long _res; \
4475 _argvec[0] = (unsigned long)_orig.nraddr; \
4476 _argvec[1] = (unsigned long)(arg1); \
4477 _argvec[2] = (unsigned long)(arg2); \
4478 _argvec[3] = (unsigned long)(arg3); \
4479 _argvec[4] = (unsigned long)(arg4); \
4480 _argvec[5] = (unsigned long)(arg5); \
4481 _argvec[6] = (unsigned long)(arg6); \
4482 _argvec[7] = (unsigned long)(arg7); \
4483 _argvec[8] = (unsigned long)(arg8); \
4484 _argvec[9] = (unsigned long)(arg9); \
4485 _argvec[10] = (unsigned long)(arg10); \
4487 VALGRIND_ALIGN_STACK \
4488 "sub sp, sp, #0x20 \n\t" \
4489 "ldr x0, [%1, #8] \n\t" \
4490 "ldr x1, [%1, #16] \n\t" \
4491 "ldr x2, [%1, #24] \n\t" \
4492 "ldr x3, [%1, #32] \n\t" \
4493 "ldr x4, [%1, #40] \n\t" \
4494 "ldr x5, [%1, #48] \n\t" \
4495 "ldr x6, [%1, #56] \n\t" \
4496 "ldr x7, [%1, #64] \n\t" \
4497 "ldr x8, [%1, #72] \n\t" \
4498 "str x8, [sp, #0] \n\t" \
4499 "ldr x8, [%1, #80] \n\t" \
4500 "str x8, [sp, #8] \n\t" \
4501 "ldr x8, [%1] \n\t" \
4502 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4503 VALGRIND_RESTORE_STACK \
4506 : "0" (&_argvec[0]) \
4507 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4509 lval = (__typeof__(lval)) _res; \
4512#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4513 arg7,arg8,arg9,arg10,arg11) \
4515 volatile OrigFn _orig = (orig); \
4516 volatile unsigned long _argvec[12]; \
4517 volatile unsigned long _res; \
4518 _argvec[0] = (unsigned long)_orig.nraddr; \
4519 _argvec[1] = (unsigned long)(arg1); \
4520 _argvec[2] = (unsigned long)(arg2); \
4521 _argvec[3] = (unsigned long)(arg3); \
4522 _argvec[4] = (unsigned long)(arg4); \
4523 _argvec[5] = (unsigned long)(arg5); \
4524 _argvec[6] = (unsigned long)(arg6); \
4525 _argvec[7] = (unsigned long)(arg7); \
4526 _argvec[8] = (unsigned long)(arg8); \
4527 _argvec[9] = (unsigned long)(arg9); \
4528 _argvec[10] = (unsigned long)(arg10); \
4529 _argvec[11] = (unsigned long)(arg11); \
4531 VALGRIND_ALIGN_STACK \
4532 "sub sp, sp, #0x30 \n\t" \
4533 "ldr x0, [%1, #8] \n\t" \
4534 "ldr x1, [%1, #16] \n\t" \
4535 "ldr x2, [%1, #24] \n\t" \
4536 "ldr x3, [%1, #32] \n\t" \
4537 "ldr x4, [%1, #40] \n\t" \
4538 "ldr x5, [%1, #48] \n\t" \
4539 "ldr x6, [%1, #56] \n\t" \
4540 "ldr x7, [%1, #64] \n\t" \
4541 "ldr x8, [%1, #72] \n\t" \
4542 "str x8, [sp, #0] \n\t" \
4543 "ldr x8, [%1, #80] \n\t" \
4544 "str x8, [sp, #8] \n\t" \
4545 "ldr x8, [%1, #88] \n\t" \
4546 "str x8, [sp, #16] \n\t" \
4547 "ldr x8, [%1] \n\t" \
4548 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4549 VALGRIND_RESTORE_STACK \
4552 : "0" (&_argvec[0]) \
4553 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4555 lval = (__typeof__(lval)) _res; \
4558#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4559 arg7,arg8,arg9,arg10,arg11, \
4562 volatile OrigFn _orig = (orig); \
4563 volatile unsigned long _argvec[13]; \
4564 volatile unsigned long _res; \
4565 _argvec[0] = (unsigned long)_orig.nraddr; \
4566 _argvec[1] = (unsigned long)(arg1); \
4567 _argvec[2] = (unsigned long)(arg2); \
4568 _argvec[3] = (unsigned long)(arg3); \
4569 _argvec[4] = (unsigned long)(arg4); \
4570 _argvec[5] = (unsigned long)(arg5); \
4571 _argvec[6] = (unsigned long)(arg6); \
4572 _argvec[7] = (unsigned long)(arg7); \
4573 _argvec[8] = (unsigned long)(arg8); \
4574 _argvec[9] = (unsigned long)(arg9); \
4575 _argvec[10] = (unsigned long)(arg10); \
4576 _argvec[11] = (unsigned long)(arg11); \
4577 _argvec[12] = (unsigned long)(arg12); \
4579 VALGRIND_ALIGN_STACK \
4580 "sub sp, sp, #0x30 \n\t" \
4581 "ldr x0, [%1, #8] \n\t" \
4582 "ldr x1, [%1, #16] \n\t" \
4583 "ldr x2, [%1, #24] \n\t" \
4584 "ldr x3, [%1, #32] \n\t" \
4585 "ldr x4, [%1, #40] \n\t" \
4586 "ldr x5, [%1, #48] \n\t" \
4587 "ldr x6, [%1, #56] \n\t" \
4588 "ldr x7, [%1, #64] \n\t" \
4589 "ldr x8, [%1, #72] \n\t" \
4590 "str x8, [sp, #0] \n\t" \
4591 "ldr x8, [%1, #80] \n\t" \
4592 "str x8, [sp, #8] \n\t" \
4593 "ldr x8, [%1, #88] \n\t" \
4594 "str x8, [sp, #16] \n\t" \
4595 "ldr x8, [%1, #96] \n\t" \
4596 "str x8, [sp, #24] \n\t" \
4597 "ldr x8, [%1] \n\t" \
4598 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
4599 VALGRIND_RESTORE_STACK \
4602 : "0" (&_argvec[0]) \
4603 : "cc", "memory", __CALLER_SAVED_REGS, "x21" \
4605 lval = (__typeof__(lval)) _res; \
4612#if defined(PLAT_s390x_linux)
4618#if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
4619# define __FRAME_POINTER \
4620 ,"d"(__builtin_dwarf_cfa())
4621# define VALGRIND_CFI_PROLOGUE \
4622 ".cfi_remember_state\n\t" \
4626 ".cfi_def_cfa r11, 0\n\t"
4627# define VALGRIND_CFI_EPILOGUE \
4629 ".cfi_restore_state\n\t"
4631# define __FRAME_POINTER
4632# define VALGRIND_CFI_PROLOGUE \
4634# define VALGRIND_CFI_EPILOGUE
4646#define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
4647 "f0","f1","f2","f3","f4","f5","f6","f7"
4658#define CALL_FN_W_v(lval, orig) \
4660 volatile OrigFn _orig = (orig); \
4661 volatile unsigned long _argvec[1]; \
4662 volatile unsigned long _res; \
4663 _argvec[0] = (unsigned long)_orig.nraddr; \
4665 VALGRIND_CFI_PROLOGUE \
4666 "aghi 15,-160\n\t" \
4668 VALGRIND_CALL_NOREDIR_R1 \
4671 VALGRIND_CFI_EPILOGUE \
4673 : "d" (&_argvec[0]) __FRAME_POINTER \
4674 : "cc", "memory", __CALLER_SAVED_REGS,"7" \
4676 lval = (__typeof__(lval)) _res; \
4680#define CALL_FN_W_W(lval, orig, arg1) \
4682 volatile OrigFn _orig = (orig); \
4683 volatile unsigned long _argvec[2]; \
4684 volatile unsigned long _res; \
4685 _argvec[0] = (unsigned long)_orig.nraddr; \
4686 _argvec[1] = (unsigned long)arg1; \
4688 VALGRIND_CFI_PROLOGUE \
4689 "aghi 15,-160\n\t" \
4692 VALGRIND_CALL_NOREDIR_R1 \
4695 VALGRIND_CFI_EPILOGUE \
4697 : "a" (&_argvec[0]) __FRAME_POINTER \
4698 : "cc", "memory", __CALLER_SAVED_REGS,"7" \
4700 lval = (__typeof__(lval)) _res; \
4703#define CALL_FN_W_WW(lval, orig, arg1, arg2) \
4705 volatile OrigFn _orig = (orig); \
4706 volatile unsigned long _argvec[3]; \
4707 volatile unsigned long _res; \
4708 _argvec[0] = (unsigned long)_orig.nraddr; \
4709 _argvec[1] = (unsigned long)arg1; \
4710 _argvec[2] = (unsigned long)arg2; \
4712 VALGRIND_CFI_PROLOGUE \
4713 "aghi 15,-160\n\t" \
4717 VALGRIND_CALL_NOREDIR_R1 \
4720 VALGRIND_CFI_EPILOGUE \
4722 : "a" (&_argvec[0]) __FRAME_POINTER \
4723 : "cc", "memory", __CALLER_SAVED_REGS,"7" \
4725 lval = (__typeof__(lval)) _res; \
4728#define CALL_FN_W_WWW(lval, orig, arg1, arg2, arg3) \
4730 volatile OrigFn _orig = (orig); \
4731 volatile unsigned long _argvec[4]; \
4732 volatile unsigned long _res; \
4733 _argvec[0] = (unsigned long)_orig.nraddr; \
4734 _argvec[1] = (unsigned long)arg1; \
4735 _argvec[2] = (unsigned long)arg2; \
4736 _argvec[3] = (unsigned long)arg3; \
4738 VALGRIND_CFI_PROLOGUE \
4739 "aghi 15,-160\n\t" \
4744 VALGRIND_CALL_NOREDIR_R1 \
4747 VALGRIND_CFI_EPILOGUE \
4749 : "a" (&_argvec[0]) __FRAME_POINTER \
4750 : "cc", "memory", __CALLER_SAVED_REGS,"7" \
4752 lval = (__typeof__(lval)) _res; \
4755#define CALL_FN_W_WWWW(lval, orig, arg1, arg2, arg3, arg4) \
4757 volatile OrigFn _orig = (orig); \
4758 volatile unsigned long _argvec[5]; \
4759 volatile unsigned long _res; \
4760 _argvec[0] = (unsigned long)_orig.nraddr; \
4761 _argvec[1] = (unsigned long)arg1; \
4762 _argvec[2] = (unsigned long)arg2; \
4763 _argvec[3] = (unsigned long)arg3; \
4764 _argvec[4] = (unsigned long)arg4; \
4766 VALGRIND_CFI_PROLOGUE \
4767 "aghi 15,-160\n\t" \
4773 VALGRIND_CALL_NOREDIR_R1 \
4776 VALGRIND_CFI_EPILOGUE \
4778 : "a" (&_argvec[0]) __FRAME_POINTER \
4779 : "cc", "memory", __CALLER_SAVED_REGS,"7" \
4781 lval = (__typeof__(lval)) _res; \
4784#define CALL_FN_W_5W(lval, orig, arg1, arg2, arg3, arg4, arg5) \
4786 volatile OrigFn _orig = (orig); \
4787 volatile unsigned long _argvec[6]; \
4788 volatile unsigned long _res; \
4789 _argvec[0] = (unsigned long)_orig.nraddr; \
4790 _argvec[1] = (unsigned long)arg1; \
4791 _argvec[2] = (unsigned long)arg2; \
4792 _argvec[3] = (unsigned long)arg3; \
4793 _argvec[4] = (unsigned long)arg4; \
4794 _argvec[5] = (unsigned long)arg5; \
4796 VALGRIND_CFI_PROLOGUE \
4797 "aghi 15,-160\n\t" \
4804 VALGRIND_CALL_NOREDIR_R1 \
4807 VALGRIND_CFI_EPILOGUE \
4809 : "a" (&_argvec[0]) __FRAME_POINTER \
4810 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4812 lval = (__typeof__(lval)) _res; \
4815#define CALL_FN_W_6W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4818 volatile OrigFn _orig = (orig); \
4819 volatile unsigned long _argvec[7]; \
4820 volatile unsigned long _res; \
4821 _argvec[0] = (unsigned long)_orig.nraddr; \
4822 _argvec[1] = (unsigned long)arg1; \
4823 _argvec[2] = (unsigned long)arg2; \
4824 _argvec[3] = (unsigned long)arg3; \
4825 _argvec[4] = (unsigned long)arg4; \
4826 _argvec[5] = (unsigned long)arg5; \
4827 _argvec[6] = (unsigned long)arg6; \
4829 VALGRIND_CFI_PROLOGUE \
4830 "aghi 15,-168\n\t" \
4836 "mvc 160(8,15), 48(1)\n\t" \
4838 VALGRIND_CALL_NOREDIR_R1 \
4841 VALGRIND_CFI_EPILOGUE \
4843 : "a" (&_argvec[0]) __FRAME_POINTER \
4844 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4846 lval = (__typeof__(lval)) _res; \
4849#define CALL_FN_W_7W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4852 volatile OrigFn _orig = (orig); \
4853 volatile unsigned long _argvec[8]; \
4854 volatile unsigned long _res; \
4855 _argvec[0] = (unsigned long)_orig.nraddr; \
4856 _argvec[1] = (unsigned long)arg1; \
4857 _argvec[2] = (unsigned long)arg2; \
4858 _argvec[3] = (unsigned long)arg3; \
4859 _argvec[4] = (unsigned long)arg4; \
4860 _argvec[5] = (unsigned long)arg5; \
4861 _argvec[6] = (unsigned long)arg6; \
4862 _argvec[7] = (unsigned long)arg7; \
4864 VALGRIND_CFI_PROLOGUE \
4865 "aghi 15,-176\n\t" \
4871 "mvc 160(8,15), 48(1)\n\t" \
4872 "mvc 168(8,15), 56(1)\n\t" \
4874 VALGRIND_CALL_NOREDIR_R1 \
4877 VALGRIND_CFI_EPILOGUE \
4879 : "a" (&_argvec[0]) __FRAME_POINTER \
4880 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4882 lval = (__typeof__(lval)) _res; \
4885#define CALL_FN_W_8W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4888 volatile OrigFn _orig = (orig); \
4889 volatile unsigned long _argvec[9]; \
4890 volatile unsigned long _res; \
4891 _argvec[0] = (unsigned long)_orig.nraddr; \
4892 _argvec[1] = (unsigned long)arg1; \
4893 _argvec[2] = (unsigned long)arg2; \
4894 _argvec[3] = (unsigned long)arg3; \
4895 _argvec[4] = (unsigned long)arg4; \
4896 _argvec[5] = (unsigned long)arg5; \
4897 _argvec[6] = (unsigned long)arg6; \
4898 _argvec[7] = (unsigned long)arg7; \
4899 _argvec[8] = (unsigned long)arg8; \
4901 VALGRIND_CFI_PROLOGUE \
4902 "aghi 15,-184\n\t" \
4908 "mvc 160(8,15), 48(1)\n\t" \
4909 "mvc 168(8,15), 56(1)\n\t" \
4910 "mvc 176(8,15), 64(1)\n\t" \
4912 VALGRIND_CALL_NOREDIR_R1 \
4915 VALGRIND_CFI_EPILOGUE \
4917 : "a" (&_argvec[0]) __FRAME_POINTER \
4918 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4920 lval = (__typeof__(lval)) _res; \
4923#define CALL_FN_W_9W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4924 arg6, arg7 ,arg8, arg9) \
4926 volatile OrigFn _orig = (orig); \
4927 volatile unsigned long _argvec[10]; \
4928 volatile unsigned long _res; \
4929 _argvec[0] = (unsigned long)_orig.nraddr; \
4930 _argvec[1] = (unsigned long)arg1; \
4931 _argvec[2] = (unsigned long)arg2; \
4932 _argvec[3] = (unsigned long)arg3; \
4933 _argvec[4] = (unsigned long)arg4; \
4934 _argvec[5] = (unsigned long)arg5; \
4935 _argvec[6] = (unsigned long)arg6; \
4936 _argvec[7] = (unsigned long)arg7; \
4937 _argvec[8] = (unsigned long)arg8; \
4938 _argvec[9] = (unsigned long)arg9; \
4940 VALGRIND_CFI_PROLOGUE \
4941 "aghi 15,-192\n\t" \
4947 "mvc 160(8,15), 48(1)\n\t" \
4948 "mvc 168(8,15), 56(1)\n\t" \
4949 "mvc 176(8,15), 64(1)\n\t" \
4950 "mvc 184(8,15), 72(1)\n\t" \
4952 VALGRIND_CALL_NOREDIR_R1 \
4955 VALGRIND_CFI_EPILOGUE \
4957 : "a" (&_argvec[0]) __FRAME_POINTER \
4958 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4960 lval = (__typeof__(lval)) _res; \
4963#define CALL_FN_W_10W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4964 arg6, arg7 ,arg8, arg9, arg10) \
4966 volatile OrigFn _orig = (orig); \
4967 volatile unsigned long _argvec[11]; \
4968 volatile unsigned long _res; \
4969 _argvec[0] = (unsigned long)_orig.nraddr; \
4970 _argvec[1] = (unsigned long)arg1; \
4971 _argvec[2] = (unsigned long)arg2; \
4972 _argvec[3] = (unsigned long)arg3; \
4973 _argvec[4] = (unsigned long)arg4; \
4974 _argvec[5] = (unsigned long)arg5; \
4975 _argvec[6] = (unsigned long)arg6; \
4976 _argvec[7] = (unsigned long)arg7; \
4977 _argvec[8] = (unsigned long)arg8; \
4978 _argvec[9] = (unsigned long)arg9; \
4979 _argvec[10] = (unsigned long)arg10; \
4981 VALGRIND_CFI_PROLOGUE \
4982 "aghi 15,-200\n\t" \
4988 "mvc 160(8,15), 48(1)\n\t" \
4989 "mvc 168(8,15), 56(1)\n\t" \
4990 "mvc 176(8,15), 64(1)\n\t" \
4991 "mvc 184(8,15), 72(1)\n\t" \
4992 "mvc 192(8,15), 80(1)\n\t" \
4994 VALGRIND_CALL_NOREDIR_R1 \
4997 VALGRIND_CFI_EPILOGUE \
4999 : "a" (&_argvec[0]) __FRAME_POINTER \
5000 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
5002 lval = (__typeof__(lval)) _res; \
5005#define CALL_FN_W_11W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
5006 arg6, arg7 ,arg8, arg9, arg10, arg11) \
5008 volatile OrigFn _orig = (orig); \
5009 volatile unsigned long _argvec[12]; \
5010 volatile unsigned long _res; \
5011 _argvec[0] = (unsigned long)_orig.nraddr; \
5012 _argvec[1] = (unsigned long)arg1; \
5013 _argvec[2] = (unsigned long)arg2; \
5014 _argvec[3] = (unsigned long)arg3; \
5015 _argvec[4] = (unsigned long)arg4; \
5016 _argvec[5] = (unsigned long)arg5; \
5017 _argvec[6] = (unsigned long)arg6; \
5018 _argvec[7] = (unsigned long)arg7; \
5019 _argvec[8] = (unsigned long)arg8; \
5020 _argvec[9] = (unsigned long)arg9; \
5021 _argvec[10] = (unsigned long)arg10; \
5022 _argvec[11] = (unsigned long)arg11; \
5024 VALGRIND_CFI_PROLOGUE \
5025 "aghi 15,-208\n\t" \
5031 "mvc 160(8,15), 48(1)\n\t" \
5032 "mvc 168(8,15), 56(1)\n\t" \
5033 "mvc 176(8,15), 64(1)\n\t" \
5034 "mvc 184(8,15), 72(1)\n\t" \
5035 "mvc 192(8,15), 80(1)\n\t" \
5036 "mvc 200(8,15), 88(1)\n\t" \
5038 VALGRIND_CALL_NOREDIR_R1 \
5041 VALGRIND_CFI_EPILOGUE \
5043 : "a" (&_argvec[0]) __FRAME_POINTER \
5044 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
5046 lval = (__typeof__(lval)) _res; \
5049#define CALL_FN_W_12W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
5050 arg6, arg7 ,arg8, arg9, arg10, arg11, arg12)\
5052 volatile OrigFn _orig = (orig); \
5053 volatile unsigned long _argvec[13]; \
5054 volatile unsigned long _res; \
5055 _argvec[0] = (unsigned long)_orig.nraddr; \
5056 _argvec[1] = (unsigned long)arg1; \
5057 _argvec[2] = (unsigned long)arg2; \
5058 _argvec[3] = (unsigned long)arg3; \
5059 _argvec[4] = (unsigned long)arg4; \
5060 _argvec[5] = (unsigned long)arg5; \
5061 _argvec[6] = (unsigned long)arg6; \
5062 _argvec[7] = (unsigned long)arg7; \
5063 _argvec[8] = (unsigned long)arg8; \
5064 _argvec[9] = (unsigned long)arg9; \
5065 _argvec[10] = (unsigned long)arg10; \
5066 _argvec[11] = (unsigned long)arg11; \
5067 _argvec[12] = (unsigned long)arg12; \
5069 VALGRIND_CFI_PROLOGUE \
5070 "aghi 15,-216\n\t" \
5076 "mvc 160(8,15), 48(1)\n\t" \
5077 "mvc 168(8,15), 56(1)\n\t" \
5078 "mvc 176(8,15), 64(1)\n\t" \
5079 "mvc 184(8,15), 72(1)\n\t" \
5080 "mvc 192(8,15), 80(1)\n\t" \
5081 "mvc 200(8,15), 88(1)\n\t" \
5082 "mvc 208(8,15), 96(1)\n\t" \
5084 VALGRIND_CALL_NOREDIR_R1 \
5087 VALGRIND_CFI_EPILOGUE \
5089 : "a" (&_argvec[0]) __FRAME_POINTER \
5090 : "cc", "memory", __CALLER_SAVED_REGS,"6","7" \
5092 lval = (__typeof__(lval)) _res; \
5100#if defined(PLAT_mips32_linux)
5103#define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6", \
5104"$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
5110#define CALL_FN_W_v(lval, orig) \
5112 volatile OrigFn _orig = (orig); \
5113 volatile unsigned long _argvec[1]; \
5114 volatile unsigned long _res; \
5115 _argvec[0] = (unsigned long)_orig.nraddr; \
5117 "subu $29, $29, 8 \n\t" \
5118 "sw $28, 0($29) \n\t" \
5119 "sw $31, 4($29) \n\t" \
5120 "subu $29, $29, 16 \n\t" \
5121 "lw $25, 0(%1) \n\t" \
5122 VALGRIND_CALL_NOREDIR_T9 \
5123 "addu $29, $29, 16\n\t" \
5124 "lw $28, 0($29) \n\t" \
5125 "lw $31, 4($29) \n\t" \
5126 "addu $29, $29, 8 \n\t" \
5129 : "0" (&_argvec[0]) \
5130 : "memory", __CALLER_SAVED_REGS \
5132 lval = (__typeof__(lval)) _res; \
5135#define CALL_FN_W_W(lval, orig, arg1) \
5137 volatile OrigFn _orig = (orig); \
5138 volatile unsigned long _argvec[2]; \
5139 volatile unsigned long _res; \
5140 _argvec[0] = (unsigned long)_orig.nraddr; \
5141 _argvec[1] = (unsigned long)(arg1); \
5143 "subu $29, $29, 8 \n\t" \
5144 "sw $28, 0($29) \n\t" \
5145 "sw $31, 4($29) \n\t" \
5146 "subu $29, $29, 16 \n\t" \
5147 "lw $4, 4(%1) \n\t" \
5148 "lw $25, 0(%1) \n\t" \
5149 VALGRIND_CALL_NOREDIR_T9 \
5150 "addu $29, $29, 16 \n\t" \
5151 "lw $28, 0($29) \n\t" \
5152 "lw $31, 4($29) \n\t" \
5153 "addu $29, $29, 8 \n\t" \
5156 : "0" (&_argvec[0]) \
5157 : "memory", __CALLER_SAVED_REGS \
5159 lval = (__typeof__(lval)) _res; \
5162#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
5164 volatile OrigFn _orig = (orig); \
5165 volatile unsigned long _argvec[3]; \
5166 volatile unsigned long _res; \
5167 _argvec[0] = (unsigned long)_orig.nraddr; \
5168 _argvec[1] = (unsigned long)(arg1); \
5169 _argvec[2] = (unsigned long)(arg2); \
5171 "subu $29, $29, 8 \n\t" \
5172 "sw $28, 0($29) \n\t" \
5173 "sw $31, 4($29) \n\t" \
5174 "subu $29, $29, 16 \n\t" \
5175 "lw $4, 4(%1) \n\t" \
5176 "lw $5, 8(%1) \n\t" \
5177 "lw $25, 0(%1) \n\t" \
5178 VALGRIND_CALL_NOREDIR_T9 \
5179 "addu $29, $29, 16 \n\t" \
5180 "lw $28, 0($29) \n\t" \
5181 "lw $31, 4($29) \n\t" \
5182 "addu $29, $29, 8 \n\t" \
5185 : "0" (&_argvec[0]) \
5186 : "memory", __CALLER_SAVED_REGS \
5188 lval = (__typeof__(lval)) _res; \
5191#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
5193 volatile OrigFn _orig = (orig); \
5194 volatile unsigned long _argvec[4]; \
5195 volatile unsigned long _res; \
5196 _argvec[0] = (unsigned long)_orig.nraddr; \
5197 _argvec[1] = (unsigned long)(arg1); \
5198 _argvec[2] = (unsigned long)(arg2); \
5199 _argvec[3] = (unsigned long)(arg3); \
5201 "subu $29, $29, 8 \n\t" \
5202 "sw $28, 0($29) \n\t" \
5203 "sw $31, 4($29) \n\t" \
5204 "subu $29, $29, 16 \n\t" \
5205 "lw $4, 4(%1) \n\t" \
5206 "lw $5, 8(%1) \n\t" \
5207 "lw $6, 12(%1) \n\t" \
5208 "lw $25, 0(%1) \n\t" \
5209 VALGRIND_CALL_NOREDIR_T9 \
5210 "addu $29, $29, 16 \n\t" \
5211 "lw $28, 0($29) \n\t" \
5212 "lw $31, 4($29) \n\t" \
5213 "addu $29, $29, 8 \n\t" \
5216 : "0" (&_argvec[0]) \
5217 : "memory", __CALLER_SAVED_REGS \
5219 lval = (__typeof__(lval)) _res; \
5222#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
5224 volatile OrigFn _orig = (orig); \
5225 volatile unsigned long _argvec[5]; \
5226 volatile unsigned long _res; \
5227 _argvec[0] = (unsigned long)_orig.nraddr; \
5228 _argvec[1] = (unsigned long)(arg1); \
5229 _argvec[2] = (unsigned long)(arg2); \
5230 _argvec[3] = (unsigned long)(arg3); \
5231 _argvec[4] = (unsigned long)(arg4); \
5233 "subu $29, $29, 8 \n\t" \
5234 "sw $28, 0($29) \n\t" \
5235 "sw $31, 4($29) \n\t" \
5236 "subu $29, $29, 16 \n\t" \
5237 "lw $4, 4(%1) \n\t" \
5238 "lw $5, 8(%1) \n\t" \
5239 "lw $6, 12(%1) \n\t" \
5240 "lw $7, 16(%1) \n\t" \
5241 "lw $25, 0(%1) \n\t" \
5242 VALGRIND_CALL_NOREDIR_T9 \
5243 "addu $29, $29, 16 \n\t" \
5244 "lw $28, 0($29) \n\t" \
5245 "lw $31, 4($29) \n\t" \
5246 "addu $29, $29, 8 \n\t" \
5249 : "0" (&_argvec[0]) \
5250 : "memory", __CALLER_SAVED_REGS \
5252 lval = (__typeof__(lval)) _res; \
5255#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
5257 volatile OrigFn _orig = (orig); \
5258 volatile unsigned long _argvec[6]; \
5259 volatile unsigned long _res; \
5260 _argvec[0] = (unsigned long)_orig.nraddr; \
5261 _argvec[1] = (unsigned long)(arg1); \
5262 _argvec[2] = (unsigned long)(arg2); \
5263 _argvec[3] = (unsigned long)(arg3); \
5264 _argvec[4] = (unsigned long)(arg4); \
5265 _argvec[5] = (unsigned long)(arg5); \
5267 "subu $29, $29, 8 \n\t" \
5268 "sw $28, 0($29) \n\t" \
5269 "sw $31, 4($29) \n\t" \
5270 "lw $4, 20(%1) \n\t" \
5271 "subu $29, $29, 24\n\t" \
5272 "sw $4, 16($29) \n\t" \
5273 "lw $4, 4(%1) \n\t" \
5274 "lw $5, 8(%1) \n\t" \
5275 "lw $6, 12(%1) \n\t" \
5276 "lw $7, 16(%1) \n\t" \
5277 "lw $25, 0(%1) \n\t" \
5278 VALGRIND_CALL_NOREDIR_T9 \
5279 "addu $29, $29, 24 \n\t" \
5280 "lw $28, 0($29) \n\t" \
5281 "lw $31, 4($29) \n\t" \
5282 "addu $29, $29, 8 \n\t" \
5285 : "0" (&_argvec[0]) \
5286 : "memory", __CALLER_SAVED_REGS \
5288 lval = (__typeof__(lval)) _res; \
5290#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
5292 volatile OrigFn _orig = (orig); \
5293 volatile unsigned long _argvec[7]; \
5294 volatile unsigned long _res; \
5295 _argvec[0] = (unsigned long)_orig.nraddr; \
5296 _argvec[1] = (unsigned long)(arg1); \
5297 _argvec[2] = (unsigned long)(arg2); \
5298 _argvec[3] = (unsigned long)(arg3); \
5299 _argvec[4] = (unsigned long)(arg4); \
5300 _argvec[5] = (unsigned long)(arg5); \
5301 _argvec[6] = (unsigned long)(arg6); \
5303 "subu $29, $29, 8 \n\t" \
5304 "sw $28, 0($29) \n\t" \
5305 "sw $31, 4($29) \n\t" \
5306 "lw $4, 20(%1) \n\t" \
5307 "subu $29, $29, 32\n\t" \
5308 "sw $4, 16($29) \n\t" \
5309 "lw $4, 24(%1) \n\t" \
5311 "sw $4, 20($29) \n\t" \
5312 "lw $4, 4(%1) \n\t" \
5313 "lw $5, 8(%1) \n\t" \
5314 "lw $6, 12(%1) \n\t" \
5315 "lw $7, 16(%1) \n\t" \
5316 "lw $25, 0(%1) \n\t" \
5317 VALGRIND_CALL_NOREDIR_T9 \
5318 "addu $29, $29, 32 \n\t" \
5319 "lw $28, 0($29) \n\t" \
5320 "lw $31, 4($29) \n\t" \
5321 "addu $29, $29, 8 \n\t" \
5324 : "0" (&_argvec[0]) \
5325 : "memory", __CALLER_SAVED_REGS \
5327 lval = (__typeof__(lval)) _res; \
5330#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5333 volatile OrigFn _orig = (orig); \
5334 volatile unsigned long _argvec[8]; \
5335 volatile unsigned long _res; \
5336 _argvec[0] = (unsigned long)_orig.nraddr; \
5337 _argvec[1] = (unsigned long)(arg1); \
5338 _argvec[2] = (unsigned long)(arg2); \
5339 _argvec[3] = (unsigned long)(arg3); \
5340 _argvec[4] = (unsigned long)(arg4); \
5341 _argvec[5] = (unsigned long)(arg5); \
5342 _argvec[6] = (unsigned long)(arg6); \
5343 _argvec[7] = (unsigned long)(arg7); \
5345 "subu $29, $29, 8 \n\t" \
5346 "sw $28, 0($29) \n\t" \
5347 "sw $31, 4($29) \n\t" \
5348 "lw $4, 20(%1) \n\t" \
5349 "subu $29, $29, 32\n\t" \
5350 "sw $4, 16($29) \n\t" \
5351 "lw $4, 24(%1) \n\t" \
5352 "sw $4, 20($29) \n\t" \
5353 "lw $4, 28(%1) \n\t" \
5354 "sw $4, 24($29) \n\t" \
5355 "lw $4, 4(%1) \n\t" \
5356 "lw $5, 8(%1) \n\t" \
5357 "lw $6, 12(%1) \n\t" \
5358 "lw $7, 16(%1) \n\t" \
5359 "lw $25, 0(%1) \n\t" \
5360 VALGRIND_CALL_NOREDIR_T9 \
5361 "addu $29, $29, 32 \n\t" \
5362 "lw $28, 0($29) \n\t" \
5363 "lw $31, 4($29) \n\t" \
5364 "addu $29, $29, 8 \n\t" \
5367 : "0" (&_argvec[0]) \
5368 : "memory", __CALLER_SAVED_REGS \
5370 lval = (__typeof__(lval)) _res; \
5373#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5376 volatile OrigFn _orig = (orig); \
5377 volatile unsigned long _argvec[9]; \
5378 volatile unsigned long _res; \
5379 _argvec[0] = (unsigned long)_orig.nraddr; \
5380 _argvec[1] = (unsigned long)(arg1); \
5381 _argvec[2] = (unsigned long)(arg2); \
5382 _argvec[3] = (unsigned long)(arg3); \
5383 _argvec[4] = (unsigned long)(arg4); \
5384 _argvec[5] = (unsigned long)(arg5); \
5385 _argvec[6] = (unsigned long)(arg6); \
5386 _argvec[7] = (unsigned long)(arg7); \
5387 _argvec[8] = (unsigned long)(arg8); \
5389 "subu $29, $29, 8 \n\t" \
5390 "sw $28, 0($29) \n\t" \
5391 "sw $31, 4($29) \n\t" \
5392 "lw $4, 20(%1) \n\t" \
5393 "subu $29, $29, 40\n\t" \
5394 "sw $4, 16($29) \n\t" \
5395 "lw $4, 24(%1) \n\t" \
5396 "sw $4, 20($29) \n\t" \
5397 "lw $4, 28(%1) \n\t" \
5398 "sw $4, 24($29) \n\t" \
5399 "lw $4, 32(%1) \n\t" \
5400 "sw $4, 28($29) \n\t" \
5401 "lw $4, 4(%1) \n\t" \
5402 "lw $5, 8(%1) \n\t" \
5403 "lw $6, 12(%1) \n\t" \
5404 "lw $7, 16(%1) \n\t" \
5405 "lw $25, 0(%1) \n\t" \
5406 VALGRIND_CALL_NOREDIR_T9 \
5407 "addu $29, $29, 40 \n\t" \
5408 "lw $28, 0($29) \n\t" \
5409 "lw $31, 4($29) \n\t" \
5410 "addu $29, $29, 8 \n\t" \
5413 : "0" (&_argvec[0]) \
5414 : "memory", __CALLER_SAVED_REGS \
5416 lval = (__typeof__(lval)) _res; \
5419#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5422 volatile OrigFn _orig = (orig); \
5423 volatile unsigned long _argvec[10]; \
5424 volatile unsigned long _res; \
5425 _argvec[0] = (unsigned long)_orig.nraddr; \
5426 _argvec[1] = (unsigned long)(arg1); \
5427 _argvec[2] = (unsigned long)(arg2); \
5428 _argvec[3] = (unsigned long)(arg3); \
5429 _argvec[4] = (unsigned long)(arg4); \
5430 _argvec[5] = (unsigned long)(arg5); \
5431 _argvec[6] = (unsigned long)(arg6); \
5432 _argvec[7] = (unsigned long)(arg7); \
5433 _argvec[8] = (unsigned long)(arg8); \
5434 _argvec[9] = (unsigned long)(arg9); \
5436 "subu $29, $29, 8 \n\t" \
5437 "sw $28, 0($29) \n\t" \
5438 "sw $31, 4($29) \n\t" \
5439 "lw $4, 20(%1) \n\t" \
5440 "subu $29, $29, 40\n\t" \
5441 "sw $4, 16($29) \n\t" \
5442 "lw $4, 24(%1) \n\t" \
5443 "sw $4, 20($29) \n\t" \
5444 "lw $4, 28(%1) \n\t" \
5445 "sw $4, 24($29) \n\t" \
5446 "lw $4, 32(%1) \n\t" \
5447 "sw $4, 28($29) \n\t" \
5448 "lw $4, 36(%1) \n\t" \
5449 "sw $4, 32($29) \n\t" \
5450 "lw $4, 4(%1) \n\t" \
5451 "lw $5, 8(%1) \n\t" \
5452 "lw $6, 12(%1) \n\t" \
5453 "lw $7, 16(%1) \n\t" \
5454 "lw $25, 0(%1) \n\t" \
5455 VALGRIND_CALL_NOREDIR_T9 \
5456 "addu $29, $29, 40 \n\t" \
5457 "lw $28, 0($29) \n\t" \
5458 "lw $31, 4($29) \n\t" \
5459 "addu $29, $29, 8 \n\t" \
5462 : "0" (&_argvec[0]) \
5463 : "memory", __CALLER_SAVED_REGS \
5465 lval = (__typeof__(lval)) _res; \
5468#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5469 arg7,arg8,arg9,arg10) \
5471 volatile OrigFn _orig = (orig); \
5472 volatile unsigned long _argvec[11]; \
5473 volatile unsigned long _res; \
5474 _argvec[0] = (unsigned long)_orig.nraddr; \
5475 _argvec[1] = (unsigned long)(arg1); \
5476 _argvec[2] = (unsigned long)(arg2); \
5477 _argvec[3] = (unsigned long)(arg3); \
5478 _argvec[4] = (unsigned long)(arg4); \
5479 _argvec[5] = (unsigned long)(arg5); \
5480 _argvec[6] = (unsigned long)(arg6); \
5481 _argvec[7] = (unsigned long)(arg7); \
5482 _argvec[8] = (unsigned long)(arg8); \
5483 _argvec[9] = (unsigned long)(arg9); \
5484 _argvec[10] = (unsigned long)(arg10); \
5486 "subu $29, $29, 8 \n\t" \
5487 "sw $28, 0($29) \n\t" \
5488 "sw $31, 4($29) \n\t" \
5489 "lw $4, 20(%1) \n\t" \
5490 "subu $29, $29, 48\n\t" \
5491 "sw $4, 16($29) \n\t" \
5492 "lw $4, 24(%1) \n\t" \
5493 "sw $4, 20($29) \n\t" \
5494 "lw $4, 28(%1) \n\t" \
5495 "sw $4, 24($29) \n\t" \
5496 "lw $4, 32(%1) \n\t" \
5497 "sw $4, 28($29) \n\t" \
5498 "lw $4, 36(%1) \n\t" \
5499 "sw $4, 32($29) \n\t" \
5500 "lw $4, 40(%1) \n\t" \
5501 "sw $4, 36($29) \n\t" \
5502 "lw $4, 4(%1) \n\t" \
5503 "lw $5, 8(%1) \n\t" \
5504 "lw $6, 12(%1) \n\t" \
5505 "lw $7, 16(%1) \n\t" \
5506 "lw $25, 0(%1) \n\t" \
5507 VALGRIND_CALL_NOREDIR_T9 \
5508 "addu $29, $29, 48 \n\t" \
5509 "lw $28, 0($29) \n\t" \
5510 "lw $31, 4($29) \n\t" \
5511 "addu $29, $29, 8 \n\t" \
5514 : "0" (&_argvec[0]) \
5515 : "memory", __CALLER_SAVED_REGS \
5517 lval = (__typeof__(lval)) _res; \
5520#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
5521 arg6,arg7,arg8,arg9,arg10, \
5524 volatile OrigFn _orig = (orig); \
5525 volatile unsigned long _argvec[12]; \
5526 volatile unsigned long _res; \
5527 _argvec[0] = (unsigned long)_orig.nraddr; \
5528 _argvec[1] = (unsigned long)(arg1); \
5529 _argvec[2] = (unsigned long)(arg2); \
5530 _argvec[3] = (unsigned long)(arg3); \
5531 _argvec[4] = (unsigned long)(arg4); \
5532 _argvec[5] = (unsigned long)(arg5); \
5533 _argvec[6] = (unsigned long)(arg6); \
5534 _argvec[7] = (unsigned long)(arg7); \
5535 _argvec[8] = (unsigned long)(arg8); \
5536 _argvec[9] = (unsigned long)(arg9); \
5537 _argvec[10] = (unsigned long)(arg10); \
5538 _argvec[11] = (unsigned long)(arg11); \
5540 "subu $29, $29, 8 \n\t" \
5541 "sw $28, 0($29) \n\t" \
5542 "sw $31, 4($29) \n\t" \
5543 "lw $4, 20(%1) \n\t" \
5544 "subu $29, $29, 48\n\t" \
5545 "sw $4, 16($29) \n\t" \
5546 "lw $4, 24(%1) \n\t" \
5547 "sw $4, 20($29) \n\t" \
5548 "lw $4, 28(%1) \n\t" \
5549 "sw $4, 24($29) \n\t" \
5550 "lw $4, 32(%1) \n\t" \
5551 "sw $4, 28($29) \n\t" \
5552 "lw $4, 36(%1) \n\t" \
5553 "sw $4, 32($29) \n\t" \
5554 "lw $4, 40(%1) \n\t" \
5555 "sw $4, 36($29) \n\t" \
5556 "lw $4, 44(%1) \n\t" \
5557 "sw $4, 40($29) \n\t" \
5558 "lw $4, 4(%1) \n\t" \
5559 "lw $5, 8(%1) \n\t" \
5560 "lw $6, 12(%1) \n\t" \
5561 "lw $7, 16(%1) \n\t" \
5562 "lw $25, 0(%1) \n\t" \
5563 VALGRIND_CALL_NOREDIR_T9 \
5564 "addu $29, $29, 48 \n\t" \
5565 "lw $28, 0($29) \n\t" \
5566 "lw $31, 4($29) \n\t" \
5567 "addu $29, $29, 8 \n\t" \
5570 : "0" (&_argvec[0]) \
5571 : "memory", __CALLER_SAVED_REGS \
5573 lval = (__typeof__(lval)) _res; \
5576#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
5577 arg6,arg7,arg8,arg9,arg10, \
5580 volatile OrigFn _orig = (orig); \
5581 volatile unsigned long _argvec[13]; \
5582 volatile unsigned long _res; \
5583 _argvec[0] = (unsigned long)_orig.nraddr; \
5584 _argvec[1] = (unsigned long)(arg1); \
5585 _argvec[2] = (unsigned long)(arg2); \
5586 _argvec[3] = (unsigned long)(arg3); \
5587 _argvec[4] = (unsigned long)(arg4); \
5588 _argvec[5] = (unsigned long)(arg5); \
5589 _argvec[6] = (unsigned long)(arg6); \
5590 _argvec[7] = (unsigned long)(arg7); \
5591 _argvec[8] = (unsigned long)(arg8); \
5592 _argvec[9] = (unsigned long)(arg9); \
5593 _argvec[10] = (unsigned long)(arg10); \
5594 _argvec[11] = (unsigned long)(arg11); \
5595 _argvec[12] = (unsigned long)(arg12); \
5597 "subu $29, $29, 8 \n\t" \
5598 "sw $28, 0($29) \n\t" \
5599 "sw $31, 4($29) \n\t" \
5600 "lw $4, 20(%1) \n\t" \
5601 "subu $29, $29, 56\n\t" \
5602 "sw $4, 16($29) \n\t" \
5603 "lw $4, 24(%1) \n\t" \
5604 "sw $4, 20($29) \n\t" \
5605 "lw $4, 28(%1) \n\t" \
5606 "sw $4, 24($29) \n\t" \
5607 "lw $4, 32(%1) \n\t" \
5608 "sw $4, 28($29) \n\t" \
5609 "lw $4, 36(%1) \n\t" \
5610 "sw $4, 32($29) \n\t" \
5611 "lw $4, 40(%1) \n\t" \
5612 "sw $4, 36($29) \n\t" \
5613 "lw $4, 44(%1) \n\t" \
5614 "sw $4, 40($29) \n\t" \
5615 "lw $4, 48(%1) \n\t" \
5616 "sw $4, 44($29) \n\t" \
5617 "lw $4, 4(%1) \n\t" \
5618 "lw $5, 8(%1) \n\t" \
5619 "lw $6, 12(%1) \n\t" \
5620 "lw $7, 16(%1) \n\t" \
5621 "lw $25, 0(%1) \n\t" \
5622 VALGRIND_CALL_NOREDIR_T9 \
5623 "addu $29, $29, 56 \n\t" \
5624 "lw $28, 0($29) \n\t" \
5625 "lw $31, 4($29) \n\t" \
5626 "addu $29, $29, 8 \n\t" \
5629 : "r" (&_argvec[0]) \
5630 : "memory", __CALLER_SAVED_REGS \
5632 lval = (__typeof__(lval)) _res; \
5639#if defined(PLAT_mips64_linux)
5642#define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6", \
5643"$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
5649#define MIPS64_LONG2REG_CAST(x) ((long long)(long)x)
5651#define CALL_FN_W_v(lval, orig) \
5653 volatile OrigFn _orig = (orig); \
5654 volatile unsigned long long _argvec[1]; \
5655 volatile unsigned long long _res; \
5656 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5658 "ld $25, 0(%1)\n\t" \
5659 VALGRIND_CALL_NOREDIR_T9 \
5662 : "0" (&_argvec[0]) \
5663 : "memory", __CALLER_SAVED_REGS \
5665 lval = (__typeof__(lval)) (long)_res; \
5668#define CALL_FN_W_W(lval, orig, arg1) \
5670 volatile OrigFn _orig = (orig); \
5671 volatile unsigned long long _argvec[2]; \
5672 volatile unsigned long long _res; \
5673 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5674 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5676 "ld $4, 8(%1)\n\t" \
5677 "ld $25, 0(%1)\n\t" \
5678 VALGRIND_CALL_NOREDIR_T9 \
5681 : "r" (&_argvec[0]) \
5682 : "memory", __CALLER_SAVED_REGS \
5684 lval = (__typeof__(lval)) (long)_res; \
5687#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
5689 volatile OrigFn _orig = (orig); \
5690 volatile unsigned long long _argvec[3]; \
5691 volatile unsigned long long _res; \
5692 _argvec[0] = _orig.nraddr; \
5693 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5694 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5696 "ld $4, 8(%1)\n\t" \
5697 "ld $5, 16(%1)\n\t" \
5698 "ld $25, 0(%1)\n\t" \
5699 VALGRIND_CALL_NOREDIR_T9 \
5702 : "r" (&_argvec[0]) \
5703 : "memory", __CALLER_SAVED_REGS \
5705 lval = (__typeof__(lval)) (long)_res; \
5709#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
5711 volatile OrigFn _orig = (orig); \
5712 volatile unsigned long long _argvec[4]; \
5713 volatile unsigned long long _res; \
5714 _argvec[0] = _orig.nraddr; \
5715 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5716 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5717 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5719 "ld $4, 8(%1)\n\t" \
5720 "ld $5, 16(%1)\n\t" \
5721 "ld $6, 24(%1)\n\t" \
5722 "ld $25, 0(%1)\n\t" \
5723 VALGRIND_CALL_NOREDIR_T9 \
5726 : "r" (&_argvec[0]) \
5727 : "memory", __CALLER_SAVED_REGS \
5729 lval = (__typeof__(lval)) (long)_res; \
5732#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
5734 volatile OrigFn _orig = (orig); \
5735 volatile unsigned long long _argvec[5]; \
5736 volatile unsigned long long _res; \
5737 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5738 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5739 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5740 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5741 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5743 "ld $4, 8(%1)\n\t" \
5744 "ld $5, 16(%1)\n\t" \
5745 "ld $6, 24(%1)\n\t" \
5746 "ld $7, 32(%1)\n\t" \
5747 "ld $25, 0(%1)\n\t" \
5748 VALGRIND_CALL_NOREDIR_T9 \
5751 : "r" (&_argvec[0]) \
5752 : "memory", __CALLER_SAVED_REGS \
5754 lval = (__typeof__(lval)) (long)_res; \
5757#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
5759 volatile OrigFn _orig = (orig); \
5760 volatile unsigned long long _argvec[6]; \
5761 volatile unsigned long long _res; \
5762 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5763 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5764 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5765 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5766 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5767 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5769 "ld $4, 8(%1)\n\t" \
5770 "ld $5, 16(%1)\n\t" \
5771 "ld $6, 24(%1)\n\t" \
5772 "ld $7, 32(%1)\n\t" \
5773 "ld $8, 40(%1)\n\t" \
5774 "ld $25, 0(%1)\n\t" \
5775 VALGRIND_CALL_NOREDIR_T9 \
5778 : "r" (&_argvec[0]) \
5779 : "memory", __CALLER_SAVED_REGS \
5781 lval = (__typeof__(lval)) (long)_res; \
5784#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
5786 volatile OrigFn _orig = (orig); \
5787 volatile unsigned long long _argvec[7]; \
5788 volatile unsigned long long _res; \
5789 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5790 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5791 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5792 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5793 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5794 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5795 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5797 "ld $4, 8(%1)\n\t" \
5798 "ld $5, 16(%1)\n\t" \
5799 "ld $6, 24(%1)\n\t" \
5800 "ld $7, 32(%1)\n\t" \
5801 "ld $8, 40(%1)\n\t" \
5802 "ld $9, 48(%1)\n\t" \
5803 "ld $25, 0(%1)\n\t" \
5804 VALGRIND_CALL_NOREDIR_T9 \
5807 : "r" (&_argvec[0]) \
5808 : "memory", __CALLER_SAVED_REGS \
5810 lval = (__typeof__(lval)) (long)_res; \
5813#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5816 volatile OrigFn _orig = (orig); \
5817 volatile unsigned long long _argvec[8]; \
5818 volatile unsigned long long _res; \
5819 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5820 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5821 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5822 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5823 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5824 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5825 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5826 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
5828 "ld $4, 8(%1)\n\t" \
5829 "ld $5, 16(%1)\n\t" \
5830 "ld $6, 24(%1)\n\t" \
5831 "ld $7, 32(%1)\n\t" \
5832 "ld $8, 40(%1)\n\t" \
5833 "ld $9, 48(%1)\n\t" \
5834 "ld $10, 56(%1)\n\t" \
5835 "ld $25, 0(%1) \n\t" \
5836 VALGRIND_CALL_NOREDIR_T9 \
5839 : "r" (&_argvec[0]) \
5840 : "memory", __CALLER_SAVED_REGS \
5842 lval = (__typeof__(lval)) (long)_res; \
5845#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5848 volatile OrigFn _orig = (orig); \
5849 volatile unsigned long long _argvec[9]; \
5850 volatile unsigned long long _res; \
5851 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5852 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5853 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5854 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5855 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5856 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5857 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5858 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
5859 _argvec[8] = MIPS64_LONG2REG_CAST(arg8); \
5861 "ld $4, 8(%1)\n\t" \
5862 "ld $5, 16(%1)\n\t" \
5863 "ld $6, 24(%1)\n\t" \
5864 "ld $7, 32(%1)\n\t" \
5865 "ld $8, 40(%1)\n\t" \
5866 "ld $9, 48(%1)\n\t" \
5867 "ld $10, 56(%1)\n\t" \
5868 "ld $11, 64(%1)\n\t" \
5869 "ld $25, 0(%1) \n\t" \
5870 VALGRIND_CALL_NOREDIR_T9 \
5873 : "r" (&_argvec[0]) \
5874 : "memory", __CALLER_SAVED_REGS \
5876 lval = (__typeof__(lval)) (long)_res; \
5879#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5882 volatile OrigFn _orig = (orig); \
5883 volatile unsigned long long _argvec[10]; \
5884 volatile unsigned long long _res; \
5885 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5886 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5887 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5888 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5889 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5890 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5891 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5892 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
5893 _argvec[8] = MIPS64_LONG2REG_CAST(arg8); \
5894 _argvec[9] = MIPS64_LONG2REG_CAST(arg9); \
5896 "dsubu $29, $29, 8\n\t" \
5897 "ld $4, 72(%1)\n\t" \
5898 "sd $4, 0($29)\n\t" \
5899 "ld $4, 8(%1)\n\t" \
5900 "ld $5, 16(%1)\n\t" \
5901 "ld $6, 24(%1)\n\t" \
5902 "ld $7, 32(%1)\n\t" \
5903 "ld $8, 40(%1)\n\t" \
5904 "ld $9, 48(%1)\n\t" \
5905 "ld $10, 56(%1)\n\t" \
5906 "ld $11, 64(%1)\n\t" \
5907 "ld $25, 0(%1)\n\t" \
5908 VALGRIND_CALL_NOREDIR_T9 \
5909 "daddu $29, $29, 8\n\t" \
5912 : "r" (&_argvec[0]) \
5913 : "memory", __CALLER_SAVED_REGS \
5915 lval = (__typeof__(lval)) (long)_res; \
5918#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
5919 arg7,arg8,arg9,arg10) \
5921 volatile OrigFn _orig = (orig); \
5922 volatile unsigned long long _argvec[11]; \
5923 volatile unsigned long long _res; \
5924 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5925 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5926 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5927 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5928 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5929 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5930 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5931 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
5932 _argvec[8] = MIPS64_LONG2REG_CAST(arg8); \
5933 _argvec[9] = MIPS64_LONG2REG_CAST(arg9); \
5934 _argvec[10] = MIPS64_LONG2REG_CAST(arg10); \
5936 "dsubu $29, $29, 16\n\t" \
5937 "ld $4, 72(%1)\n\t" \
5938 "sd $4, 0($29)\n\t" \
5939 "ld $4, 80(%1)\n\t" \
5940 "sd $4, 8($29)\n\t" \
5941 "ld $4, 8(%1)\n\t" \
5942 "ld $5, 16(%1)\n\t" \
5943 "ld $6, 24(%1)\n\t" \
5944 "ld $7, 32(%1)\n\t" \
5945 "ld $8, 40(%1)\n\t" \
5946 "ld $9, 48(%1)\n\t" \
5947 "ld $10, 56(%1)\n\t" \
5948 "ld $11, 64(%1)\n\t" \
5949 "ld $25, 0(%1)\n\t" \
5950 VALGRIND_CALL_NOREDIR_T9 \
5951 "daddu $29, $29, 16\n\t" \
5954 : "r" (&_argvec[0]) \
5955 : "memory", __CALLER_SAVED_REGS \
5957 lval = (__typeof__(lval)) (long)_res; \
5960#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
5961 arg6,arg7,arg8,arg9,arg10, \
5964 volatile OrigFn _orig = (orig); \
5965 volatile unsigned long long _argvec[12]; \
5966 volatile unsigned long long _res; \
5967 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
5968 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
5969 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
5970 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
5971 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
5972 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
5973 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
5974 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
5975 _argvec[8] = MIPS64_LONG2REG_CAST(arg8); \
5976 _argvec[9] = MIPS64_LONG2REG_CAST(arg9); \
5977 _argvec[10] = MIPS64_LONG2REG_CAST(arg10); \
5978 _argvec[11] = MIPS64_LONG2REG_CAST(arg11); \
5980 "dsubu $29, $29, 24\n\t" \
5981 "ld $4, 72(%1)\n\t" \
5982 "sd $4, 0($29)\n\t" \
5983 "ld $4, 80(%1)\n\t" \
5984 "sd $4, 8($29)\n\t" \
5985 "ld $4, 88(%1)\n\t" \
5986 "sd $4, 16($29)\n\t" \
5987 "ld $4, 8(%1)\n\t" \
5988 "ld $5, 16(%1)\n\t" \
5989 "ld $6, 24(%1)\n\t" \
5990 "ld $7, 32(%1)\n\t" \
5991 "ld $8, 40(%1)\n\t" \
5992 "ld $9, 48(%1)\n\t" \
5993 "ld $10, 56(%1)\n\t" \
5994 "ld $11, 64(%1)\n\t" \
5995 "ld $25, 0(%1)\n\t" \
5996 VALGRIND_CALL_NOREDIR_T9 \
5997 "daddu $29, $29, 24\n\t" \
6000 : "r" (&_argvec[0]) \
6001 : "memory", __CALLER_SAVED_REGS \
6003 lval = (__typeof__(lval)) (long)_res; \
6006#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
6007 arg6,arg7,arg8,arg9,arg10, \
6010 volatile OrigFn _orig = (orig); \
6011 volatile unsigned long long _argvec[13]; \
6012 volatile unsigned long long _res; \
6013 _argvec[0] = MIPS64_LONG2REG_CAST(_orig.nraddr); \
6014 _argvec[1] = MIPS64_LONG2REG_CAST(arg1); \
6015 _argvec[2] = MIPS64_LONG2REG_CAST(arg2); \
6016 _argvec[3] = MIPS64_LONG2REG_CAST(arg3); \
6017 _argvec[4] = MIPS64_LONG2REG_CAST(arg4); \
6018 _argvec[5] = MIPS64_LONG2REG_CAST(arg5); \
6019 _argvec[6] = MIPS64_LONG2REG_CAST(arg6); \
6020 _argvec[7] = MIPS64_LONG2REG_CAST(arg7); \
6021 _argvec[8] = MIPS64_LONG2REG_CAST(arg8); \
6022 _argvec[9] = MIPS64_LONG2REG_CAST(arg9); \
6023 _argvec[10] = MIPS64_LONG2REG_CAST(arg10); \
6024 _argvec[11] = MIPS64_LONG2REG_CAST(arg11); \
6025 _argvec[12] = MIPS64_LONG2REG_CAST(arg12); \
6027 "dsubu $29, $29, 32\n\t" \
6028 "ld $4, 72(%1)\n\t" \
6029 "sd $4, 0($29)\n\t" \
6030 "ld $4, 80(%1)\n\t" \
6031 "sd $4, 8($29)\n\t" \
6032 "ld $4, 88(%1)\n\t" \
6033 "sd $4, 16($29)\n\t" \
6034 "ld $4, 96(%1)\n\t" \
6035 "sd $4, 24($29)\n\t" \
6036 "ld $4, 8(%1)\n\t" \
6037 "ld $5, 16(%1)\n\t" \
6038 "ld $6, 24(%1)\n\t" \
6039 "ld $7, 32(%1)\n\t" \
6040 "ld $8, 40(%1)\n\t" \
6041 "ld $9, 48(%1)\n\t" \
6042 "ld $10, 56(%1)\n\t" \
6043 "ld $11, 64(%1)\n\t" \
6044 "ld $25, 0(%1)\n\t" \
6045 VALGRIND_CALL_NOREDIR_T9 \
6046 "daddu $29, $29, 32\n\t" \
6049 : "r" (&_argvec[0]) \
6050 : "memory", __CALLER_SAVED_REGS \
6052 lval = (__typeof__(lval)) (long)_res; \
6072#define VG_USERREQ_TOOL_BASE(a,b) \
6073 ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
6074#define VG_IS_TOOL_USERREQ(a, b, v) \
6075 (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
6083 enum { VG_USERREQ__RUNNING_ON_VALGRIND = 0x1001,
6084 VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002,
6091 VG_USERREQ__CLIENT_CALL0 = 0x1101,
6092 VG_USERREQ__CLIENT_CALL1 = 0x1102,
6093 VG_USERREQ__CLIENT_CALL2 = 0x1103,
6094 VG_USERREQ__CLIENT_CALL3 = 0x1104,
6099 VG_USERREQ__COUNT_ERRORS = 0x1201,
6103 VG_USERREQ__GDB_MONITOR_COMMAND = 0x1202,
6107 VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
6108 VG_USERREQ__RESIZEINPLACE_BLOCK = 0x130b,
6109 VG_USERREQ__FREELIKE_BLOCK = 0x1302,
6111 VG_USERREQ__CREATE_MEMPOOL = 0x1303,
6112 VG_USERREQ__DESTROY_MEMPOOL = 0x1304,
6113 VG_USERREQ__MEMPOOL_ALLOC = 0x1305,
6114 VG_USERREQ__MEMPOOL_FREE = 0x1306,
6115 VG_USERREQ__MEMPOOL_TRIM = 0x1307,
6116 VG_USERREQ__MOVE_MEMPOOL = 0x1308,
6117 VG_USERREQ__MEMPOOL_CHANGE = 0x1309,
6118 VG_USERREQ__MEMPOOL_EXISTS = 0x130a,
6127 VG_USERREQ__PRINTF = 0x1401,
6128 VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
6130 VG_USERREQ__PRINTF_VALIST_BY_REF = 0x1403,
6131 VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF = 0x1404,
6134 VG_USERREQ__STACK_REGISTER = 0x1501,
6135 VG_USERREQ__STACK_DEREGISTER = 0x1502,
6136 VG_USERREQ__STACK_CHANGE = 0x1503,
6139 VG_USERREQ__LOAD_PDB_DEBUGINFO = 0x1601,
6142 VG_USERREQ__MAP_IP_TO_SRCLOC = 0x1701,
6149 VG_USERREQ__CHANGE_ERR_DISABLEMENT = 0x1801,
6154 VG_USERREQ__VEX_INIT_FOR_IRI = 0x1901,
6157 VG_USERREQ__INNER_THREADS = 0x1902,
6160#if !defined(__GNUC__)
6161# define __extension__
6169#define RUNNING_ON_VALGRIND \
6170 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
6171 VG_USERREQ__RUNNING_ON_VALGRIND, \
6179#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
6180 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DISCARD_TRANSLATIONS, \
6181 _qzz_addr, _qzz_len, 0, 0, 0)
6183#define VALGRIND_INNER_THREADS(_qzz_addr) \
6184 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__INNER_THREADS, \
6185 _qzz_addr, 0, 0, 0, 0)
6193#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
6196static int VALGRIND_PRINTF(
const char *format, ...)
6197 __attribute__((format(__printf__, 1, 2), __unused__));
6200#if defined(_MSC_VER)
6203VALGRIND_PRINTF(
const char *format, ...)
6205#if defined(NVALGRIND)
6209#if defined(_MSC_VER) || defined(__MINGW64__)
6212 unsigned long _qzz_res;
6215 va_start(vargs, format);
6216#if defined(_MSC_VER) || defined(__MINGW64__)
6217 _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
6218 VG_USERREQ__PRINTF_VALIST_BY_REF,
6223 _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
6224 VG_USERREQ__PRINTF_VALIST_BY_REF,
6225 (
unsigned long)format,
6226 (
unsigned long)&vargs,
6230 return (
int)_qzz_res;
6234#if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
6235static int VALGRIND_PRINTF_BACKTRACE(
const char *format, ...)
6236 __attribute__((format(__printf__, 1, 2), __unused__));
6239#if defined(_MSC_VER)
6242VALGRIND_PRINTF_BACKTRACE(
const char *format, ...)
6244#if defined(NVALGRIND)
6248#if defined(_MSC_VER) || defined(__MINGW64__)
6251 unsigned long _qzz_res;
6254 va_start(vargs, format);
6255#if defined(_MSC_VER) || defined(__MINGW64__)
6256 _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
6257 VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
6262 _qzz_res = VALGRIND_DO_CLIENT_REQUEST_EXPR(0,
6263 VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF,
6264 (
unsigned long)format,
6265 (
unsigned long)&vargs,
6269 return (
int)_qzz_res;
6297#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
6298 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
6299 VG_USERREQ__CLIENT_CALL0, \
6303#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
6304 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
6305 VG_USERREQ__CLIENT_CALL1, \
6309#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
6310 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
6311 VG_USERREQ__CLIENT_CALL2, \
6313 _qyy_arg1, _qyy_arg2, 0, 0)
6315#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
6316 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
6317 VG_USERREQ__CLIENT_CALL3, \
6319 _qyy_arg1, _qyy_arg2, \
6326#define VALGRIND_COUNT_ERRORS \
6327 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR( \
6329 VG_USERREQ__COUNT_ERRORS, \
6433#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
6434 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK, \
6435 addr, sizeB, rzB, is_zeroed, 0)
6440#define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) \
6441 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__RESIZEINPLACE_BLOCK, \
6442 addr, oldSizeB, newSizeB, rzB, 0)
6447#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
6448 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREELIKE_BLOCK, \
6452#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
6453 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
6454 pool, rzB, is_zeroed, 0, 0)
6482#define VALGRIND_MEMPOOL_AUTO_FREE 1
6483#define VALGRIND_MEMPOOL_METAPOOL 2
6484#define VALGRIND_CREATE_MEMPOOL_EXT(pool, rzB, is_zeroed, flags) \
6485 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
6486 pool, rzB, is_zeroed, flags, 0)
6489#define VALGRIND_DESTROY_MEMPOOL(pool) \
6490 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL, \
6494#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
6495 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_ALLOC, \
6496 pool, addr, size, 0, 0)
6499#define VALGRIND_MEMPOOL_FREE(pool, addr) \
6500 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_FREE, \
6501 pool, addr, 0, 0, 0)
6504#define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
6505 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_TRIM, \
6506 pool, addr, size, 0, 0)
6509#define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
6510 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MOVE_MEMPOOL, \
6511 poolA, poolB, 0, 0, 0)
6514#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
6515 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_CHANGE, \
6516 pool, addrA, addrB, size, 0)
6519#define VALGRIND_MEMPOOL_EXISTS(pool) \
6520 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
6521 VG_USERREQ__MEMPOOL_EXISTS, \
6527#define VALGRIND_STACK_REGISTER(start, end) \
6528 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
6529 VG_USERREQ__STACK_REGISTER, \
6530 start, end, 0, 0, 0)
6534#define VALGRIND_STACK_DEREGISTER(id) \
6535 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_DEREGISTER, \
6541#define VALGRIND_STACK_CHANGE(id, start, end) \
6542 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_CHANGE, \
6543 id, start, end, 0, 0)
6546#define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \
6547 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LOAD_PDB_DEBUGINFO, \
6548 fd, ptr, total_size, delta, 0)
6554#define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \
6555 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
6556 VG_USERREQ__MAP_IP_TO_SRCLOC, \
6557 addr, buf64, 0, 0, 0)
6567#define VALGRIND_DISABLE_ERROR_REPORTING \
6568 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
6573#define VALGRIND_ENABLE_ERROR_REPORTING \
6574 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
6582#define VALGRIND_MONITOR_COMMAND(command) \
6583 VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__GDB_MONITOR_COMMAND, \
6584 command, 0, 0, 0, 0)
6587#undef PLAT_x86_darwin
6588#undef PLAT_amd64_darwin
6589#undef PLAT_x86_win32
6590#undef PLAT_amd64_win64
6591#undef PLAT_x86_linux
6592#undef PLAT_amd64_linux
6593#undef PLAT_ppc32_linux
6594#undef PLAT_ppc64be_linux
6595#undef PLAT_ppc64le_linux
6596#undef PLAT_arm_linux
6597#undef PLAT_s390x_linux
6598#undef PLAT_mips32_linux
6599#undef PLAT_mips64_linux
6600#undef PLAT_x86_solaris
6601#undef PLAT_amd64_solaris