89#undef PLAT_amd64_linux
90#undef PLAT_ppc32_linux
91#undef PLAT_ppc64_linux
95#if !defined(_AIX) && defined(__i386__)
96# define PLAT_x86_linux 1
97#elif !defined(_AIX) && defined(__x86_64__)
98# define PLAT_amd64_linux 1
99#elif !defined(_AIX) && defined(__powerpc__) && !defined(__powerpc64__)
100# define PLAT_ppc32_linux 1
101#elif !defined(_AIX) && defined(__powerpc__) && defined(__powerpc64__)
102# define PLAT_ppc64_linux 1
103#elif defined(_AIX) && defined(__64BIT__)
104# define PLAT_ppc64_aix5 1
105#elif defined(_AIX) && !defined(__64BIT__)
106# define PLAT_ppc32_aix5 1
112#if !defined(PLAT_x86_linux) && !defined(PLAT_amd64_linux) \
113 && !defined(PLAT_ppc32_linux) && !defined(PLAT_ppc64_linux) \
114 && !defined(PLAT_ppc32_aix5) && !defined(PLAT_ppc64_aix5)
115# if !defined(NVALGRIND)
126#if defined(NVALGRIND)
131#define VALGRIND_DO_CLIENT_REQUEST( \
132 _zzq_rlval, _zzq_default, _zzq_request, \
133 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
135 (_zzq_rlval) = (_zzq_default); \
177#if defined(PLAT_x86_linux)
185#define __SPECIAL_INSTRUCTION_PREAMBLE \
186 "roll $3, %%edi ; roll $13, %%edi\n\t" \
187 "roll $29, %%edi ; roll $19, %%edi\n\t"
189#define VALGRIND_DO_CLIENT_REQUEST( \
190 _zzq_rlval, _zzq_default, _zzq_request, \
191 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
192 { volatile unsigned int _zzq_args[6]; \
193 volatile unsigned int _zzq_result; \
194 _zzq_args[0] = (unsigned int)(_zzq_request); \
195 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
196 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
197 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
198 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
199 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
200 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
202 "xchgl %%ebx,%%ebx" \
203 : "=d" (_zzq_result) \
204 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
207 _zzq_rlval = _zzq_result; \
210#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
211 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
212 volatile unsigned int __addr; \
213 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
215 "xchgl %%ecx,%%ecx" \
220 _zzq_orig->nraddr = __addr; \
223#define VALGRIND_CALL_NOREDIR_EAX \
224 __SPECIAL_INSTRUCTION_PREAMBLE \
226 "xchgl %%edx,%%edx\n\t"
231#if defined(PLAT_amd64_linux)
235 unsigned long long int nraddr;
239#define __SPECIAL_INSTRUCTION_PREAMBLE \
240 "rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \
241 "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
243#define VALGRIND_DO_CLIENT_REQUEST( \
244 _zzq_rlval, _zzq_default, _zzq_request, \
245 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
246 { volatile unsigned long long int _zzq_args[6]; \
247 volatile unsigned long long int _zzq_result; \
248 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
249 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
250 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
251 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
252 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
253 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
254 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
256 "xchgq %%rbx,%%rbx" \
257 : "=d" (_zzq_result) \
258 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
261 _zzq_rlval = _zzq_result; \
264#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
265 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
266 volatile unsigned long long int __addr; \
267 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
269 "xchgq %%rcx,%%rcx" \
274 _zzq_orig->nraddr = __addr; \
277#define VALGRIND_CALL_NOREDIR_RAX \
278 __SPECIAL_INSTRUCTION_PREAMBLE \
280 "xchgq %%rdx,%%rdx\n\t"
285#if defined(PLAT_ppc32_linux)
293#define __SPECIAL_INSTRUCTION_PREAMBLE \
294 "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
295 "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
297#define VALGRIND_DO_CLIENT_REQUEST( \
298 _zzq_rlval, _zzq_default, _zzq_request, \
299 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
301 { unsigned int _zzq_args[6]; \
302 unsigned int _zzq_result; \
303 unsigned int* _zzq_ptr; \
304 _zzq_args[0] = (unsigned int)(_zzq_request); \
305 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
306 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
307 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
308 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
309 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
310 _zzq_ptr = _zzq_args; \
311 __asm__ volatile("mr 3,%1\n\t" \
313 __SPECIAL_INSTRUCTION_PREAMBLE \
317 : "=b" (_zzq_result) \
318 : "b" (_zzq_default), "b" (_zzq_ptr) \
319 : "cc", "memory", "r3", "r4"); \
320 _zzq_rlval = _zzq_result; \
323#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
324 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
325 unsigned int __addr; \
326 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
332 : "cc", "memory", "r3" \
334 _zzq_orig->nraddr = __addr; \
337#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
338 __SPECIAL_INSTRUCTION_PREAMBLE \
345#if defined(PLAT_ppc64_linux)
349 unsigned long long int nraddr;
350 unsigned long long int r2;
354#define __SPECIAL_INSTRUCTION_PREAMBLE \
355 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
356 "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
358#define VALGRIND_DO_CLIENT_REQUEST( \
359 _zzq_rlval, _zzq_default, _zzq_request, \
360 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
362 { unsigned long long int _zzq_args[6]; \
363 register unsigned long long int _zzq_result __asm__("r3"); \
364 register unsigned long long int* _zzq_ptr __asm__("r4"); \
365 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
366 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
367 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
368 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
369 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
370 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
371 _zzq_ptr = _zzq_args; \
372 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
375 : "=r" (_zzq_result) \
376 : "0" (_zzq_default), "r" (_zzq_ptr) \
378 _zzq_rlval = _zzq_result; \
381#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
382 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
383 register unsigned long long int __addr __asm__("r3"); \
384 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
391 _zzq_orig->nraddr = __addr; \
392 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
399 _zzq_orig->r2 = __addr; \
402#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
403 __SPECIAL_INSTRUCTION_PREAMBLE \
411#if defined(PLAT_ppc32_aix5)
420#define __SPECIAL_INSTRUCTION_PREAMBLE \
421 "rlwinm 0,0,3,0,0 ; rlwinm 0,0,13,0,0\n\t" \
422 "rlwinm 0,0,29,0,0 ; rlwinm 0,0,19,0,0\n\t"
424#define VALGRIND_DO_CLIENT_REQUEST( \
425 _zzq_rlval, _zzq_default, _zzq_request, \
426 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
428 { unsigned int _zzq_args[7]; \
429 register unsigned int _zzq_result; \
430 register unsigned int* _zzq_ptr; \
431 _zzq_args[0] = (unsigned int)(_zzq_request); \
432 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
433 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
434 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
435 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
436 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
437 _zzq_args[6] = (unsigned int)(_zzq_default); \
438 _zzq_ptr = _zzq_args; \
439 __asm__ volatile("mr 4,%1\n\t" \
441 __SPECIAL_INSTRUCTION_PREAMBLE \
445 : "=b" (_zzq_result) \
447 : "r3", "r4", "cc", "memory"); \
448 _zzq_rlval = _zzq_result; \
451#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
452 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
453 register unsigned int __addr; \
454 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
460 : "r3", "cc", "memory" \
462 _zzq_orig->nraddr = __addr; \
463 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
469 : "r3", "cc", "memory" \
471 _zzq_orig->r2 = __addr; \
474#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
475 __SPECIAL_INSTRUCTION_PREAMBLE \
483#if defined(PLAT_ppc64_aix5)
487 unsigned long long int nraddr;
488 unsigned long long int r2;
492#define __SPECIAL_INSTRUCTION_PREAMBLE \
493 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
494 "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
496#define VALGRIND_DO_CLIENT_REQUEST( \
497 _zzq_rlval, _zzq_default, _zzq_request, \
498 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
500 { unsigned long long int _zzq_args[7]; \
501 register unsigned long long int _zzq_result; \
502 register unsigned long long int* _zzq_ptr; \
503 _zzq_args[0] = (unsigned int long long)(_zzq_request); \
504 _zzq_args[1] = (unsigned int long long)(_zzq_arg1); \
505 _zzq_args[2] = (unsigned int long long)(_zzq_arg2); \
506 _zzq_args[3] = (unsigned int long long)(_zzq_arg3); \
507 _zzq_args[4] = (unsigned int long long)(_zzq_arg4); \
508 _zzq_args[5] = (unsigned int long long)(_zzq_arg5); \
509 _zzq_args[6] = (unsigned int long long)(_zzq_default); \
510 _zzq_ptr = _zzq_args; \
511 __asm__ volatile("mr 4,%1\n\t" \
513 __SPECIAL_INSTRUCTION_PREAMBLE \
517 : "=b" (_zzq_result) \
519 : "r3", "r4", "cc", "memory"); \
520 _zzq_rlval = _zzq_result; \
523#define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
524 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
525 register unsigned long long int __addr; \
526 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
532 : "r3", "cc", "memory" \
534 _zzq_orig->nraddr = __addr; \
535 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
541 : "r3", "cc", "memory" \
543 _zzq_orig->r2 = __addr; \
546#define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
547 __SPECIAL_INSTRUCTION_PREAMBLE \
584#define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
585 _vgwZU_##soname##_##fnname
587#define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
588 _vgwZZ_##soname##_##fnname
594#define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval)
599#define CALL_FN_v_v(fnptr) \
600 do { volatile unsigned long _junk; \
601 CALL_FN_W_v(_junk,fnptr); } while (0)
603#define CALL_FN_v_W(fnptr, arg1) \
604 do { volatile unsigned long _junk; \
605 CALL_FN_W_W(_junk,fnptr,arg1); } while (0)
607#define CALL_FN_v_WW(fnptr, arg1,arg2) \
608 do { volatile unsigned long _junk; \
609 CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)
611#define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3) \
612 do { volatile unsigned long _junk; \
613 CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
617#if defined(PLAT_x86_linux)
621#define __CALLER_SAVED_REGS "ecx", "edx"
626#define CALL_FN_W_v(lval, orig) \
628 volatile OrigFn _orig = (orig); \
629 volatile unsigned long _argvec[1]; \
630 volatile unsigned long _res; \
631 _argvec[0] = (unsigned long)_orig.nraddr; \
633 "movl (%%eax), %%eax\n\t" \
634 VALGRIND_CALL_NOREDIR_EAX \
636 : "a" (&_argvec[0]) \
637 : "cc", "memory", __CALLER_SAVED_REGS \
639 lval = (__typeof__(lval)) _res; \
642#define CALL_FN_W_W(lval, orig, arg1) \
644 volatile OrigFn _orig = (orig); \
645 volatile unsigned long _argvec[2]; \
646 volatile unsigned long _res; \
647 _argvec[0] = (unsigned long)_orig.nraddr; \
648 _argvec[1] = (unsigned long)(arg1); \
650 "pushl 4(%%eax)\n\t" \
651 "movl (%%eax), %%eax\n\t" \
652 VALGRIND_CALL_NOREDIR_EAX \
655 : "a" (&_argvec[0]) \
656 : "cc", "memory", __CALLER_SAVED_REGS \
658 lval = (__typeof__(lval)) _res; \
661#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
663 volatile OrigFn _orig = (orig); \
664 volatile unsigned long _argvec[3]; \
665 volatile unsigned long _res; \
666 _argvec[0] = (unsigned long)_orig.nraddr; \
667 _argvec[1] = (unsigned long)(arg1); \
668 _argvec[2] = (unsigned long)(arg2); \
670 "pushl 8(%%eax)\n\t" \
671 "pushl 4(%%eax)\n\t" \
672 "movl (%%eax), %%eax\n\t" \
673 VALGRIND_CALL_NOREDIR_EAX \
676 : "a" (&_argvec[0]) \
677 : "cc", "memory", __CALLER_SAVED_REGS \
679 lval = (__typeof__(lval)) _res; \
682#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
684 volatile OrigFn _orig = (orig); \
685 volatile unsigned long _argvec[4]; \
686 volatile unsigned long _res; \
687 _argvec[0] = (unsigned long)_orig.nraddr; \
688 _argvec[1] = (unsigned long)(arg1); \
689 _argvec[2] = (unsigned long)(arg2); \
690 _argvec[3] = (unsigned long)(arg3); \
692 "pushl 12(%%eax)\n\t" \
693 "pushl 8(%%eax)\n\t" \
694 "pushl 4(%%eax)\n\t" \
695 "movl (%%eax), %%eax\n\t" \
696 VALGRIND_CALL_NOREDIR_EAX \
697 "addl $12, %%esp\n" \
699 : "a" (&_argvec[0]) \
700 : "cc", "memory", __CALLER_SAVED_REGS \
702 lval = (__typeof__(lval)) _res; \
705#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
707 volatile OrigFn _orig = (orig); \
708 volatile unsigned long _argvec[5]; \
709 volatile unsigned long _res; \
710 _argvec[0] = (unsigned long)_orig.nraddr; \
711 _argvec[1] = (unsigned long)(arg1); \
712 _argvec[2] = (unsigned long)(arg2); \
713 _argvec[3] = (unsigned long)(arg3); \
714 _argvec[4] = (unsigned long)(arg4); \
716 "pushl 16(%%eax)\n\t" \
717 "pushl 12(%%eax)\n\t" \
718 "pushl 8(%%eax)\n\t" \
719 "pushl 4(%%eax)\n\t" \
720 "movl (%%eax), %%eax\n\t" \
721 VALGRIND_CALL_NOREDIR_EAX \
722 "addl $16, %%esp\n" \
724 : "a" (&_argvec[0]) \
725 : "cc", "memory", __CALLER_SAVED_REGS \
727 lval = (__typeof__(lval)) _res; \
730#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
732 volatile OrigFn _orig = (orig); \
733 volatile unsigned long _argvec[6]; \
734 volatile unsigned long _res; \
735 _argvec[0] = (unsigned long)_orig.nraddr; \
736 _argvec[1] = (unsigned long)(arg1); \
737 _argvec[2] = (unsigned long)(arg2); \
738 _argvec[3] = (unsigned long)(arg3); \
739 _argvec[4] = (unsigned long)(arg4); \
740 _argvec[5] = (unsigned long)(arg5); \
742 "pushl 20(%%eax)\n\t" \
743 "pushl 16(%%eax)\n\t" \
744 "pushl 12(%%eax)\n\t" \
745 "pushl 8(%%eax)\n\t" \
746 "pushl 4(%%eax)\n\t" \
747 "movl (%%eax), %%eax\n\t" \
748 VALGRIND_CALL_NOREDIR_EAX \
749 "addl $20, %%esp\n" \
751 : "a" (&_argvec[0]) \
752 : "cc", "memory", __CALLER_SAVED_REGS \
754 lval = (__typeof__(lval)) _res; \
757#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
759 volatile OrigFn _orig = (orig); \
760 volatile unsigned long _argvec[7]; \
761 volatile unsigned long _res; \
762 _argvec[0] = (unsigned long)_orig.nraddr; \
763 _argvec[1] = (unsigned long)(arg1); \
764 _argvec[2] = (unsigned long)(arg2); \
765 _argvec[3] = (unsigned long)(arg3); \
766 _argvec[4] = (unsigned long)(arg4); \
767 _argvec[5] = (unsigned long)(arg5); \
768 _argvec[6] = (unsigned long)(arg6); \
770 "pushl 24(%%eax)\n\t" \
771 "pushl 20(%%eax)\n\t" \
772 "pushl 16(%%eax)\n\t" \
773 "pushl 12(%%eax)\n\t" \
774 "pushl 8(%%eax)\n\t" \
775 "pushl 4(%%eax)\n\t" \
776 "movl (%%eax), %%eax\n\t" \
777 VALGRIND_CALL_NOREDIR_EAX \
778 "addl $24, %%esp\n" \
780 : "a" (&_argvec[0]) \
781 : "cc", "memory", __CALLER_SAVED_REGS \
783 lval = (__typeof__(lval)) _res; \
786#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
789 volatile OrigFn _orig = (orig); \
790 volatile unsigned long _argvec[8]; \
791 volatile unsigned long _res; \
792 _argvec[0] = (unsigned long)_orig.nraddr; \
793 _argvec[1] = (unsigned long)(arg1); \
794 _argvec[2] = (unsigned long)(arg2); \
795 _argvec[3] = (unsigned long)(arg3); \
796 _argvec[4] = (unsigned long)(arg4); \
797 _argvec[5] = (unsigned long)(arg5); \
798 _argvec[6] = (unsigned long)(arg6); \
799 _argvec[7] = (unsigned long)(arg7); \
801 "pushl 28(%%eax)\n\t" \
802 "pushl 24(%%eax)\n\t" \
803 "pushl 20(%%eax)\n\t" \
804 "pushl 16(%%eax)\n\t" \
805 "pushl 12(%%eax)\n\t" \
806 "pushl 8(%%eax)\n\t" \
807 "pushl 4(%%eax)\n\t" \
808 "movl (%%eax), %%eax\n\t" \
809 VALGRIND_CALL_NOREDIR_EAX \
810 "addl $28, %%esp\n" \
812 : "a" (&_argvec[0]) \
813 : "cc", "memory", __CALLER_SAVED_REGS \
815 lval = (__typeof__(lval)) _res; \
818#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
821 volatile OrigFn _orig = (orig); \
822 volatile unsigned long _argvec[9]; \
823 volatile unsigned long _res; \
824 _argvec[0] = (unsigned long)_orig.nraddr; \
825 _argvec[1] = (unsigned long)(arg1); \
826 _argvec[2] = (unsigned long)(arg2); \
827 _argvec[3] = (unsigned long)(arg3); \
828 _argvec[4] = (unsigned long)(arg4); \
829 _argvec[5] = (unsigned long)(arg5); \
830 _argvec[6] = (unsigned long)(arg6); \
831 _argvec[7] = (unsigned long)(arg7); \
832 _argvec[8] = (unsigned long)(arg8); \
834 "pushl 32(%%eax)\n\t" \
835 "pushl 28(%%eax)\n\t" \
836 "pushl 24(%%eax)\n\t" \
837 "pushl 20(%%eax)\n\t" \
838 "pushl 16(%%eax)\n\t" \
839 "pushl 12(%%eax)\n\t" \
840 "pushl 8(%%eax)\n\t" \
841 "pushl 4(%%eax)\n\t" \
842 "movl (%%eax), %%eax\n\t" \
843 VALGRIND_CALL_NOREDIR_EAX \
844 "addl $32, %%esp\n" \
846 : "a" (&_argvec[0]) \
847 : "cc", "memory", __CALLER_SAVED_REGS \
849 lval = (__typeof__(lval)) _res; \
852#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
855 volatile OrigFn _orig = (orig); \
856 volatile unsigned long _argvec[10]; \
857 volatile unsigned long _res; \
858 _argvec[0] = (unsigned long)_orig.nraddr; \
859 _argvec[1] = (unsigned long)(arg1); \
860 _argvec[2] = (unsigned long)(arg2); \
861 _argvec[3] = (unsigned long)(arg3); \
862 _argvec[4] = (unsigned long)(arg4); \
863 _argvec[5] = (unsigned long)(arg5); \
864 _argvec[6] = (unsigned long)(arg6); \
865 _argvec[7] = (unsigned long)(arg7); \
866 _argvec[8] = (unsigned long)(arg8); \
867 _argvec[9] = (unsigned long)(arg9); \
869 "pushl 36(%%eax)\n\t" \
870 "pushl 32(%%eax)\n\t" \
871 "pushl 28(%%eax)\n\t" \
872 "pushl 24(%%eax)\n\t" \
873 "pushl 20(%%eax)\n\t" \
874 "pushl 16(%%eax)\n\t" \
875 "pushl 12(%%eax)\n\t" \
876 "pushl 8(%%eax)\n\t" \
877 "pushl 4(%%eax)\n\t" \
878 "movl (%%eax), %%eax\n\t" \
879 VALGRIND_CALL_NOREDIR_EAX \
880 "addl $36, %%esp\n" \
882 : "a" (&_argvec[0]) \
883 : "cc", "memory", __CALLER_SAVED_REGS \
885 lval = (__typeof__(lval)) _res; \
888#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
889 arg7,arg8,arg9,arg10) \
891 volatile OrigFn _orig = (orig); \
892 volatile unsigned long _argvec[11]; \
893 volatile unsigned long _res; \
894 _argvec[0] = (unsigned long)_orig.nraddr; \
895 _argvec[1] = (unsigned long)(arg1); \
896 _argvec[2] = (unsigned long)(arg2); \
897 _argvec[3] = (unsigned long)(arg3); \
898 _argvec[4] = (unsigned long)(arg4); \
899 _argvec[5] = (unsigned long)(arg5); \
900 _argvec[6] = (unsigned long)(arg6); \
901 _argvec[7] = (unsigned long)(arg7); \
902 _argvec[8] = (unsigned long)(arg8); \
903 _argvec[9] = (unsigned long)(arg9); \
904 _argvec[10] = (unsigned long)(arg10); \
906 "pushl 40(%%eax)\n\t" \
907 "pushl 36(%%eax)\n\t" \
908 "pushl 32(%%eax)\n\t" \
909 "pushl 28(%%eax)\n\t" \
910 "pushl 24(%%eax)\n\t" \
911 "pushl 20(%%eax)\n\t" \
912 "pushl 16(%%eax)\n\t" \
913 "pushl 12(%%eax)\n\t" \
914 "pushl 8(%%eax)\n\t" \
915 "pushl 4(%%eax)\n\t" \
916 "movl (%%eax), %%eax\n\t" \
917 VALGRIND_CALL_NOREDIR_EAX \
918 "addl $40, %%esp\n" \
920 : "a" (&_argvec[0]) \
921 : "cc", "memory", __CALLER_SAVED_REGS \
923 lval = (__typeof__(lval)) _res; \
926#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
927 arg6,arg7,arg8,arg9,arg10, \
930 volatile OrigFn _orig = (orig); \
931 volatile unsigned long _argvec[12]; \
932 volatile unsigned long _res; \
933 _argvec[0] = (unsigned long)_orig.nraddr; \
934 _argvec[1] = (unsigned long)(arg1); \
935 _argvec[2] = (unsigned long)(arg2); \
936 _argvec[3] = (unsigned long)(arg3); \
937 _argvec[4] = (unsigned long)(arg4); \
938 _argvec[5] = (unsigned long)(arg5); \
939 _argvec[6] = (unsigned long)(arg6); \
940 _argvec[7] = (unsigned long)(arg7); \
941 _argvec[8] = (unsigned long)(arg8); \
942 _argvec[9] = (unsigned long)(arg9); \
943 _argvec[10] = (unsigned long)(arg10); \
944 _argvec[11] = (unsigned long)(arg11); \
946 "pushl 44(%%eax)\n\t" \
947 "pushl 40(%%eax)\n\t" \
948 "pushl 36(%%eax)\n\t" \
949 "pushl 32(%%eax)\n\t" \
950 "pushl 28(%%eax)\n\t" \
951 "pushl 24(%%eax)\n\t" \
952 "pushl 20(%%eax)\n\t" \
953 "pushl 16(%%eax)\n\t" \
954 "pushl 12(%%eax)\n\t" \
955 "pushl 8(%%eax)\n\t" \
956 "pushl 4(%%eax)\n\t" \
957 "movl (%%eax), %%eax\n\t" \
958 VALGRIND_CALL_NOREDIR_EAX \
959 "addl $44, %%esp\n" \
961 : "a" (&_argvec[0]) \
962 : "cc", "memory", __CALLER_SAVED_REGS \
964 lval = (__typeof__(lval)) _res; \
967#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
968 arg6,arg7,arg8,arg9,arg10, \
971 volatile OrigFn _orig = (orig); \
972 volatile unsigned long _argvec[13]; \
973 volatile unsigned long _res; \
974 _argvec[0] = (unsigned long)_orig.nraddr; \
975 _argvec[1] = (unsigned long)(arg1); \
976 _argvec[2] = (unsigned long)(arg2); \
977 _argvec[3] = (unsigned long)(arg3); \
978 _argvec[4] = (unsigned long)(arg4); \
979 _argvec[5] = (unsigned long)(arg5); \
980 _argvec[6] = (unsigned long)(arg6); \
981 _argvec[7] = (unsigned long)(arg7); \
982 _argvec[8] = (unsigned long)(arg8); \
983 _argvec[9] = (unsigned long)(arg9); \
984 _argvec[10] = (unsigned long)(arg10); \
985 _argvec[11] = (unsigned long)(arg11); \
986 _argvec[12] = (unsigned long)(arg12); \
988 "pushl 48(%%eax)\n\t" \
989 "pushl 44(%%eax)\n\t" \
990 "pushl 40(%%eax)\n\t" \
991 "pushl 36(%%eax)\n\t" \
992 "pushl 32(%%eax)\n\t" \
993 "pushl 28(%%eax)\n\t" \
994 "pushl 24(%%eax)\n\t" \
995 "pushl 20(%%eax)\n\t" \
996 "pushl 16(%%eax)\n\t" \
997 "pushl 12(%%eax)\n\t" \
998 "pushl 8(%%eax)\n\t" \
999 "pushl 4(%%eax)\n\t" \
1000 "movl (%%eax), %%eax\n\t" \
1001 VALGRIND_CALL_NOREDIR_EAX \
1002 "addl $48, %%esp\n" \
1004 : "a" (&_argvec[0]) \
1005 : "cc", "memory", __CALLER_SAVED_REGS \
1007 lval = (__typeof__(lval)) _res; \
1014#if defined(PLAT_amd64_linux)
1019#define __CALLER_SAVED_REGS "rcx", "rdx", "rsi", \
1020 "rdi", "r8", "r9", "r10", "r11"
1046#define CALL_FN_W_v(lval, orig) \
1048 volatile OrigFn _orig = (orig); \
1049 volatile unsigned long _argvec[1]; \
1050 volatile unsigned long _res; \
1051 _argvec[0] = (unsigned long)_orig.nraddr; \
1053 "subq $128,%%rsp\n\t" \
1054 "movq (%%rax), %%rax\n\t" \
1055 VALGRIND_CALL_NOREDIR_RAX \
1056 "addq $128,%%rsp\n\t" \
1058 : "a" (&_argvec[0]) \
1059 : "cc", "memory", __CALLER_SAVED_REGS \
1061 lval = (__typeof__(lval)) _res; \
1064#define CALL_FN_W_W(lval, orig, arg1) \
1066 volatile OrigFn _orig = (orig); \
1067 volatile unsigned long _argvec[2]; \
1068 volatile unsigned long _res; \
1069 _argvec[0] = (unsigned long)_orig.nraddr; \
1070 _argvec[1] = (unsigned long)(arg1); \
1072 "subq $128,%%rsp\n\t" \
1073 "movq 8(%%rax), %%rdi\n\t" \
1074 "movq (%%rax), %%rax\n\t" \
1075 VALGRIND_CALL_NOREDIR_RAX \
1076 "addq $128,%%rsp\n\t" \
1078 : "a" (&_argvec[0]) \
1079 : "cc", "memory", __CALLER_SAVED_REGS \
1081 lval = (__typeof__(lval)) _res; \
1084#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1086 volatile OrigFn _orig = (orig); \
1087 volatile unsigned long _argvec[3]; \
1088 volatile unsigned long _res; \
1089 _argvec[0] = (unsigned long)_orig.nraddr; \
1090 _argvec[1] = (unsigned long)(arg1); \
1091 _argvec[2] = (unsigned long)(arg2); \
1093 "subq $128,%%rsp\n\t" \
1094 "movq 16(%%rax), %%rsi\n\t" \
1095 "movq 8(%%rax), %%rdi\n\t" \
1096 "movq (%%rax), %%rax\n\t" \
1097 VALGRIND_CALL_NOREDIR_RAX \
1098 "addq $128,%%rsp\n\t" \
1100 : "a" (&_argvec[0]) \
1101 : "cc", "memory", __CALLER_SAVED_REGS \
1103 lval = (__typeof__(lval)) _res; \
1106#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1108 volatile OrigFn _orig = (orig); \
1109 volatile unsigned long _argvec[4]; \
1110 volatile unsigned long _res; \
1111 _argvec[0] = (unsigned long)_orig.nraddr; \
1112 _argvec[1] = (unsigned long)(arg1); \
1113 _argvec[2] = (unsigned long)(arg2); \
1114 _argvec[3] = (unsigned long)(arg3); \
1116 "subq $128,%%rsp\n\t" \
1117 "movq 24(%%rax), %%rdx\n\t" \
1118 "movq 16(%%rax), %%rsi\n\t" \
1119 "movq 8(%%rax), %%rdi\n\t" \
1120 "movq (%%rax), %%rax\n\t" \
1121 VALGRIND_CALL_NOREDIR_RAX \
1122 "addq $128,%%rsp\n\t" \
1124 : "a" (&_argvec[0]) \
1125 : "cc", "memory", __CALLER_SAVED_REGS \
1127 lval = (__typeof__(lval)) _res; \
1130#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1132 volatile OrigFn _orig = (orig); \
1133 volatile unsigned long _argvec[5]; \
1134 volatile unsigned long _res; \
1135 _argvec[0] = (unsigned long)_orig.nraddr; \
1136 _argvec[1] = (unsigned long)(arg1); \
1137 _argvec[2] = (unsigned long)(arg2); \
1138 _argvec[3] = (unsigned long)(arg3); \
1139 _argvec[4] = (unsigned long)(arg4); \
1141 "subq $128,%%rsp\n\t" \
1142 "movq 32(%%rax), %%rcx\n\t" \
1143 "movq 24(%%rax), %%rdx\n\t" \
1144 "movq 16(%%rax), %%rsi\n\t" \
1145 "movq 8(%%rax), %%rdi\n\t" \
1146 "movq (%%rax), %%rax\n\t" \
1147 VALGRIND_CALL_NOREDIR_RAX \
1148 "addq $128,%%rsp\n\t" \
1150 : "a" (&_argvec[0]) \
1151 : "cc", "memory", __CALLER_SAVED_REGS \
1153 lval = (__typeof__(lval)) _res; \
1156#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1158 volatile OrigFn _orig = (orig); \
1159 volatile unsigned long _argvec[6]; \
1160 volatile unsigned long _res; \
1161 _argvec[0] = (unsigned long)_orig.nraddr; \
1162 _argvec[1] = (unsigned long)(arg1); \
1163 _argvec[2] = (unsigned long)(arg2); \
1164 _argvec[3] = (unsigned long)(arg3); \
1165 _argvec[4] = (unsigned long)(arg4); \
1166 _argvec[5] = (unsigned long)(arg5); \
1168 "subq $128,%%rsp\n\t" \
1169 "movq 40(%%rax), %%r8\n\t" \
1170 "movq 32(%%rax), %%rcx\n\t" \
1171 "movq 24(%%rax), %%rdx\n\t" \
1172 "movq 16(%%rax), %%rsi\n\t" \
1173 "movq 8(%%rax), %%rdi\n\t" \
1174 "movq (%%rax), %%rax\n\t" \
1175 VALGRIND_CALL_NOREDIR_RAX \
1176 "addq $128,%%rsp\n\t" \
1178 : "a" (&_argvec[0]) \
1179 : "cc", "memory", __CALLER_SAVED_REGS \
1181 lval = (__typeof__(lval)) _res; \
1184#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1186 volatile OrigFn _orig = (orig); \
1187 volatile unsigned long _argvec[7]; \
1188 volatile unsigned long _res; \
1189 _argvec[0] = (unsigned long)_orig.nraddr; \
1190 _argvec[1] = (unsigned long)(arg1); \
1191 _argvec[2] = (unsigned long)(arg2); \
1192 _argvec[3] = (unsigned long)(arg3); \
1193 _argvec[4] = (unsigned long)(arg4); \
1194 _argvec[5] = (unsigned long)(arg5); \
1195 _argvec[6] = (unsigned long)(arg6); \
1197 "subq $128,%%rsp\n\t" \
1198 "movq 48(%%rax), %%r9\n\t" \
1199 "movq 40(%%rax), %%r8\n\t" \
1200 "movq 32(%%rax), %%rcx\n\t" \
1201 "movq 24(%%rax), %%rdx\n\t" \
1202 "movq 16(%%rax), %%rsi\n\t" \
1203 "movq 8(%%rax), %%rdi\n\t" \
1204 "movq (%%rax), %%rax\n\t" \
1205 "addq $128,%%rsp\n\t" \
1206 VALGRIND_CALL_NOREDIR_RAX \
1208 : "a" (&_argvec[0]) \
1209 : "cc", "memory", __CALLER_SAVED_REGS \
1211 lval = (__typeof__(lval)) _res; \
1214#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1217 volatile OrigFn _orig = (orig); \
1218 volatile unsigned long _argvec[8]; \
1219 volatile unsigned long _res; \
1220 _argvec[0] = (unsigned long)_orig.nraddr; \
1221 _argvec[1] = (unsigned long)(arg1); \
1222 _argvec[2] = (unsigned long)(arg2); \
1223 _argvec[3] = (unsigned long)(arg3); \
1224 _argvec[4] = (unsigned long)(arg4); \
1225 _argvec[5] = (unsigned long)(arg5); \
1226 _argvec[6] = (unsigned long)(arg6); \
1227 _argvec[7] = (unsigned long)(arg7); \
1229 "subq $128,%%rsp\n\t" \
1230 "pushq 56(%%rax)\n\t" \
1231 "movq 48(%%rax), %%r9\n\t" \
1232 "movq 40(%%rax), %%r8\n\t" \
1233 "movq 32(%%rax), %%rcx\n\t" \
1234 "movq 24(%%rax), %%rdx\n\t" \
1235 "movq 16(%%rax), %%rsi\n\t" \
1236 "movq 8(%%rax), %%rdi\n\t" \
1237 "movq (%%rax), %%rax\n\t" \
1238 VALGRIND_CALL_NOREDIR_RAX \
1239 "addq $8, %%rsp\n" \
1240 "addq $128,%%rsp\n\t" \
1242 : "a" (&_argvec[0]) \
1243 : "cc", "memory", __CALLER_SAVED_REGS \
1245 lval = (__typeof__(lval)) _res; \
1248#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1251 volatile OrigFn _orig = (orig); \
1252 volatile unsigned long _argvec[9]; \
1253 volatile unsigned long _res; \
1254 _argvec[0] = (unsigned long)_orig.nraddr; \
1255 _argvec[1] = (unsigned long)(arg1); \
1256 _argvec[2] = (unsigned long)(arg2); \
1257 _argvec[3] = (unsigned long)(arg3); \
1258 _argvec[4] = (unsigned long)(arg4); \
1259 _argvec[5] = (unsigned long)(arg5); \
1260 _argvec[6] = (unsigned long)(arg6); \
1261 _argvec[7] = (unsigned long)(arg7); \
1262 _argvec[8] = (unsigned long)(arg8); \
1264 "subq $128,%%rsp\n\t" \
1265 "pushq 64(%%rax)\n\t" \
1266 "pushq 56(%%rax)\n\t" \
1267 "movq 48(%%rax), %%r9\n\t" \
1268 "movq 40(%%rax), %%r8\n\t" \
1269 "movq 32(%%rax), %%rcx\n\t" \
1270 "movq 24(%%rax), %%rdx\n\t" \
1271 "movq 16(%%rax), %%rsi\n\t" \
1272 "movq 8(%%rax), %%rdi\n\t" \
1273 "movq (%%rax), %%rax\n\t" \
1274 VALGRIND_CALL_NOREDIR_RAX \
1275 "addq $16, %%rsp\n" \
1276 "addq $128,%%rsp\n\t" \
1278 : "a" (&_argvec[0]) \
1279 : "cc", "memory", __CALLER_SAVED_REGS \
1281 lval = (__typeof__(lval)) _res; \
1284#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1287 volatile OrigFn _orig = (orig); \
1288 volatile unsigned long _argvec[10]; \
1289 volatile unsigned long _res; \
1290 _argvec[0] = (unsigned long)_orig.nraddr; \
1291 _argvec[1] = (unsigned long)(arg1); \
1292 _argvec[2] = (unsigned long)(arg2); \
1293 _argvec[3] = (unsigned long)(arg3); \
1294 _argvec[4] = (unsigned long)(arg4); \
1295 _argvec[5] = (unsigned long)(arg5); \
1296 _argvec[6] = (unsigned long)(arg6); \
1297 _argvec[7] = (unsigned long)(arg7); \
1298 _argvec[8] = (unsigned long)(arg8); \
1299 _argvec[9] = (unsigned long)(arg9); \
1301 "subq $128,%%rsp\n\t" \
1302 "pushq 72(%%rax)\n\t" \
1303 "pushq 64(%%rax)\n\t" \
1304 "pushq 56(%%rax)\n\t" \
1305 "movq 48(%%rax), %%r9\n\t" \
1306 "movq 40(%%rax), %%r8\n\t" \
1307 "movq 32(%%rax), %%rcx\n\t" \
1308 "movq 24(%%rax), %%rdx\n\t" \
1309 "movq 16(%%rax), %%rsi\n\t" \
1310 "movq 8(%%rax), %%rdi\n\t" \
1311 "movq (%%rax), %%rax\n\t" \
1312 VALGRIND_CALL_NOREDIR_RAX \
1313 "addq $24, %%rsp\n" \
1314 "addq $128,%%rsp\n\t" \
1316 : "a" (&_argvec[0]) \
1317 : "cc", "memory", __CALLER_SAVED_REGS \
1319 lval = (__typeof__(lval)) _res; \
1322#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1323 arg7,arg8,arg9,arg10) \
1325 volatile OrigFn _orig = (orig); \
1326 volatile unsigned long _argvec[11]; \
1327 volatile unsigned long _res; \
1328 _argvec[0] = (unsigned long)_orig.nraddr; \
1329 _argvec[1] = (unsigned long)(arg1); \
1330 _argvec[2] = (unsigned long)(arg2); \
1331 _argvec[3] = (unsigned long)(arg3); \
1332 _argvec[4] = (unsigned long)(arg4); \
1333 _argvec[5] = (unsigned long)(arg5); \
1334 _argvec[6] = (unsigned long)(arg6); \
1335 _argvec[7] = (unsigned long)(arg7); \
1336 _argvec[8] = (unsigned long)(arg8); \
1337 _argvec[9] = (unsigned long)(arg9); \
1338 _argvec[10] = (unsigned long)(arg10); \
1340 "subq $128,%%rsp\n\t" \
1341 "pushq 80(%%rax)\n\t" \
1342 "pushq 72(%%rax)\n\t" \
1343 "pushq 64(%%rax)\n\t" \
1344 "pushq 56(%%rax)\n\t" \
1345 "movq 48(%%rax), %%r9\n\t" \
1346 "movq 40(%%rax), %%r8\n\t" \
1347 "movq 32(%%rax), %%rcx\n\t" \
1348 "movq 24(%%rax), %%rdx\n\t" \
1349 "movq 16(%%rax), %%rsi\n\t" \
1350 "movq 8(%%rax), %%rdi\n\t" \
1351 "movq (%%rax), %%rax\n\t" \
1352 VALGRIND_CALL_NOREDIR_RAX \
1353 "addq $32, %%rsp\n" \
1354 "addq $128,%%rsp\n\t" \
1356 : "a" (&_argvec[0]) \
1357 : "cc", "memory", __CALLER_SAVED_REGS \
1359 lval = (__typeof__(lval)) _res; \
1362#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1363 arg7,arg8,arg9,arg10,arg11) \
1365 volatile OrigFn _orig = (orig); \
1366 volatile unsigned long _argvec[12]; \
1367 volatile unsigned long _res; \
1368 _argvec[0] = (unsigned long)_orig.nraddr; \
1369 _argvec[1] = (unsigned long)(arg1); \
1370 _argvec[2] = (unsigned long)(arg2); \
1371 _argvec[3] = (unsigned long)(arg3); \
1372 _argvec[4] = (unsigned long)(arg4); \
1373 _argvec[5] = (unsigned long)(arg5); \
1374 _argvec[6] = (unsigned long)(arg6); \
1375 _argvec[7] = (unsigned long)(arg7); \
1376 _argvec[8] = (unsigned long)(arg8); \
1377 _argvec[9] = (unsigned long)(arg9); \
1378 _argvec[10] = (unsigned long)(arg10); \
1379 _argvec[11] = (unsigned long)(arg11); \
1381 "subq $128,%%rsp\n\t" \
1382 "pushq 88(%%rax)\n\t" \
1383 "pushq 80(%%rax)\n\t" \
1384 "pushq 72(%%rax)\n\t" \
1385 "pushq 64(%%rax)\n\t" \
1386 "pushq 56(%%rax)\n\t" \
1387 "movq 48(%%rax), %%r9\n\t" \
1388 "movq 40(%%rax), %%r8\n\t" \
1389 "movq 32(%%rax), %%rcx\n\t" \
1390 "movq 24(%%rax), %%rdx\n\t" \
1391 "movq 16(%%rax), %%rsi\n\t" \
1392 "movq 8(%%rax), %%rdi\n\t" \
1393 "movq (%%rax), %%rax\n\t" \
1394 VALGRIND_CALL_NOREDIR_RAX \
1395 "addq $40, %%rsp\n" \
1396 "addq $128,%%rsp\n\t" \
1398 : "a" (&_argvec[0]) \
1399 : "cc", "memory", __CALLER_SAVED_REGS \
1401 lval = (__typeof__(lval)) _res; \
1404#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1405 arg7,arg8,arg9,arg10,arg11,arg12) \
1407 volatile OrigFn _orig = (orig); \
1408 volatile unsigned long _argvec[13]; \
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); \
1421 _argvec[11] = (unsigned long)(arg11); \
1422 _argvec[12] = (unsigned long)(arg12); \
1424 "subq $128,%%rsp\n\t" \
1425 "pushq 96(%%rax)\n\t" \
1426 "pushq 88(%%rax)\n\t" \
1427 "pushq 80(%%rax)\n\t" \
1428 "pushq 72(%%rax)\n\t" \
1429 "pushq 64(%%rax)\n\t" \
1430 "pushq 56(%%rax)\n\t" \
1431 "movq 48(%%rax), %%r9\n\t" \
1432 "movq 40(%%rax), %%r8\n\t" \
1433 "movq 32(%%rax), %%rcx\n\t" \
1434 "movq 24(%%rax), %%rdx\n\t" \
1435 "movq 16(%%rax), %%rsi\n\t" \
1436 "movq 8(%%rax), %%rdi\n\t" \
1437 "movq (%%rax), %%rax\n\t" \
1438 VALGRIND_CALL_NOREDIR_RAX \
1439 "addq $48, %%rsp\n" \
1440 "addq $128,%%rsp\n\t" \
1442 : "a" (&_argvec[0]) \
1443 : "cc", "memory", __CALLER_SAVED_REGS \
1445 lval = (__typeof__(lval)) _res; \
1452#if defined(PLAT_ppc32_linux)
1478#define __CALLER_SAVED_REGS \
1479 "lr", "ctr", "xer", \
1480 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
1481 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
1487#define CALL_FN_W_v(lval, orig) \
1489 volatile OrigFn _orig = (orig); \
1490 volatile unsigned long _argvec[1]; \
1491 volatile unsigned long _res; \
1492 _argvec[0] = (unsigned long)_orig.nraddr; \
1495 "lwz 11,0(11)\n\t" \
1496 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1499 : "r" (&_argvec[0]) \
1500 : "cc", "memory", __CALLER_SAVED_REGS \
1502 lval = (__typeof__(lval)) _res; \
1505#define CALL_FN_W_W(lval, orig, arg1) \
1507 volatile OrigFn _orig = (orig); \
1508 volatile unsigned long _argvec[2]; \
1509 volatile unsigned long _res; \
1510 _argvec[0] = (unsigned long)_orig.nraddr; \
1511 _argvec[1] = (unsigned long)arg1; \
1515 "lwz 11,0(11)\n\t" \
1516 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1519 : "r" (&_argvec[0]) \
1520 : "cc", "memory", __CALLER_SAVED_REGS \
1522 lval = (__typeof__(lval)) _res; \
1525#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1527 volatile OrigFn _orig = (orig); \
1528 volatile unsigned long _argvec[3]; \
1529 volatile unsigned long _res; \
1530 _argvec[0] = (unsigned long)_orig.nraddr; \
1531 _argvec[1] = (unsigned long)arg1; \
1532 _argvec[2] = (unsigned long)arg2; \
1537 "lwz 11,0(11)\n\t" \
1538 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1541 : "r" (&_argvec[0]) \
1542 : "cc", "memory", __CALLER_SAVED_REGS \
1544 lval = (__typeof__(lval)) _res; \
1547#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1549 volatile OrigFn _orig = (orig); \
1550 volatile unsigned long _argvec[4]; \
1551 volatile unsigned long _res; \
1552 _argvec[0] = (unsigned long)_orig.nraddr; \
1553 _argvec[1] = (unsigned long)arg1; \
1554 _argvec[2] = (unsigned long)arg2; \
1555 _argvec[3] = (unsigned long)arg3; \
1560 "lwz 5,12(11)\n\t" \
1561 "lwz 11,0(11)\n\t" \
1562 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1565 : "r" (&_argvec[0]) \
1566 : "cc", "memory", __CALLER_SAVED_REGS \
1568 lval = (__typeof__(lval)) _res; \
1571#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1573 volatile OrigFn _orig = (orig); \
1574 volatile unsigned long _argvec[5]; \
1575 volatile unsigned long _res; \
1576 _argvec[0] = (unsigned long)_orig.nraddr; \
1577 _argvec[1] = (unsigned long)arg1; \
1578 _argvec[2] = (unsigned long)arg2; \
1579 _argvec[3] = (unsigned long)arg3; \
1580 _argvec[4] = (unsigned long)arg4; \
1585 "lwz 5,12(11)\n\t" \
1586 "lwz 6,16(11)\n\t" \
1587 "lwz 11,0(11)\n\t" \
1588 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1591 : "r" (&_argvec[0]) \
1592 : "cc", "memory", __CALLER_SAVED_REGS \
1594 lval = (__typeof__(lval)) _res; \
1597#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1599 volatile OrigFn _orig = (orig); \
1600 volatile unsigned long _argvec[6]; \
1601 volatile unsigned long _res; \
1602 _argvec[0] = (unsigned long)_orig.nraddr; \
1603 _argvec[1] = (unsigned long)arg1; \
1604 _argvec[2] = (unsigned long)arg2; \
1605 _argvec[3] = (unsigned long)arg3; \
1606 _argvec[4] = (unsigned long)arg4; \
1607 _argvec[5] = (unsigned long)arg5; \
1612 "lwz 5,12(11)\n\t" \
1613 "lwz 6,16(11)\n\t" \
1614 "lwz 7,20(11)\n\t" \
1615 "lwz 11,0(11)\n\t" \
1616 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1619 : "r" (&_argvec[0]) \
1620 : "cc", "memory", __CALLER_SAVED_REGS \
1622 lval = (__typeof__(lval)) _res; \
1625#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1627 volatile OrigFn _orig = (orig); \
1628 volatile unsigned long _argvec[7]; \
1629 volatile unsigned long _res; \
1630 _argvec[0] = (unsigned long)_orig.nraddr; \
1631 _argvec[1] = (unsigned long)arg1; \
1632 _argvec[2] = (unsigned long)arg2; \
1633 _argvec[3] = (unsigned long)arg3; \
1634 _argvec[4] = (unsigned long)arg4; \
1635 _argvec[5] = (unsigned long)arg5; \
1636 _argvec[6] = (unsigned long)arg6; \
1641 "lwz 5,12(11)\n\t" \
1642 "lwz 6,16(11)\n\t" \
1643 "lwz 7,20(11)\n\t" \
1644 "lwz 8,24(11)\n\t" \
1645 "lwz 11,0(11)\n\t" \
1646 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1649 : "r" (&_argvec[0]) \
1650 : "cc", "memory", __CALLER_SAVED_REGS \
1652 lval = (__typeof__(lval)) _res; \
1655#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1658 volatile OrigFn _orig = (orig); \
1659 volatile unsigned long _argvec[8]; \
1660 volatile unsigned long _res; \
1661 _argvec[0] = (unsigned long)_orig.nraddr; \
1662 _argvec[1] = (unsigned long)arg1; \
1663 _argvec[2] = (unsigned long)arg2; \
1664 _argvec[3] = (unsigned long)arg3; \
1665 _argvec[4] = (unsigned long)arg4; \
1666 _argvec[5] = (unsigned long)arg5; \
1667 _argvec[6] = (unsigned long)arg6; \
1668 _argvec[7] = (unsigned long)arg7; \
1673 "lwz 5,12(11)\n\t" \
1674 "lwz 6,16(11)\n\t" \
1675 "lwz 7,20(11)\n\t" \
1676 "lwz 8,24(11)\n\t" \
1677 "lwz 9,28(11)\n\t" \
1678 "lwz 11,0(11)\n\t" \
1679 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1682 : "r" (&_argvec[0]) \
1683 : "cc", "memory", __CALLER_SAVED_REGS \
1685 lval = (__typeof__(lval)) _res; \
1688#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1691 volatile OrigFn _orig = (orig); \
1692 volatile unsigned long _argvec[9]; \
1693 volatile unsigned long _res; \
1694 _argvec[0] = (unsigned long)_orig.nraddr; \
1695 _argvec[1] = (unsigned long)arg1; \
1696 _argvec[2] = (unsigned long)arg2; \
1697 _argvec[3] = (unsigned long)arg3; \
1698 _argvec[4] = (unsigned long)arg4; \
1699 _argvec[5] = (unsigned long)arg5; \
1700 _argvec[6] = (unsigned long)arg6; \
1701 _argvec[7] = (unsigned long)arg7; \
1702 _argvec[8] = (unsigned long)arg8; \
1707 "lwz 5,12(11)\n\t" \
1708 "lwz 6,16(11)\n\t" \
1709 "lwz 7,20(11)\n\t" \
1710 "lwz 8,24(11)\n\t" \
1711 "lwz 9,28(11)\n\t" \
1712 "lwz 10,32(11)\n\t" \
1713 "lwz 11,0(11)\n\t" \
1714 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1717 : "r" (&_argvec[0]) \
1718 : "cc", "memory", __CALLER_SAVED_REGS \
1720 lval = (__typeof__(lval)) _res; \
1723#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1726 volatile OrigFn _orig = (orig); \
1727 volatile unsigned long _argvec[10]; \
1728 volatile unsigned long _res; \
1729 _argvec[0] = (unsigned long)_orig.nraddr; \
1730 _argvec[1] = (unsigned long)arg1; \
1731 _argvec[2] = (unsigned long)arg2; \
1732 _argvec[3] = (unsigned long)arg3; \
1733 _argvec[4] = (unsigned long)arg4; \
1734 _argvec[5] = (unsigned long)arg5; \
1735 _argvec[6] = (unsigned long)arg6; \
1736 _argvec[7] = (unsigned long)arg7; \
1737 _argvec[8] = (unsigned long)arg8; \
1738 _argvec[9] = (unsigned long)arg9; \
1741 "addi 1,1,-16\n\t" \
1743 "lwz 3,36(11)\n\t" \
1748 "lwz 5,12(11)\n\t" \
1749 "lwz 6,16(11)\n\t" \
1750 "lwz 7,20(11)\n\t" \
1751 "lwz 8,24(11)\n\t" \
1752 "lwz 9,28(11)\n\t" \
1753 "lwz 10,32(11)\n\t" \
1754 "lwz 11,0(11)\n\t" \
1755 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1759 : "r" (&_argvec[0]) \
1760 : "cc", "memory", __CALLER_SAVED_REGS \
1762 lval = (__typeof__(lval)) _res; \
1765#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1766 arg7,arg8,arg9,arg10) \
1768 volatile OrigFn _orig = (orig); \
1769 volatile unsigned long _argvec[11]; \
1770 volatile unsigned long _res; \
1771 _argvec[0] = (unsigned long)_orig.nraddr; \
1772 _argvec[1] = (unsigned long)arg1; \
1773 _argvec[2] = (unsigned long)arg2; \
1774 _argvec[3] = (unsigned long)arg3; \
1775 _argvec[4] = (unsigned long)arg4; \
1776 _argvec[5] = (unsigned long)arg5; \
1777 _argvec[6] = (unsigned long)arg6; \
1778 _argvec[7] = (unsigned long)arg7; \
1779 _argvec[8] = (unsigned long)arg8; \
1780 _argvec[9] = (unsigned long)arg9; \
1781 _argvec[10] = (unsigned long)arg10; \
1784 "addi 1,1,-16\n\t" \
1786 "lwz 3,40(11)\n\t" \
1789 "lwz 3,36(11)\n\t" \
1794 "lwz 5,12(11)\n\t" \
1795 "lwz 6,16(11)\n\t" \
1796 "lwz 7,20(11)\n\t" \
1797 "lwz 8,24(11)\n\t" \
1798 "lwz 9,28(11)\n\t" \
1799 "lwz 10,32(11)\n\t" \
1800 "lwz 11,0(11)\n\t" \
1801 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1805 : "r" (&_argvec[0]) \
1806 : "cc", "memory", __CALLER_SAVED_REGS \
1808 lval = (__typeof__(lval)) _res; \
1811#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1812 arg7,arg8,arg9,arg10,arg11) \
1814 volatile OrigFn _orig = (orig); \
1815 volatile unsigned long _argvec[12]; \
1816 volatile unsigned long _res; \
1817 _argvec[0] = (unsigned long)_orig.nraddr; \
1818 _argvec[1] = (unsigned long)arg1; \
1819 _argvec[2] = (unsigned long)arg2; \
1820 _argvec[3] = (unsigned long)arg3; \
1821 _argvec[4] = (unsigned long)arg4; \
1822 _argvec[5] = (unsigned long)arg5; \
1823 _argvec[6] = (unsigned long)arg6; \
1824 _argvec[7] = (unsigned long)arg7; \
1825 _argvec[8] = (unsigned long)arg8; \
1826 _argvec[9] = (unsigned long)arg9; \
1827 _argvec[10] = (unsigned long)arg10; \
1828 _argvec[11] = (unsigned long)arg11; \
1831 "addi 1,1,-32\n\t" \
1833 "lwz 3,44(11)\n\t" \
1836 "lwz 3,40(11)\n\t" \
1839 "lwz 3,36(11)\n\t" \
1844 "lwz 5,12(11)\n\t" \
1845 "lwz 6,16(11)\n\t" \
1846 "lwz 7,20(11)\n\t" \
1847 "lwz 8,24(11)\n\t" \
1848 "lwz 9,28(11)\n\t" \
1849 "lwz 10,32(11)\n\t" \
1850 "lwz 11,0(11)\n\t" \
1851 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1855 : "r" (&_argvec[0]) \
1856 : "cc", "memory", __CALLER_SAVED_REGS \
1858 lval = (__typeof__(lval)) _res; \
1861#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1862 arg7,arg8,arg9,arg10,arg11,arg12) \
1864 volatile OrigFn _orig = (orig); \
1865 volatile unsigned long _argvec[13]; \
1866 volatile unsigned long _res; \
1867 _argvec[0] = (unsigned long)_orig.nraddr; \
1868 _argvec[1] = (unsigned long)arg1; \
1869 _argvec[2] = (unsigned long)arg2; \
1870 _argvec[3] = (unsigned long)arg3; \
1871 _argvec[4] = (unsigned long)arg4; \
1872 _argvec[5] = (unsigned long)arg5; \
1873 _argvec[6] = (unsigned long)arg6; \
1874 _argvec[7] = (unsigned long)arg7; \
1875 _argvec[8] = (unsigned long)arg8; \
1876 _argvec[9] = (unsigned long)arg9; \
1877 _argvec[10] = (unsigned long)arg10; \
1878 _argvec[11] = (unsigned long)arg11; \
1879 _argvec[12] = (unsigned long)arg12; \
1882 "addi 1,1,-32\n\t" \
1884 "lwz 3,48(11)\n\t" \
1887 "lwz 3,44(11)\n\t" \
1890 "lwz 3,40(11)\n\t" \
1893 "lwz 3,36(11)\n\t" \
1898 "lwz 5,12(11)\n\t" \
1899 "lwz 6,16(11)\n\t" \
1900 "lwz 7,20(11)\n\t" \
1901 "lwz 8,24(11)\n\t" \
1902 "lwz 9,28(11)\n\t" \
1903 "lwz 10,32(11)\n\t" \
1904 "lwz 11,0(11)\n\t" \
1905 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1909 : "r" (&_argvec[0]) \
1910 : "cc", "memory", __CALLER_SAVED_REGS \
1912 lval = (__typeof__(lval)) _res; \
1919#if defined(PLAT_ppc64_linux)
1924#define __CALLER_SAVED_REGS \
1925 "lr", "ctr", "xer", \
1926 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
1927 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
1933#define CALL_FN_W_v(lval, orig) \
1935 volatile OrigFn _orig = (orig); \
1936 volatile unsigned long _argvec[3+0]; \
1937 volatile unsigned long _res; \
1939 _argvec[1] = (unsigned long)_orig.r2; \
1940 _argvec[2] = (unsigned long)_orig.nraddr; \
1943 "std 2,-16(11)\n\t" \
1945 "ld 11, 0(11)\n\t" \
1946 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1951 : "r" (&_argvec[2]) \
1952 : "cc", "memory", __CALLER_SAVED_REGS \
1954 lval = (__typeof__(lval)) _res; \
1957#define CALL_FN_W_W(lval, orig, arg1) \
1959 volatile OrigFn _orig = (orig); \
1960 volatile unsigned long _argvec[3+1]; \
1961 volatile unsigned long _res; \
1963 _argvec[1] = (unsigned long)_orig.r2; \
1964 _argvec[2] = (unsigned long)_orig.nraddr; \
1965 _argvec[2+1] = (unsigned long)arg1; \
1968 "std 2,-16(11)\n\t" \
1971 "ld 11, 0(11)\n\t" \
1972 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
1977 : "r" (&_argvec[2]) \
1978 : "cc", "memory", __CALLER_SAVED_REGS \
1980 lval = (__typeof__(lval)) _res; \
1983#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1985 volatile OrigFn _orig = (orig); \
1986 volatile unsigned long _argvec[3+2]; \
1987 volatile unsigned long _res; \
1989 _argvec[1] = (unsigned long)_orig.r2; \
1990 _argvec[2] = (unsigned long)_orig.nraddr; \
1991 _argvec[2+1] = (unsigned long)arg1; \
1992 _argvec[2+2] = (unsigned long)arg2; \
1995 "std 2,-16(11)\n\t" \
1998 "ld 4, 16(11)\n\t" \
1999 "ld 11, 0(11)\n\t" \
2000 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2005 : "r" (&_argvec[2]) \
2006 : "cc", "memory", __CALLER_SAVED_REGS \
2008 lval = (__typeof__(lval)) _res; \
2011#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2013 volatile OrigFn _orig = (orig); \
2014 volatile unsigned long _argvec[3+3]; \
2015 volatile unsigned long _res; \
2017 _argvec[1] = (unsigned long)_orig.r2; \
2018 _argvec[2] = (unsigned long)_orig.nraddr; \
2019 _argvec[2+1] = (unsigned long)arg1; \
2020 _argvec[2+2] = (unsigned long)arg2; \
2021 _argvec[2+3] = (unsigned long)arg3; \
2024 "std 2,-16(11)\n\t" \
2027 "ld 4, 16(11)\n\t" \
2028 "ld 5, 24(11)\n\t" \
2029 "ld 11, 0(11)\n\t" \
2030 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2035 : "r" (&_argvec[2]) \
2036 : "cc", "memory", __CALLER_SAVED_REGS \
2038 lval = (__typeof__(lval)) _res; \
2041#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2043 volatile OrigFn _orig = (orig); \
2044 volatile unsigned long _argvec[3+4]; \
2045 volatile unsigned long _res; \
2047 _argvec[1] = (unsigned long)_orig.r2; \
2048 _argvec[2] = (unsigned long)_orig.nraddr; \
2049 _argvec[2+1] = (unsigned long)arg1; \
2050 _argvec[2+2] = (unsigned long)arg2; \
2051 _argvec[2+3] = (unsigned long)arg3; \
2052 _argvec[2+4] = (unsigned long)arg4; \
2055 "std 2,-16(11)\n\t" \
2058 "ld 4, 16(11)\n\t" \
2059 "ld 5, 24(11)\n\t" \
2060 "ld 6, 32(11)\n\t" \
2061 "ld 11, 0(11)\n\t" \
2062 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2067 : "r" (&_argvec[2]) \
2068 : "cc", "memory", __CALLER_SAVED_REGS \
2070 lval = (__typeof__(lval)) _res; \
2073#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2075 volatile OrigFn _orig = (orig); \
2076 volatile unsigned long _argvec[3+5]; \
2077 volatile unsigned long _res; \
2079 _argvec[1] = (unsigned long)_orig.r2; \
2080 _argvec[2] = (unsigned long)_orig.nraddr; \
2081 _argvec[2+1] = (unsigned long)arg1; \
2082 _argvec[2+2] = (unsigned long)arg2; \
2083 _argvec[2+3] = (unsigned long)arg3; \
2084 _argvec[2+4] = (unsigned long)arg4; \
2085 _argvec[2+5] = (unsigned long)arg5; \
2088 "std 2,-16(11)\n\t" \
2091 "ld 4, 16(11)\n\t" \
2092 "ld 5, 24(11)\n\t" \
2093 "ld 6, 32(11)\n\t" \
2094 "ld 7, 40(11)\n\t" \
2095 "ld 11, 0(11)\n\t" \
2096 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2101 : "r" (&_argvec[2]) \
2102 : "cc", "memory", __CALLER_SAVED_REGS \
2104 lval = (__typeof__(lval)) _res; \
2107#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2109 volatile OrigFn _orig = (orig); \
2110 volatile unsigned long _argvec[3+6]; \
2111 volatile unsigned long _res; \
2113 _argvec[1] = (unsigned long)_orig.r2; \
2114 _argvec[2] = (unsigned long)_orig.nraddr; \
2115 _argvec[2+1] = (unsigned long)arg1; \
2116 _argvec[2+2] = (unsigned long)arg2; \
2117 _argvec[2+3] = (unsigned long)arg3; \
2118 _argvec[2+4] = (unsigned long)arg4; \
2119 _argvec[2+5] = (unsigned long)arg5; \
2120 _argvec[2+6] = (unsigned long)arg6; \
2123 "std 2,-16(11)\n\t" \
2126 "ld 4, 16(11)\n\t" \
2127 "ld 5, 24(11)\n\t" \
2128 "ld 6, 32(11)\n\t" \
2129 "ld 7, 40(11)\n\t" \
2130 "ld 8, 48(11)\n\t" \
2131 "ld 11, 0(11)\n\t" \
2132 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2137 : "r" (&_argvec[2]) \
2138 : "cc", "memory", __CALLER_SAVED_REGS \
2140 lval = (__typeof__(lval)) _res; \
2143#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2146 volatile OrigFn _orig = (orig); \
2147 volatile unsigned long _argvec[3+7]; \
2148 volatile unsigned long _res; \
2150 _argvec[1] = (unsigned long)_orig.r2; \
2151 _argvec[2] = (unsigned long)_orig.nraddr; \
2152 _argvec[2+1] = (unsigned long)arg1; \
2153 _argvec[2+2] = (unsigned long)arg2; \
2154 _argvec[2+3] = (unsigned long)arg3; \
2155 _argvec[2+4] = (unsigned long)arg4; \
2156 _argvec[2+5] = (unsigned long)arg5; \
2157 _argvec[2+6] = (unsigned long)arg6; \
2158 _argvec[2+7] = (unsigned long)arg7; \
2161 "std 2,-16(11)\n\t" \
2164 "ld 4, 16(11)\n\t" \
2165 "ld 5, 24(11)\n\t" \
2166 "ld 6, 32(11)\n\t" \
2167 "ld 7, 40(11)\n\t" \
2168 "ld 8, 48(11)\n\t" \
2169 "ld 9, 56(11)\n\t" \
2170 "ld 11, 0(11)\n\t" \
2171 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2176 : "r" (&_argvec[2]) \
2177 : "cc", "memory", __CALLER_SAVED_REGS \
2179 lval = (__typeof__(lval)) _res; \
2182#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2185 volatile OrigFn _orig = (orig); \
2186 volatile unsigned long _argvec[3+8]; \
2187 volatile unsigned long _res; \
2189 _argvec[1] = (unsigned long)_orig.r2; \
2190 _argvec[2] = (unsigned long)_orig.nraddr; \
2191 _argvec[2+1] = (unsigned long)arg1; \
2192 _argvec[2+2] = (unsigned long)arg2; \
2193 _argvec[2+3] = (unsigned long)arg3; \
2194 _argvec[2+4] = (unsigned long)arg4; \
2195 _argvec[2+5] = (unsigned long)arg5; \
2196 _argvec[2+6] = (unsigned long)arg6; \
2197 _argvec[2+7] = (unsigned long)arg7; \
2198 _argvec[2+8] = (unsigned long)arg8; \
2201 "std 2,-16(11)\n\t" \
2204 "ld 4, 16(11)\n\t" \
2205 "ld 5, 24(11)\n\t" \
2206 "ld 6, 32(11)\n\t" \
2207 "ld 7, 40(11)\n\t" \
2208 "ld 8, 48(11)\n\t" \
2209 "ld 9, 56(11)\n\t" \
2210 "ld 10, 64(11)\n\t" \
2211 "ld 11, 0(11)\n\t" \
2212 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2217 : "r" (&_argvec[2]) \
2218 : "cc", "memory", __CALLER_SAVED_REGS \
2220 lval = (__typeof__(lval)) _res; \
2223#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2226 volatile OrigFn _orig = (orig); \
2227 volatile unsigned long _argvec[3+9]; \
2228 volatile unsigned long _res; \
2230 _argvec[1] = (unsigned long)_orig.r2; \
2231 _argvec[2] = (unsigned long)_orig.nraddr; \
2232 _argvec[2+1] = (unsigned long)arg1; \
2233 _argvec[2+2] = (unsigned long)arg2; \
2234 _argvec[2+3] = (unsigned long)arg3; \
2235 _argvec[2+4] = (unsigned long)arg4; \
2236 _argvec[2+5] = (unsigned long)arg5; \
2237 _argvec[2+6] = (unsigned long)arg6; \
2238 _argvec[2+7] = (unsigned long)arg7; \
2239 _argvec[2+8] = (unsigned long)arg8; \
2240 _argvec[2+9] = (unsigned long)arg9; \
2243 "std 2,-16(11)\n\t" \
2245 "addi 1,1,-128\n\t" \
2248 "std 3,112(1)\n\t" \
2251 "ld 4, 16(11)\n\t" \
2252 "ld 5, 24(11)\n\t" \
2253 "ld 6, 32(11)\n\t" \
2254 "ld 7, 40(11)\n\t" \
2255 "ld 8, 48(11)\n\t" \
2256 "ld 9, 56(11)\n\t" \
2257 "ld 10, 64(11)\n\t" \
2258 "ld 11, 0(11)\n\t" \
2259 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2262 "ld 2,-16(11)\n\t" \
2265 : "r" (&_argvec[2]) \
2266 : "cc", "memory", __CALLER_SAVED_REGS \
2268 lval = (__typeof__(lval)) _res; \
2271#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2272 arg7,arg8,arg9,arg10) \
2274 volatile OrigFn _orig = (orig); \
2275 volatile unsigned long _argvec[3+10]; \
2276 volatile unsigned long _res; \
2278 _argvec[1] = (unsigned long)_orig.r2; \
2279 _argvec[2] = (unsigned long)_orig.nraddr; \
2280 _argvec[2+1] = (unsigned long)arg1; \
2281 _argvec[2+2] = (unsigned long)arg2; \
2282 _argvec[2+3] = (unsigned long)arg3; \
2283 _argvec[2+4] = (unsigned long)arg4; \
2284 _argvec[2+5] = (unsigned long)arg5; \
2285 _argvec[2+6] = (unsigned long)arg6; \
2286 _argvec[2+7] = (unsigned long)arg7; \
2287 _argvec[2+8] = (unsigned long)arg8; \
2288 _argvec[2+9] = (unsigned long)arg9; \
2289 _argvec[2+10] = (unsigned long)arg10; \
2292 "std 2,-16(11)\n\t" \
2294 "addi 1,1,-128\n\t" \
2297 "std 3,120(1)\n\t" \
2300 "std 3,112(1)\n\t" \
2303 "ld 4, 16(11)\n\t" \
2304 "ld 5, 24(11)\n\t" \
2305 "ld 6, 32(11)\n\t" \
2306 "ld 7, 40(11)\n\t" \
2307 "ld 8, 48(11)\n\t" \
2308 "ld 9, 56(11)\n\t" \
2309 "ld 10, 64(11)\n\t" \
2310 "ld 11, 0(11)\n\t" \
2311 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2314 "ld 2,-16(11)\n\t" \
2317 : "r" (&_argvec[2]) \
2318 : "cc", "memory", __CALLER_SAVED_REGS \
2320 lval = (__typeof__(lval)) _res; \
2323#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2324 arg7,arg8,arg9,arg10,arg11) \
2326 volatile OrigFn _orig = (orig); \
2327 volatile unsigned long _argvec[3+11]; \
2328 volatile unsigned long _res; \
2330 _argvec[1] = (unsigned long)_orig.r2; \
2331 _argvec[2] = (unsigned long)_orig.nraddr; \
2332 _argvec[2+1] = (unsigned long)arg1; \
2333 _argvec[2+2] = (unsigned long)arg2; \
2334 _argvec[2+3] = (unsigned long)arg3; \
2335 _argvec[2+4] = (unsigned long)arg4; \
2336 _argvec[2+5] = (unsigned long)arg5; \
2337 _argvec[2+6] = (unsigned long)arg6; \
2338 _argvec[2+7] = (unsigned long)arg7; \
2339 _argvec[2+8] = (unsigned long)arg8; \
2340 _argvec[2+9] = (unsigned long)arg9; \
2341 _argvec[2+10] = (unsigned long)arg10; \
2342 _argvec[2+11] = (unsigned long)arg11; \
2345 "std 2,-16(11)\n\t" \
2347 "addi 1,1,-144\n\t" \
2350 "std 3,128(1)\n\t" \
2353 "std 3,120(1)\n\t" \
2356 "std 3,112(1)\n\t" \
2359 "ld 4, 16(11)\n\t" \
2360 "ld 5, 24(11)\n\t" \
2361 "ld 6, 32(11)\n\t" \
2362 "ld 7, 40(11)\n\t" \
2363 "ld 8, 48(11)\n\t" \
2364 "ld 9, 56(11)\n\t" \
2365 "ld 10, 64(11)\n\t" \
2366 "ld 11, 0(11)\n\t" \
2367 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2370 "ld 2,-16(11)\n\t" \
2373 : "r" (&_argvec[2]) \
2374 : "cc", "memory", __CALLER_SAVED_REGS \
2376 lval = (__typeof__(lval)) _res; \
2379#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2380 arg7,arg8,arg9,arg10,arg11,arg12) \
2382 volatile OrigFn _orig = (orig); \
2383 volatile unsigned long _argvec[3+12]; \
2384 volatile unsigned long _res; \
2386 _argvec[1] = (unsigned long)_orig.r2; \
2387 _argvec[2] = (unsigned long)_orig.nraddr; \
2388 _argvec[2+1] = (unsigned long)arg1; \
2389 _argvec[2+2] = (unsigned long)arg2; \
2390 _argvec[2+3] = (unsigned long)arg3; \
2391 _argvec[2+4] = (unsigned long)arg4; \
2392 _argvec[2+5] = (unsigned long)arg5; \
2393 _argvec[2+6] = (unsigned long)arg6; \
2394 _argvec[2+7] = (unsigned long)arg7; \
2395 _argvec[2+8] = (unsigned long)arg8; \
2396 _argvec[2+9] = (unsigned long)arg9; \
2397 _argvec[2+10] = (unsigned long)arg10; \
2398 _argvec[2+11] = (unsigned long)arg11; \
2399 _argvec[2+12] = (unsigned long)arg12; \
2402 "std 2,-16(11)\n\t" \
2404 "addi 1,1,-144\n\t" \
2407 "std 3,136(1)\n\t" \
2410 "std 3,128(1)\n\t" \
2413 "std 3,120(1)\n\t" \
2416 "std 3,112(1)\n\t" \
2419 "ld 4, 16(11)\n\t" \
2420 "ld 5, 24(11)\n\t" \
2421 "ld 6, 32(11)\n\t" \
2422 "ld 7, 40(11)\n\t" \
2423 "ld 8, 48(11)\n\t" \
2424 "ld 9, 56(11)\n\t" \
2425 "ld 10, 64(11)\n\t" \
2426 "ld 11, 0(11)\n\t" \
2427 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2430 "ld 2,-16(11)\n\t" \
2433 : "r" (&_argvec[2]) \
2434 : "cc", "memory", __CALLER_SAVED_REGS \
2436 lval = (__typeof__(lval)) _res; \
2443#if defined(PLAT_ppc32_aix5)
2448#define __CALLER_SAVED_REGS \
2449 "lr", "ctr", "xer", \
2450 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2451 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
2457#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
2458 "addi 1,1,-" #_n_fr "\n\t" \
2459 "lwz 3," #_n_fr "(1)\n\t" \
2462#define VG_CONTRACT_FRAME_BY(_n_fr) \
2463 "addi 1,1," #_n_fr "\n\t"
2468#define CALL_FN_W_v(lval, orig) \
2470 volatile OrigFn _orig = (orig); \
2471 volatile unsigned long _argvec[3+0]; \
2472 volatile unsigned long _res; \
2474 _argvec[1] = (unsigned long)_orig.r2; \
2475 _argvec[2] = (unsigned long)_orig.nraddr; \
2478 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2479 "stw 2,-8(11)\n\t" \
2480 "lwz 2,-4(11)\n\t" \
2481 "lwz 11, 0(11)\n\t" \
2482 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2485 "lwz 2,-8(11)\n\t" \
2486 VG_CONTRACT_FRAME_BY(512) \
2488 : "r" (&_argvec[2]) \
2489 : "cc", "memory", __CALLER_SAVED_REGS \
2491 lval = (__typeof__(lval)) _res; \
2494#define CALL_FN_W_W(lval, orig, arg1) \
2496 volatile OrigFn _orig = (orig); \
2497 volatile unsigned long _argvec[3+1]; \
2498 volatile unsigned long _res; \
2500 _argvec[1] = (unsigned long)_orig.r2; \
2501 _argvec[2] = (unsigned long)_orig.nraddr; \
2502 _argvec[2+1] = (unsigned long)arg1; \
2505 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2506 "stw 2,-8(11)\n\t" \
2507 "lwz 2,-4(11)\n\t" \
2508 "lwz 3, 4(11)\n\t" \
2509 "lwz 11, 0(11)\n\t" \
2510 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2513 "lwz 2,-8(11)\n\t" \
2514 VG_CONTRACT_FRAME_BY(512) \
2516 : "r" (&_argvec[2]) \
2517 : "cc", "memory", __CALLER_SAVED_REGS \
2519 lval = (__typeof__(lval)) _res; \
2522#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
2524 volatile OrigFn _orig = (orig); \
2525 volatile unsigned long _argvec[3+2]; \
2526 volatile unsigned long _res; \
2528 _argvec[1] = (unsigned long)_orig.r2; \
2529 _argvec[2] = (unsigned long)_orig.nraddr; \
2530 _argvec[2+1] = (unsigned long)arg1; \
2531 _argvec[2+2] = (unsigned long)arg2; \
2534 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2535 "stw 2,-8(11)\n\t" \
2536 "lwz 2,-4(11)\n\t" \
2537 "lwz 3, 4(11)\n\t" \
2538 "lwz 4, 8(11)\n\t" \
2539 "lwz 11, 0(11)\n\t" \
2540 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2543 "lwz 2,-8(11)\n\t" \
2544 VG_CONTRACT_FRAME_BY(512) \
2546 : "r" (&_argvec[2]) \
2547 : "cc", "memory", __CALLER_SAVED_REGS \
2549 lval = (__typeof__(lval)) _res; \
2552#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2554 volatile OrigFn _orig = (orig); \
2555 volatile unsigned long _argvec[3+3]; \
2556 volatile unsigned long _res; \
2558 _argvec[1] = (unsigned long)_orig.r2; \
2559 _argvec[2] = (unsigned long)_orig.nraddr; \
2560 _argvec[2+1] = (unsigned long)arg1; \
2561 _argvec[2+2] = (unsigned long)arg2; \
2562 _argvec[2+3] = (unsigned long)arg3; \
2565 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2566 "stw 2,-8(11)\n\t" \
2567 "lwz 2,-4(11)\n\t" \
2568 "lwz 3, 4(11)\n\t" \
2569 "lwz 4, 8(11)\n\t" \
2570 "lwz 5, 12(11)\n\t" \
2571 "lwz 11, 0(11)\n\t" \
2572 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2575 "lwz 2,-8(11)\n\t" \
2576 VG_CONTRACT_FRAME_BY(512) \
2578 : "r" (&_argvec[2]) \
2579 : "cc", "memory", __CALLER_SAVED_REGS \
2581 lval = (__typeof__(lval)) _res; \
2584#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2586 volatile OrigFn _orig = (orig); \
2587 volatile unsigned long _argvec[3+4]; \
2588 volatile unsigned long _res; \
2590 _argvec[1] = (unsigned long)_orig.r2; \
2591 _argvec[2] = (unsigned long)_orig.nraddr; \
2592 _argvec[2+1] = (unsigned long)arg1; \
2593 _argvec[2+2] = (unsigned long)arg2; \
2594 _argvec[2+3] = (unsigned long)arg3; \
2595 _argvec[2+4] = (unsigned long)arg4; \
2598 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2599 "stw 2,-8(11)\n\t" \
2600 "lwz 2,-4(11)\n\t" \
2601 "lwz 3, 4(11)\n\t" \
2602 "lwz 4, 8(11)\n\t" \
2603 "lwz 5, 12(11)\n\t" \
2604 "lwz 6, 16(11)\n\t" \
2605 "lwz 11, 0(11)\n\t" \
2606 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2609 "lwz 2,-8(11)\n\t" \
2610 VG_CONTRACT_FRAME_BY(512) \
2612 : "r" (&_argvec[2]) \
2613 : "cc", "memory", __CALLER_SAVED_REGS \
2615 lval = (__typeof__(lval)) _res; \
2618#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2620 volatile OrigFn _orig = (orig); \
2621 volatile unsigned long _argvec[3+5]; \
2622 volatile unsigned long _res; \
2624 _argvec[1] = (unsigned long)_orig.r2; \
2625 _argvec[2] = (unsigned long)_orig.nraddr; \
2626 _argvec[2+1] = (unsigned long)arg1; \
2627 _argvec[2+2] = (unsigned long)arg2; \
2628 _argvec[2+3] = (unsigned long)arg3; \
2629 _argvec[2+4] = (unsigned long)arg4; \
2630 _argvec[2+5] = (unsigned long)arg5; \
2633 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2634 "stw 2,-8(11)\n\t" \
2635 "lwz 2,-4(11)\n\t" \
2636 "lwz 3, 4(11)\n\t" \
2637 "lwz 4, 8(11)\n\t" \
2638 "lwz 5, 12(11)\n\t" \
2639 "lwz 6, 16(11)\n\t" \
2640 "lwz 7, 20(11)\n\t" \
2641 "lwz 11, 0(11)\n\t" \
2642 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2645 "lwz 2,-8(11)\n\t" \
2646 VG_CONTRACT_FRAME_BY(512) \
2648 : "r" (&_argvec[2]) \
2649 : "cc", "memory", __CALLER_SAVED_REGS \
2651 lval = (__typeof__(lval)) _res; \
2654#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2656 volatile OrigFn _orig = (orig); \
2657 volatile unsigned long _argvec[3+6]; \
2658 volatile unsigned long _res; \
2660 _argvec[1] = (unsigned long)_orig.r2; \
2661 _argvec[2] = (unsigned long)_orig.nraddr; \
2662 _argvec[2+1] = (unsigned long)arg1; \
2663 _argvec[2+2] = (unsigned long)arg2; \
2664 _argvec[2+3] = (unsigned long)arg3; \
2665 _argvec[2+4] = (unsigned long)arg4; \
2666 _argvec[2+5] = (unsigned long)arg5; \
2667 _argvec[2+6] = (unsigned long)arg6; \
2670 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2671 "stw 2,-8(11)\n\t" \
2672 "lwz 2,-4(11)\n\t" \
2673 "lwz 3, 4(11)\n\t" \
2674 "lwz 4, 8(11)\n\t" \
2675 "lwz 5, 12(11)\n\t" \
2676 "lwz 6, 16(11)\n\t" \
2677 "lwz 7, 20(11)\n\t" \
2678 "lwz 8, 24(11)\n\t" \
2679 "lwz 11, 0(11)\n\t" \
2680 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2683 "lwz 2,-8(11)\n\t" \
2684 VG_CONTRACT_FRAME_BY(512) \
2686 : "r" (&_argvec[2]) \
2687 : "cc", "memory", __CALLER_SAVED_REGS \
2689 lval = (__typeof__(lval)) _res; \
2692#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2695 volatile OrigFn _orig = (orig); \
2696 volatile unsigned long _argvec[3+7]; \
2697 volatile unsigned long _res; \
2699 _argvec[1] = (unsigned long)_orig.r2; \
2700 _argvec[2] = (unsigned long)_orig.nraddr; \
2701 _argvec[2+1] = (unsigned long)arg1; \
2702 _argvec[2+2] = (unsigned long)arg2; \
2703 _argvec[2+3] = (unsigned long)arg3; \
2704 _argvec[2+4] = (unsigned long)arg4; \
2705 _argvec[2+5] = (unsigned long)arg5; \
2706 _argvec[2+6] = (unsigned long)arg6; \
2707 _argvec[2+7] = (unsigned long)arg7; \
2710 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2711 "stw 2,-8(11)\n\t" \
2712 "lwz 2,-4(11)\n\t" \
2713 "lwz 3, 4(11)\n\t" \
2714 "lwz 4, 8(11)\n\t" \
2715 "lwz 5, 12(11)\n\t" \
2716 "lwz 6, 16(11)\n\t" \
2717 "lwz 7, 20(11)\n\t" \
2718 "lwz 8, 24(11)\n\t" \
2719 "lwz 9, 28(11)\n\t" \
2720 "lwz 11, 0(11)\n\t" \
2721 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2724 "lwz 2,-8(11)\n\t" \
2725 VG_CONTRACT_FRAME_BY(512) \
2727 : "r" (&_argvec[2]) \
2728 : "cc", "memory", __CALLER_SAVED_REGS \
2730 lval = (__typeof__(lval)) _res; \
2733#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2736 volatile OrigFn _orig = (orig); \
2737 volatile unsigned long _argvec[3+8]; \
2738 volatile unsigned long _res; \
2740 _argvec[1] = (unsigned long)_orig.r2; \
2741 _argvec[2] = (unsigned long)_orig.nraddr; \
2742 _argvec[2+1] = (unsigned long)arg1; \
2743 _argvec[2+2] = (unsigned long)arg2; \
2744 _argvec[2+3] = (unsigned long)arg3; \
2745 _argvec[2+4] = (unsigned long)arg4; \
2746 _argvec[2+5] = (unsigned long)arg5; \
2747 _argvec[2+6] = (unsigned long)arg6; \
2748 _argvec[2+7] = (unsigned long)arg7; \
2749 _argvec[2+8] = (unsigned long)arg8; \
2752 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2753 "stw 2,-8(11)\n\t" \
2754 "lwz 2,-4(11)\n\t" \
2755 "lwz 3, 4(11)\n\t" \
2756 "lwz 4, 8(11)\n\t" \
2757 "lwz 5, 12(11)\n\t" \
2758 "lwz 6, 16(11)\n\t" \
2759 "lwz 7, 20(11)\n\t" \
2760 "lwz 8, 24(11)\n\t" \
2761 "lwz 9, 28(11)\n\t" \
2762 "lwz 10, 32(11)\n\t" \
2763 "lwz 11, 0(11)\n\t" \
2764 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2767 "lwz 2,-8(11)\n\t" \
2768 VG_CONTRACT_FRAME_BY(512) \
2770 : "r" (&_argvec[2]) \
2771 : "cc", "memory", __CALLER_SAVED_REGS \
2773 lval = (__typeof__(lval)) _res; \
2776#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2779 volatile OrigFn _orig = (orig); \
2780 volatile unsigned long _argvec[3+9]; \
2781 volatile unsigned long _res; \
2783 _argvec[1] = (unsigned long)_orig.r2; \
2784 _argvec[2] = (unsigned long)_orig.nraddr; \
2785 _argvec[2+1] = (unsigned long)arg1; \
2786 _argvec[2+2] = (unsigned long)arg2; \
2787 _argvec[2+3] = (unsigned long)arg3; \
2788 _argvec[2+4] = (unsigned long)arg4; \
2789 _argvec[2+5] = (unsigned long)arg5; \
2790 _argvec[2+6] = (unsigned long)arg6; \
2791 _argvec[2+7] = (unsigned long)arg7; \
2792 _argvec[2+8] = (unsigned long)arg8; \
2793 _argvec[2+9] = (unsigned long)arg9; \
2796 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2797 "stw 2,-8(11)\n\t" \
2798 "lwz 2,-4(11)\n\t" \
2799 VG_EXPAND_FRAME_BY_trashes_r3(64) \
2801 "lwz 3,36(11)\n\t" \
2804 "lwz 3, 4(11)\n\t" \
2805 "lwz 4, 8(11)\n\t" \
2806 "lwz 5, 12(11)\n\t" \
2807 "lwz 6, 16(11)\n\t" \
2808 "lwz 7, 20(11)\n\t" \
2809 "lwz 8, 24(11)\n\t" \
2810 "lwz 9, 28(11)\n\t" \
2811 "lwz 10, 32(11)\n\t" \
2812 "lwz 11, 0(11)\n\t" \
2813 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2816 "lwz 2,-8(11)\n\t" \
2817 VG_CONTRACT_FRAME_BY(64) \
2818 VG_CONTRACT_FRAME_BY(512) \
2820 : "r" (&_argvec[2]) \
2821 : "cc", "memory", __CALLER_SAVED_REGS \
2823 lval = (__typeof__(lval)) _res; \
2826#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2827 arg7,arg8,arg9,arg10) \
2829 volatile OrigFn _orig = (orig); \
2830 volatile unsigned long _argvec[3+10]; \
2831 volatile unsigned long _res; \
2833 _argvec[1] = (unsigned long)_orig.r2; \
2834 _argvec[2] = (unsigned long)_orig.nraddr; \
2835 _argvec[2+1] = (unsigned long)arg1; \
2836 _argvec[2+2] = (unsigned long)arg2; \
2837 _argvec[2+3] = (unsigned long)arg3; \
2838 _argvec[2+4] = (unsigned long)arg4; \
2839 _argvec[2+5] = (unsigned long)arg5; \
2840 _argvec[2+6] = (unsigned long)arg6; \
2841 _argvec[2+7] = (unsigned long)arg7; \
2842 _argvec[2+8] = (unsigned long)arg8; \
2843 _argvec[2+9] = (unsigned long)arg9; \
2844 _argvec[2+10] = (unsigned long)arg10; \
2847 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2848 "stw 2,-8(11)\n\t" \
2849 "lwz 2,-4(11)\n\t" \
2850 VG_EXPAND_FRAME_BY_trashes_r3(64) \
2852 "lwz 3,40(11)\n\t" \
2855 "lwz 3,36(11)\n\t" \
2858 "lwz 3, 4(11)\n\t" \
2859 "lwz 4, 8(11)\n\t" \
2860 "lwz 5, 12(11)\n\t" \
2861 "lwz 6, 16(11)\n\t" \
2862 "lwz 7, 20(11)\n\t" \
2863 "lwz 8, 24(11)\n\t" \
2864 "lwz 9, 28(11)\n\t" \
2865 "lwz 10, 32(11)\n\t" \
2866 "lwz 11, 0(11)\n\t" \
2867 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2870 "lwz 2,-8(11)\n\t" \
2871 VG_CONTRACT_FRAME_BY(64) \
2872 VG_CONTRACT_FRAME_BY(512) \
2874 : "r" (&_argvec[2]) \
2875 : "cc", "memory", __CALLER_SAVED_REGS \
2877 lval = (__typeof__(lval)) _res; \
2880#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2881 arg7,arg8,arg9,arg10,arg11) \
2883 volatile OrigFn _orig = (orig); \
2884 volatile unsigned long _argvec[3+11]; \
2885 volatile unsigned long _res; \
2887 _argvec[1] = (unsigned long)_orig.r2; \
2888 _argvec[2] = (unsigned long)_orig.nraddr; \
2889 _argvec[2+1] = (unsigned long)arg1; \
2890 _argvec[2+2] = (unsigned long)arg2; \
2891 _argvec[2+3] = (unsigned long)arg3; \
2892 _argvec[2+4] = (unsigned long)arg4; \
2893 _argvec[2+5] = (unsigned long)arg5; \
2894 _argvec[2+6] = (unsigned long)arg6; \
2895 _argvec[2+7] = (unsigned long)arg7; \
2896 _argvec[2+8] = (unsigned long)arg8; \
2897 _argvec[2+9] = (unsigned long)arg9; \
2898 _argvec[2+10] = (unsigned long)arg10; \
2899 _argvec[2+11] = (unsigned long)arg11; \
2902 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2903 "stw 2,-8(11)\n\t" \
2904 "lwz 2,-4(11)\n\t" \
2905 VG_EXPAND_FRAME_BY_trashes_r3(72) \
2907 "lwz 3,44(11)\n\t" \
2910 "lwz 3,40(11)\n\t" \
2913 "lwz 3,36(11)\n\t" \
2916 "lwz 3, 4(11)\n\t" \
2917 "lwz 4, 8(11)\n\t" \
2918 "lwz 5, 12(11)\n\t" \
2919 "lwz 6, 16(11)\n\t" \
2920 "lwz 7, 20(11)\n\t" \
2921 "lwz 8, 24(11)\n\t" \
2922 "lwz 9, 28(11)\n\t" \
2923 "lwz 10, 32(11)\n\t" \
2924 "lwz 11, 0(11)\n\t" \
2925 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2928 "lwz 2,-8(11)\n\t" \
2929 VG_CONTRACT_FRAME_BY(72) \
2930 VG_CONTRACT_FRAME_BY(512) \
2932 : "r" (&_argvec[2]) \
2933 : "cc", "memory", __CALLER_SAVED_REGS \
2935 lval = (__typeof__(lval)) _res; \
2938#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2939 arg7,arg8,arg9,arg10,arg11,arg12) \
2941 volatile OrigFn _orig = (orig); \
2942 volatile unsigned long _argvec[3+12]; \
2943 volatile unsigned long _res; \
2945 _argvec[1] = (unsigned long)_orig.r2; \
2946 _argvec[2] = (unsigned long)_orig.nraddr; \
2947 _argvec[2+1] = (unsigned long)arg1; \
2948 _argvec[2+2] = (unsigned long)arg2; \
2949 _argvec[2+3] = (unsigned long)arg3; \
2950 _argvec[2+4] = (unsigned long)arg4; \
2951 _argvec[2+5] = (unsigned long)arg5; \
2952 _argvec[2+6] = (unsigned long)arg6; \
2953 _argvec[2+7] = (unsigned long)arg7; \
2954 _argvec[2+8] = (unsigned long)arg8; \
2955 _argvec[2+9] = (unsigned long)arg9; \
2956 _argvec[2+10] = (unsigned long)arg10; \
2957 _argvec[2+11] = (unsigned long)arg11; \
2958 _argvec[2+12] = (unsigned long)arg12; \
2961 VG_EXPAND_FRAME_BY_trashes_r3(512) \
2962 "stw 2,-8(11)\n\t" \
2963 "lwz 2,-4(11)\n\t" \
2964 VG_EXPAND_FRAME_BY_trashes_r3(72) \
2966 "lwz 3,48(11)\n\t" \
2969 "lwz 3,44(11)\n\t" \
2972 "lwz 3,40(11)\n\t" \
2975 "lwz 3,36(11)\n\t" \
2978 "lwz 3, 4(11)\n\t" \
2979 "lwz 4, 8(11)\n\t" \
2980 "lwz 5, 12(11)\n\t" \
2981 "lwz 6, 16(11)\n\t" \
2982 "lwz 7, 20(11)\n\t" \
2983 "lwz 8, 24(11)\n\t" \
2984 "lwz 9, 28(11)\n\t" \
2985 "lwz 10, 32(11)\n\t" \
2986 "lwz 11, 0(11)\n\t" \
2987 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2990 "lwz 2,-8(11)\n\t" \
2991 VG_CONTRACT_FRAME_BY(72) \
2992 VG_CONTRACT_FRAME_BY(512) \
2994 : "r" (&_argvec[2]) \
2995 : "cc", "memory", __CALLER_SAVED_REGS \
2997 lval = (__typeof__(lval)) _res; \
3004#if defined(PLAT_ppc64_aix5)
3009#define __CALLER_SAVED_REGS \
3010 "lr", "ctr", "xer", \
3011 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
3012 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
3018#define VG_EXPAND_FRAME_BY_trashes_r3(_n_fr) \
3019 "addi 1,1,-" #_n_fr "\n\t" \
3020 "ld 3," #_n_fr "(1)\n\t" \
3023#define VG_CONTRACT_FRAME_BY(_n_fr) \
3024 "addi 1,1," #_n_fr "\n\t"
3029#define CALL_FN_W_v(lval, orig) \
3031 volatile OrigFn _orig = (orig); \
3032 volatile unsigned long _argvec[3+0]; \
3033 volatile unsigned long _res; \
3035 _argvec[1] = (unsigned long)_orig.r2; \
3036 _argvec[2] = (unsigned long)_orig.nraddr; \
3039 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3040 "std 2,-16(11)\n\t" \
3042 "ld 11, 0(11)\n\t" \
3043 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3046 "ld 2,-16(11)\n\t" \
3047 VG_CONTRACT_FRAME_BY(512) \
3049 : "r" (&_argvec[2]) \
3050 : "cc", "memory", __CALLER_SAVED_REGS \
3052 lval = (__typeof__(lval)) _res; \
3055#define CALL_FN_W_W(lval, orig, arg1) \
3057 volatile OrigFn _orig = (orig); \
3058 volatile unsigned long _argvec[3+1]; \
3059 volatile unsigned long _res; \
3061 _argvec[1] = (unsigned long)_orig.r2; \
3062 _argvec[2] = (unsigned long)_orig.nraddr; \
3063 _argvec[2+1] = (unsigned long)arg1; \
3066 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3067 "std 2,-16(11)\n\t" \
3070 "ld 11, 0(11)\n\t" \
3071 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3074 "ld 2,-16(11)\n\t" \
3075 VG_CONTRACT_FRAME_BY(512) \
3077 : "r" (&_argvec[2]) \
3078 : "cc", "memory", __CALLER_SAVED_REGS \
3080 lval = (__typeof__(lval)) _res; \
3083#define CALL_FN_W_WW(lval, orig, arg1,arg2) \
3085 volatile OrigFn _orig = (orig); \
3086 volatile unsigned long _argvec[3+2]; \
3087 volatile unsigned long _res; \
3089 _argvec[1] = (unsigned long)_orig.r2; \
3090 _argvec[2] = (unsigned long)_orig.nraddr; \
3091 _argvec[2+1] = (unsigned long)arg1; \
3092 _argvec[2+2] = (unsigned long)arg2; \
3095 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3096 "std 2,-16(11)\n\t" \
3099 "ld 4, 16(11)\n\t" \
3100 "ld 11, 0(11)\n\t" \
3101 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3104 "ld 2,-16(11)\n\t" \
3105 VG_CONTRACT_FRAME_BY(512) \
3107 : "r" (&_argvec[2]) \
3108 : "cc", "memory", __CALLER_SAVED_REGS \
3110 lval = (__typeof__(lval)) _res; \
3113#define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
3115 volatile OrigFn _orig = (orig); \
3116 volatile unsigned long _argvec[3+3]; \
3117 volatile unsigned long _res; \
3119 _argvec[1] = (unsigned long)_orig.r2; \
3120 _argvec[2] = (unsigned long)_orig.nraddr; \
3121 _argvec[2+1] = (unsigned long)arg1; \
3122 _argvec[2+2] = (unsigned long)arg2; \
3123 _argvec[2+3] = (unsigned long)arg3; \
3126 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3127 "std 2,-16(11)\n\t" \
3130 "ld 4, 16(11)\n\t" \
3131 "ld 5, 24(11)\n\t" \
3132 "ld 11, 0(11)\n\t" \
3133 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3136 "ld 2,-16(11)\n\t" \
3137 VG_CONTRACT_FRAME_BY(512) \
3139 : "r" (&_argvec[2]) \
3140 : "cc", "memory", __CALLER_SAVED_REGS \
3142 lval = (__typeof__(lval)) _res; \
3145#define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
3147 volatile OrigFn _orig = (orig); \
3148 volatile unsigned long _argvec[3+4]; \
3149 volatile unsigned long _res; \
3151 _argvec[1] = (unsigned long)_orig.r2; \
3152 _argvec[2] = (unsigned long)_orig.nraddr; \
3153 _argvec[2+1] = (unsigned long)arg1; \
3154 _argvec[2+2] = (unsigned long)arg2; \
3155 _argvec[2+3] = (unsigned long)arg3; \
3156 _argvec[2+4] = (unsigned long)arg4; \
3159 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3160 "std 2,-16(11)\n\t" \
3163 "ld 4, 16(11)\n\t" \
3164 "ld 5, 24(11)\n\t" \
3165 "ld 6, 32(11)\n\t" \
3166 "ld 11, 0(11)\n\t" \
3167 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3170 "ld 2,-16(11)\n\t" \
3171 VG_CONTRACT_FRAME_BY(512) \
3173 : "r" (&_argvec[2]) \
3174 : "cc", "memory", __CALLER_SAVED_REGS \
3176 lval = (__typeof__(lval)) _res; \
3179#define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
3181 volatile OrigFn _orig = (orig); \
3182 volatile unsigned long _argvec[3+5]; \
3183 volatile unsigned long _res; \
3185 _argvec[1] = (unsigned long)_orig.r2; \
3186 _argvec[2] = (unsigned long)_orig.nraddr; \
3187 _argvec[2+1] = (unsigned long)arg1; \
3188 _argvec[2+2] = (unsigned long)arg2; \
3189 _argvec[2+3] = (unsigned long)arg3; \
3190 _argvec[2+4] = (unsigned long)arg4; \
3191 _argvec[2+5] = (unsigned long)arg5; \
3194 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3195 "std 2,-16(11)\n\t" \
3198 "ld 4, 16(11)\n\t" \
3199 "ld 5, 24(11)\n\t" \
3200 "ld 6, 32(11)\n\t" \
3201 "ld 7, 40(11)\n\t" \
3202 "ld 11, 0(11)\n\t" \
3203 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3206 "ld 2,-16(11)\n\t" \
3207 VG_CONTRACT_FRAME_BY(512) \
3209 : "r" (&_argvec[2]) \
3210 : "cc", "memory", __CALLER_SAVED_REGS \
3212 lval = (__typeof__(lval)) _res; \
3215#define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
3217 volatile OrigFn _orig = (orig); \
3218 volatile unsigned long _argvec[3+6]; \
3219 volatile unsigned long _res; \
3221 _argvec[1] = (unsigned long)_orig.r2; \
3222 _argvec[2] = (unsigned long)_orig.nraddr; \
3223 _argvec[2+1] = (unsigned long)arg1; \
3224 _argvec[2+2] = (unsigned long)arg2; \
3225 _argvec[2+3] = (unsigned long)arg3; \
3226 _argvec[2+4] = (unsigned long)arg4; \
3227 _argvec[2+5] = (unsigned long)arg5; \
3228 _argvec[2+6] = (unsigned long)arg6; \
3231 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3232 "std 2,-16(11)\n\t" \
3235 "ld 4, 16(11)\n\t" \
3236 "ld 5, 24(11)\n\t" \
3237 "ld 6, 32(11)\n\t" \
3238 "ld 7, 40(11)\n\t" \
3239 "ld 8, 48(11)\n\t" \
3240 "ld 11, 0(11)\n\t" \
3241 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3244 "ld 2,-16(11)\n\t" \
3245 VG_CONTRACT_FRAME_BY(512) \
3247 : "r" (&_argvec[2]) \
3248 : "cc", "memory", __CALLER_SAVED_REGS \
3250 lval = (__typeof__(lval)) _res; \
3253#define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3256 volatile OrigFn _orig = (orig); \
3257 volatile unsigned long _argvec[3+7]; \
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; \
3265 _argvec[2+4] = (unsigned long)arg4; \
3266 _argvec[2+5] = (unsigned long)arg5; \
3267 _argvec[2+6] = (unsigned long)arg6; \
3268 _argvec[2+7] = (unsigned long)arg7; \
3271 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3272 "std 2,-16(11)\n\t" \
3275 "ld 4, 16(11)\n\t" \
3276 "ld 5, 24(11)\n\t" \
3277 "ld 6, 32(11)\n\t" \
3278 "ld 7, 40(11)\n\t" \
3279 "ld 8, 48(11)\n\t" \
3280 "ld 9, 56(11)\n\t" \
3281 "ld 11, 0(11)\n\t" \
3282 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3285 "ld 2,-16(11)\n\t" \
3286 VG_CONTRACT_FRAME_BY(512) \
3288 : "r" (&_argvec[2]) \
3289 : "cc", "memory", __CALLER_SAVED_REGS \
3291 lval = (__typeof__(lval)) _res; \
3294#define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3297 volatile OrigFn _orig = (orig); \
3298 volatile unsigned long _argvec[3+8]; \
3299 volatile unsigned long _res; \
3301 _argvec[1] = (unsigned long)_orig.r2; \
3302 _argvec[2] = (unsigned long)_orig.nraddr; \
3303 _argvec[2+1] = (unsigned long)arg1; \
3304 _argvec[2+2] = (unsigned long)arg2; \
3305 _argvec[2+3] = (unsigned long)arg3; \
3306 _argvec[2+4] = (unsigned long)arg4; \
3307 _argvec[2+5] = (unsigned long)arg5; \
3308 _argvec[2+6] = (unsigned long)arg6; \
3309 _argvec[2+7] = (unsigned long)arg7; \
3310 _argvec[2+8] = (unsigned long)arg8; \
3313 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3314 "std 2,-16(11)\n\t" \
3317 "ld 4, 16(11)\n\t" \
3318 "ld 5, 24(11)\n\t" \
3319 "ld 6, 32(11)\n\t" \
3320 "ld 7, 40(11)\n\t" \
3321 "ld 8, 48(11)\n\t" \
3322 "ld 9, 56(11)\n\t" \
3323 "ld 10, 64(11)\n\t" \
3324 "ld 11, 0(11)\n\t" \
3325 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3328 "ld 2,-16(11)\n\t" \
3329 VG_CONTRACT_FRAME_BY(512) \
3331 : "r" (&_argvec[2]) \
3332 : "cc", "memory", __CALLER_SAVED_REGS \
3334 lval = (__typeof__(lval)) _res; \
3337#define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3340 volatile OrigFn _orig = (orig); \
3341 volatile unsigned long _argvec[3+9]; \
3342 volatile unsigned long _res; \
3344 _argvec[1] = (unsigned long)_orig.r2; \
3345 _argvec[2] = (unsigned long)_orig.nraddr; \
3346 _argvec[2+1] = (unsigned long)arg1; \
3347 _argvec[2+2] = (unsigned long)arg2; \
3348 _argvec[2+3] = (unsigned long)arg3; \
3349 _argvec[2+4] = (unsigned long)arg4; \
3350 _argvec[2+5] = (unsigned long)arg5; \
3351 _argvec[2+6] = (unsigned long)arg6; \
3352 _argvec[2+7] = (unsigned long)arg7; \
3353 _argvec[2+8] = (unsigned long)arg8; \
3354 _argvec[2+9] = (unsigned long)arg9; \
3357 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3358 "std 2,-16(11)\n\t" \
3360 VG_EXPAND_FRAME_BY_trashes_r3(128) \
3363 "std 3,112(1)\n\t" \
3366 "ld 4, 16(11)\n\t" \
3367 "ld 5, 24(11)\n\t" \
3368 "ld 6, 32(11)\n\t" \
3369 "ld 7, 40(11)\n\t" \
3370 "ld 8, 48(11)\n\t" \
3371 "ld 9, 56(11)\n\t" \
3372 "ld 10, 64(11)\n\t" \
3373 "ld 11, 0(11)\n\t" \
3374 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3377 "ld 2,-16(11)\n\t" \
3378 VG_CONTRACT_FRAME_BY(128) \
3379 VG_CONTRACT_FRAME_BY(512) \
3381 : "r" (&_argvec[2]) \
3382 : "cc", "memory", __CALLER_SAVED_REGS \
3384 lval = (__typeof__(lval)) _res; \
3387#define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3388 arg7,arg8,arg9,arg10) \
3390 volatile OrigFn _orig = (orig); \
3391 volatile unsigned long _argvec[3+10]; \
3392 volatile unsigned long _res; \
3394 _argvec[1] = (unsigned long)_orig.r2; \
3395 _argvec[2] = (unsigned long)_orig.nraddr; \
3396 _argvec[2+1] = (unsigned long)arg1; \
3397 _argvec[2+2] = (unsigned long)arg2; \
3398 _argvec[2+3] = (unsigned long)arg3; \
3399 _argvec[2+4] = (unsigned long)arg4; \
3400 _argvec[2+5] = (unsigned long)arg5; \
3401 _argvec[2+6] = (unsigned long)arg6; \
3402 _argvec[2+7] = (unsigned long)arg7; \
3403 _argvec[2+8] = (unsigned long)arg8; \
3404 _argvec[2+9] = (unsigned long)arg9; \
3405 _argvec[2+10] = (unsigned long)arg10; \
3408 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3409 "std 2,-16(11)\n\t" \
3411 VG_EXPAND_FRAME_BY_trashes_r3(128) \
3414 "std 3,120(1)\n\t" \
3417 "std 3,112(1)\n\t" \
3420 "ld 4, 16(11)\n\t" \
3421 "ld 5, 24(11)\n\t" \
3422 "ld 6, 32(11)\n\t" \
3423 "ld 7, 40(11)\n\t" \
3424 "ld 8, 48(11)\n\t" \
3425 "ld 9, 56(11)\n\t" \
3426 "ld 10, 64(11)\n\t" \
3427 "ld 11, 0(11)\n\t" \
3428 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3431 "ld 2,-16(11)\n\t" \
3432 VG_CONTRACT_FRAME_BY(128) \
3433 VG_CONTRACT_FRAME_BY(512) \
3435 : "r" (&_argvec[2]) \
3436 : "cc", "memory", __CALLER_SAVED_REGS \
3438 lval = (__typeof__(lval)) _res; \
3441#define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3442 arg7,arg8,arg9,arg10,arg11) \
3444 volatile OrigFn _orig = (orig); \
3445 volatile unsigned long _argvec[3+11]; \
3446 volatile unsigned long _res; \
3448 _argvec[1] = (unsigned long)_orig.r2; \
3449 _argvec[2] = (unsigned long)_orig.nraddr; \
3450 _argvec[2+1] = (unsigned long)arg1; \
3451 _argvec[2+2] = (unsigned long)arg2; \
3452 _argvec[2+3] = (unsigned long)arg3; \
3453 _argvec[2+4] = (unsigned long)arg4; \
3454 _argvec[2+5] = (unsigned long)arg5; \
3455 _argvec[2+6] = (unsigned long)arg6; \
3456 _argvec[2+7] = (unsigned long)arg7; \
3457 _argvec[2+8] = (unsigned long)arg8; \
3458 _argvec[2+9] = (unsigned long)arg9; \
3459 _argvec[2+10] = (unsigned long)arg10; \
3460 _argvec[2+11] = (unsigned long)arg11; \
3463 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3464 "std 2,-16(11)\n\t" \
3466 VG_EXPAND_FRAME_BY_trashes_r3(144) \
3469 "std 3,128(1)\n\t" \
3472 "std 3,120(1)\n\t" \
3475 "std 3,112(1)\n\t" \
3478 "ld 4, 16(11)\n\t" \
3479 "ld 5, 24(11)\n\t" \
3480 "ld 6, 32(11)\n\t" \
3481 "ld 7, 40(11)\n\t" \
3482 "ld 8, 48(11)\n\t" \
3483 "ld 9, 56(11)\n\t" \
3484 "ld 10, 64(11)\n\t" \
3485 "ld 11, 0(11)\n\t" \
3486 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3489 "ld 2,-16(11)\n\t" \
3490 VG_CONTRACT_FRAME_BY(144) \
3491 VG_CONTRACT_FRAME_BY(512) \
3493 : "r" (&_argvec[2]) \
3494 : "cc", "memory", __CALLER_SAVED_REGS \
3496 lval = (__typeof__(lval)) _res; \
3499#define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3500 arg7,arg8,arg9,arg10,arg11,arg12) \
3502 volatile OrigFn _orig = (orig); \
3503 volatile unsigned long _argvec[3+12]; \
3504 volatile unsigned long _res; \
3506 _argvec[1] = (unsigned long)_orig.r2; \
3507 _argvec[2] = (unsigned long)_orig.nraddr; \
3508 _argvec[2+1] = (unsigned long)arg1; \
3509 _argvec[2+2] = (unsigned long)arg2; \
3510 _argvec[2+3] = (unsigned long)arg3; \
3511 _argvec[2+4] = (unsigned long)arg4; \
3512 _argvec[2+5] = (unsigned long)arg5; \
3513 _argvec[2+6] = (unsigned long)arg6; \
3514 _argvec[2+7] = (unsigned long)arg7; \
3515 _argvec[2+8] = (unsigned long)arg8; \
3516 _argvec[2+9] = (unsigned long)arg9; \
3517 _argvec[2+10] = (unsigned long)arg10; \
3518 _argvec[2+11] = (unsigned long)arg11; \
3519 _argvec[2+12] = (unsigned long)arg12; \
3522 VG_EXPAND_FRAME_BY_trashes_r3(512) \
3523 "std 2,-16(11)\n\t" \
3525 VG_EXPAND_FRAME_BY_trashes_r3(144) \
3528 "std 3,136(1)\n\t" \
3531 "std 3,128(1)\n\t" \
3534 "std 3,120(1)\n\t" \
3537 "std 3,112(1)\n\t" \
3540 "ld 4, 16(11)\n\t" \
3541 "ld 5, 24(11)\n\t" \
3542 "ld 6, 32(11)\n\t" \
3543 "ld 7, 40(11)\n\t" \
3544 "ld 8, 48(11)\n\t" \
3545 "ld 9, 56(11)\n\t" \
3546 "ld 10, 64(11)\n\t" \
3547 "ld 11, 0(11)\n\t" \
3548 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3551 "ld 2,-16(11)\n\t" \
3552 VG_CONTRACT_FRAME_BY(144) \
3553 VG_CONTRACT_FRAME_BY(512) \
3555 : "r" (&_argvec[2]) \
3556 : "cc", "memory", __CALLER_SAVED_REGS \
3558 lval = (__typeof__(lval)) _res; \
3579#define VG_USERREQ_TOOL_BASE(a,b) \
3580 ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
3581#define VG_IS_TOOL_USERREQ(a, b, v) \
3582 (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
3589 enum { VG_USERREQ__RUNNING_ON_VALGRIND = 0x1001,
3590 VG_USERREQ__DISCARD_TRANSLATIONS = 0x1002,
3597 VG_USERREQ__CLIENT_CALL0 = 0x1101,
3598 VG_USERREQ__CLIENT_CALL1 = 0x1102,
3599 VG_USERREQ__CLIENT_CALL2 = 0x1103,
3600 VG_USERREQ__CLIENT_CALL3 = 0x1104,
3605 VG_USERREQ__COUNT_ERRORS = 0x1201,
3609 VG_USERREQ__MALLOCLIKE_BLOCK = 0x1301,
3610 VG_USERREQ__FREELIKE_BLOCK = 0x1302,
3612 VG_USERREQ__CREATE_MEMPOOL = 0x1303,
3613 VG_USERREQ__DESTROY_MEMPOOL = 0x1304,
3614 VG_USERREQ__MEMPOOL_ALLOC = 0x1305,
3615 VG_USERREQ__MEMPOOL_FREE = 0x1306,
3616 VG_USERREQ__MEMPOOL_TRIM = 0x1307,
3617 VG_USERREQ__MOVE_MEMPOOL = 0x1308,
3618 VG_USERREQ__MEMPOOL_CHANGE = 0x1309,
3619 VG_USERREQ__MEMPOOL_EXISTS = 0x130a,
3622 VG_USERREQ__PRINTF = 0x1401,
3623 VG_USERREQ__PRINTF_BACKTRACE = 0x1402,
3626 VG_USERREQ__STACK_REGISTER = 0x1501,
3627 VG_USERREQ__STACK_DEREGISTER = 0x1502,
3628 VG_USERREQ__STACK_CHANGE = 0x1503
3631#if !defined(__GNUC__)
3632# define __extension__
3639#define RUNNING_ON_VALGRIND __extension__ \
3640 ({unsigned int _qzz_res; \
3641 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0 , \
3642 VG_USERREQ__RUNNING_ON_VALGRIND, \
3652#define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
3653 {unsigned int _qzz_res; \
3654 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3655 VG_USERREQ__DISCARD_TRANSLATIONS, \
3656 _qzz_addr, _qzz_len, 0, 0, 0); \
3663#if defined(NVALGRIND)
3665# define VALGRIND_PRINTF(...)
3666# define VALGRIND_PRINTF_BACKTRACE(...)
3672static int VALGRIND_PRINTF(
const char *format, ...)
3673 __attribute__((format(__printf__, 1, 2), __unused__));
3675VALGRIND_PRINTF(const
char *format, ...)
3677 unsigned long _qzz_res;
3679 va_start(vargs, format);
3680 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF,
3681 (
unsigned long)format, (
unsigned long)vargs,
3684 return (
int)_qzz_res;
3687static int VALGRIND_PRINTF_BACKTRACE(
const char *format, ...)
3688 __attribute__((format(__printf__, 1, 2), __unused__));
3690VALGRIND_PRINTF_BACKTRACE(const
char *format, ...)
3692 unsigned long _qzz_res;
3694 va_start(vargs, format);
3695 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, VG_USERREQ__PRINTF_BACKTRACE,
3696 (
unsigned long)format, (
unsigned long)vargs,
3699 return (
int)_qzz_res;
3728#define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
3730 ({unsigned long _qyy_res; \
3731 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 , \
3732 VG_USERREQ__CLIENT_CALL0, \
3738#define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
3740 ({unsigned long _qyy_res; \
3741 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 , \
3742 VG_USERREQ__CLIENT_CALL1, \
3744 _qyy_arg1, 0, 0, 0); \
3748#define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
3750 ({unsigned long _qyy_res; \
3751 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 , \
3752 VG_USERREQ__CLIENT_CALL2, \
3754 _qyy_arg1, _qyy_arg2, 0, 0); \
3758#define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
3760 ({unsigned long _qyy_res; \
3761 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 , \
3762 VG_USERREQ__CLIENT_CALL3, \
3764 _qyy_arg1, _qyy_arg2, \
3773#define VALGRIND_COUNT_ERRORS \
3775 ({unsigned int _qyy_res; \
3776 VALGRIND_DO_CLIENT_REQUEST(_qyy_res, 0 , \
3777 VG_USERREQ__COUNT_ERRORS, \
3807#define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
3808 {unsigned int _qzz_res; \
3809 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3810 VG_USERREQ__MALLOCLIKE_BLOCK, \
3811 addr, sizeB, rzB, is_zeroed, 0); \
3818#define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
3819 {unsigned int _qzz_res; \
3820 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3821 VG_USERREQ__FREELIKE_BLOCK, \
3822 addr, rzB, 0, 0, 0); \
3826#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
3827 {unsigned int _qzz_res; \
3828 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3829 VG_USERREQ__CREATE_MEMPOOL, \
3830 pool, rzB, is_zeroed, 0, 0); \
3834#define VALGRIND_DESTROY_MEMPOOL(pool) \
3835 {unsigned int _qzz_res; \
3836 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3837 VG_USERREQ__DESTROY_MEMPOOL, \
3838 pool, 0, 0, 0, 0); \
3842#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
3843 {unsigned int _qzz_res; \
3844 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3845 VG_USERREQ__MEMPOOL_ALLOC, \
3846 pool, addr, size, 0, 0); \
3850#define VALGRIND_MEMPOOL_FREE(pool, addr) \
3851 {unsigned int _qzz_res; \
3852 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3853 VG_USERREQ__MEMPOOL_FREE, \
3854 pool, addr, 0, 0, 0); \
3858#define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
3859 {unsigned int _qzz_res; \
3860 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3861 VG_USERREQ__MEMPOOL_TRIM, \
3862 pool, addr, size, 0, 0); \
3866#define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
3867 {unsigned int _qzz_res; \
3868 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3869 VG_USERREQ__MOVE_MEMPOOL, \
3870 poolA, poolB, 0, 0, 0); \
3874#define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
3875 {unsigned int _qzz_res; \
3876 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3877 VG_USERREQ__MEMPOOL_CHANGE, \
3878 pool, addrA, addrB, size, 0); \
3882#define VALGRIND_MEMPOOL_EXISTS(pool) \
3883 ({unsigned int _qzz_res; \
3884 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3885 VG_USERREQ__MEMPOOL_EXISTS, \
3886 pool, 0, 0, 0, 0); \
3891#define VALGRIND_STACK_REGISTER(start, end) \
3892 ({unsigned int _qzz_res; \
3893 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3894 VG_USERREQ__STACK_REGISTER, \
3895 start, end, 0, 0, 0); \
3901#define VALGRIND_STACK_DEREGISTER(id) \
3902 {unsigned int _qzz_res; \
3903 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3904 VG_USERREQ__STACK_DEREGISTER, \
3909#define VALGRIND_STACK_CHANGE(id, start, end) \
3910 {unsigned int _qzz_res; \
3911 VALGRIND_DO_CLIENT_REQUEST(_qzz_res, 0, \
3912 VG_USERREQ__STACK_CHANGE, \
3913 id, start, end, 0, 0); \
3917#undef PLAT_x86_linux
3918#undef PLAT_amd64_linux
3919#undef PLAT_ppc32_linux
3920#undef PLAT_ppc64_linux
3921#undef PLAT_ppc32_aix5
3922#undef PLAT_ppc64_aix5