91 #define __VALGRIND_MAJOR__ 3
92 #define __VALGRIND_MINOR__ 9
111 #undef PLAT_x86_darwin
112 #undef PLAT_amd64_darwin
113 #undef PLAT_x86_win32
114 #undef PLAT_amd64_win64
115 #undef PLAT_x86_linux
116 #undef PLAT_amd64_linux
117 #undef PLAT_ppc32_linux
118 #undef PLAT_ppc64_linux
119 #undef PLAT_arm_linux
120 #undef PLAT_arm64_linux
121 #undef PLAT_s390x_linux
122 #undef PLAT_mips32_linux
123 #undef PLAT_mips64_linux
126 #if defined(__APPLE__) && defined(__i386__)
127 # define PLAT_x86_darwin 1
128 #elif defined(__APPLE__) && defined(__x86_64__)
129 # define PLAT_amd64_darwin 1
130 #elif defined(__MINGW32__) || defined(__CYGWIN32__) \
131 || (defined(_WIN32) && defined(_M_IX86))
132 # define PLAT_x86_win32 1
133 #elif defined(__MINGW64__) || (defined(_WIN64) && defined(_M_X64))
134 # define PLAT_amd64_win64 1
135 #elif defined(__linux__) && defined(__i386__)
136 # define PLAT_x86_linux 1
137 #elif defined(__linux__) && defined(__x86_64__)
138 # define PLAT_amd64_linux 1
139 #elif defined(__linux__) && defined(__powerpc__) && !defined(__powerpc64__)
140 # define PLAT_ppc32_linux 1
141 #elif defined(__linux__) && defined(__powerpc__) && defined(__powerpc64__)
142 # define PLAT_ppc64_linux 1
143 #elif defined(__linux__) && defined(__arm__) && !defined(__aarch64__)
144 # define PLAT_arm_linux 1
145 #elif defined(__linux__) && defined(__aarch64__) && !defined(__arm__)
146 # define PLAT_arm64_linux 1
147 #elif defined(__linux__) && defined(__s390__) && defined(__s390x__)
148 # define PLAT_s390x_linux 1
149 #elif defined(__linux__) && defined(__mips__) && (__mips==64)
150 # define PLAT_mips64_linux 1
151 #elif defined(__linux__) && defined(__mips__) && (__mips!=64)
152 # define PLAT_mips32_linux 1
156 # if !defined(NVALGRIND)
180 #define VALGRIND_DO_CLIENT_REQUEST(_zzq_rlval, _zzq_default, \
181 _zzq_request, _zzq_arg1, _zzq_arg2, \
182 _zzq_arg3, _zzq_arg4, _zzq_arg5) \
183 do { (_zzq_rlval) = VALGRIND_DO_CLIENT_REQUEST_EXPR((_zzq_default), \
184 (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
185 (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
187 #define VALGRIND_DO_CLIENT_REQUEST_STMT(_zzq_request, _zzq_arg1, \
188 _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
189 do { (void) VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
190 (_zzq_request), (_zzq_arg1), (_zzq_arg2), \
191 (_zzq_arg3), (_zzq_arg4), (_zzq_arg5)); } while (0)
193 #if defined(NVALGRIND)
198 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
199 _zzq_default, _zzq_request, \
200 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
242 #if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin) \
243 || (defined(PLAT_x86_win32) && defined(__GNUC__))
251 #define __SPECIAL_INSTRUCTION_PREAMBLE \
252 "roll $3, %%edi ; roll $13, %%edi\n\t" \
253 "roll $29, %%edi ; roll $19, %%edi\n\t"
255 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
256 _zzq_default, _zzq_request, \
257 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
259 ({volatile unsigned int _zzq_args[6]; \
260 volatile unsigned int _zzq_result; \
261 _zzq_args[0] = (unsigned int)(_zzq_request); \
262 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
263 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
264 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
265 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
266 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
267 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
269 "xchgl %%ebx,%%ebx" \
270 : "=d" (_zzq_result) \
271 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
277 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
278 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
279 volatile unsigned int __addr; \
280 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
282 "xchgl %%ecx,%%ecx" \
287 _zzq_orig->nraddr = __addr; \
290 #define VALGRIND_CALL_NOREDIR_EAX \
291 __SPECIAL_INSTRUCTION_PREAMBLE \
293 "xchgl %%edx,%%edx\n\t"
295 #define VALGRIND_VEX_INJECT_IR() \
297 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
298 "xchgl %%edi,%%edi\n\t" \
299 : : : "cc", "memory" \
307 #if defined(PLAT_x86_win32) && !defined(__GNUC__)
315 #if defined(_MSC_VER)
317 #define __SPECIAL_INSTRUCTION_PREAMBLE \
318 __asm rol edi, 3 __asm rol edi, 13 \
319 __asm rol edi, 29 __asm rol edi, 19
321 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
322 _zzq_default, _zzq_request, \
323 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
324 valgrind_do_client_request_expr((uintptr_t)(_zzq_default), \
325 (uintptr_t)(_zzq_request), (uintptr_t)(_zzq_arg1), \
326 (uintptr_t)(_zzq_arg2), (uintptr_t)(_zzq_arg3), \
327 (uintptr_t)(_zzq_arg4), (uintptr_t)(_zzq_arg5))
329 static __inline uintptr_t
330 valgrind_do_client_request_expr(uintptr_t _zzq_default, uintptr_t _zzq_request,
331 uintptr_t _zzq_arg1, uintptr_t _zzq_arg2,
332 uintptr_t _zzq_arg3, uintptr_t _zzq_arg4,
335 volatile uintptr_t _zzq_args[6];
336 volatile unsigned int _zzq_result;
337 _zzq_args[0] = (uintptr_t)(_zzq_request);
338 _zzq_args[1] = (uintptr_t)(_zzq_arg1);
339 _zzq_args[2] = (uintptr_t)(_zzq_arg2);
340 _zzq_args[3] = (uintptr_t)(_zzq_arg3);
341 _zzq_args[4] = (uintptr_t)(_zzq_arg4);
342 _zzq_args[5] = (uintptr_t)(_zzq_arg5);
343 __asm { __asm lea eax, _zzq_args __asm mov edx, _zzq_default
344 __SPECIAL_INSTRUCTION_PREAMBLE
347 __asm mov _zzq_result, edx
352 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
353 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
354 volatile unsigned int __addr; \
355 __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
358 __asm mov __addr, eax \
360 _zzq_orig->nraddr = __addr; \
363 #define VALGRIND_CALL_NOREDIR_EAX ERROR
365 #define VALGRIND_VEX_INJECT_IR() \
367 __asm { __SPECIAL_INSTRUCTION_PREAMBLE \
373 #error Unsupported compiler.
380 #if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin)
384 unsigned long long int nraddr;
388 #define __SPECIAL_INSTRUCTION_PREAMBLE \
389 "rolq $3, %%rdi ; rolq $13, %%rdi\n\t" \
390 "rolq $61, %%rdi ; rolq $51, %%rdi\n\t"
392 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
393 _zzq_default, _zzq_request, \
394 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
396 ({ volatile unsigned long long int _zzq_args[6]; \
397 volatile unsigned long long int _zzq_result; \
398 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
399 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
400 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
401 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
402 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
403 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
404 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
406 "xchgq %%rbx,%%rbx" \
407 : "=d" (_zzq_result) \
408 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
414 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
415 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
416 volatile unsigned long long int __addr; \
417 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
419 "xchgq %%rcx,%%rcx" \
424 _zzq_orig->nraddr = __addr; \
427 #define VALGRIND_CALL_NOREDIR_RAX \
428 __SPECIAL_INSTRUCTION_PREAMBLE \
430 "xchgq %%rdx,%%rdx\n\t"
432 #define VALGRIND_VEX_INJECT_IR() \
434 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
435 "xchgq %%rdi,%%rdi\n\t" \
436 : : : "cc", "memory" \
444 #if defined(PLAT_ppc32_linux)
452 #define __SPECIAL_INSTRUCTION_PREAMBLE \
453 "rlwinm 0,0,3,0,31 ; rlwinm 0,0,13,0,31\n\t" \
454 "rlwinm 0,0,29,0,31 ; rlwinm 0,0,19,0,31\n\t"
456 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
457 _zzq_default, _zzq_request, \
458 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
461 ({ unsigned int _zzq_args[6]; \
462 unsigned int _zzq_result; \
463 unsigned int* _zzq_ptr; \
464 _zzq_args[0] = (unsigned int)(_zzq_request); \
465 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
466 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
467 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
468 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
469 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
470 _zzq_ptr = _zzq_args; \
471 __asm__ volatile("mr 3,%1\n\t" \
473 __SPECIAL_INSTRUCTION_PREAMBLE \
477 : "=b" (_zzq_result) \
478 : "b" (_zzq_default), "b" (_zzq_ptr) \
479 : "cc", "memory", "r3", "r4"); \
483 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
484 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
485 unsigned int __addr; \
486 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
492 : "cc", "memory", "r3" \
494 _zzq_orig->nraddr = __addr; \
497 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
498 __SPECIAL_INSTRUCTION_PREAMBLE \
502 #define VALGRIND_VEX_INJECT_IR() \
504 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
513 #if defined(PLAT_ppc64_linux)
517 unsigned long long int nraddr;
518 unsigned long long int r2;
522 #define __SPECIAL_INSTRUCTION_PREAMBLE \
523 "rotldi 0,0,3 ; rotldi 0,0,13\n\t" \
524 "rotldi 0,0,61 ; rotldi 0,0,51\n\t"
526 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
527 _zzq_default, _zzq_request, \
528 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
531 ({ unsigned long long int _zzq_args[6]; \
532 unsigned long long int _zzq_result; \
533 unsigned long long int* _zzq_ptr; \
534 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
535 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
536 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
537 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
538 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
539 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
540 _zzq_ptr = _zzq_args; \
541 __asm__ volatile("mr 3,%1\n\t" \
543 __SPECIAL_INSTRUCTION_PREAMBLE \
547 : "=b" (_zzq_result) \
548 : "b" (_zzq_default), "b" (_zzq_ptr) \
549 : "cc", "memory", "r3", "r4"); \
553 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
554 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
555 unsigned long long int __addr; \
556 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
562 : "cc", "memory", "r3" \
564 _zzq_orig->nraddr = __addr; \
565 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
571 : "cc", "memory", "r3" \
573 _zzq_orig->r2 = __addr; \
576 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
577 __SPECIAL_INSTRUCTION_PREAMBLE \
581 #define VALGRIND_VEX_INJECT_IR() \
583 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
592 #if defined(PLAT_arm_linux)
600 #define __SPECIAL_INSTRUCTION_PREAMBLE \
601 "mov r12, r12, ror #3 ; mov r12, r12, ror #13 \n\t" \
602 "mov r12, r12, ror #29 ; mov r12, r12, ror #19 \n\t"
604 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
605 _zzq_default, _zzq_request, \
606 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
609 ({volatile unsigned int _zzq_args[6]; \
610 volatile unsigned int _zzq_result; \
611 _zzq_args[0] = (unsigned int)(_zzq_request); \
612 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
613 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
614 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
615 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
616 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
617 __asm__ volatile("mov r3, %1\n\t" \
619 __SPECIAL_INSTRUCTION_PREAMBLE \
621 "orr r10, r10, r10\n\t" \
623 : "=r" (_zzq_result) \
624 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
625 : "cc","memory", "r3", "r4"); \
629 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
630 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
631 unsigned int __addr; \
632 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
634 "orr r11, r11, r11\n\t" \
638 : "cc", "memory", "r3" \
640 _zzq_orig->nraddr = __addr; \
643 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
644 __SPECIAL_INSTRUCTION_PREAMBLE \
646 "orr r12, r12, r12\n\t"
648 #define VALGRIND_VEX_INJECT_IR() \
650 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
651 "orr r9, r9, r9\n\t" \
652 : : : "cc", "memory" \
660 #if defined(PLAT_arm64_linux)
664 unsigned long long int nraddr;
668 #define __SPECIAL_INSTRUCTION_PREAMBLE \
669 "ror x12, x12, #3 ; ror x12, x12, #13 \n\t" \
670 "ror x12, x12, #51 ; ror x12, x12, #61 \n\t"
672 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
673 _zzq_default, _zzq_request, \
674 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
677 ({volatile unsigned long long int _zzq_args[6]; \
678 volatile unsigned long long int _zzq_result; \
679 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
680 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
681 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
682 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
683 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
684 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
685 __asm__ volatile("mov x3, %1\n\t" \
687 __SPECIAL_INSTRUCTION_PREAMBLE \
689 "orr x10, x10, x10\n\t" \
691 : "=r" (_zzq_result) \
692 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
693 : "cc","memory", "x3", "x4"); \
697 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
698 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
699 unsigned long long int __addr; \
700 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
702 "orr x11, x11, x11\n\t" \
706 : "cc", "memory", "x3" \
708 _zzq_orig->nraddr = __addr; \
711 #define VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
712 __SPECIAL_INSTRUCTION_PREAMBLE \
714 "orr x12, x12, x12\n\t"
716 #define VALGRIND_VEX_INJECT_IR() \
718 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
719 "orr x9, x9, x9\n\t" \
720 : : : "cc", "memory" \
728 #if defined(PLAT_s390x_linux)
732 unsigned long long int nraddr;
740 #define __SPECIAL_INSTRUCTION_PREAMBLE \
746 #define __CLIENT_REQUEST_CODE "lr 2,2\n\t"
747 #define __GET_NR_CONTEXT_CODE "lr 3,3\n\t"
748 #define __CALL_NO_REDIR_CODE "lr 4,4\n\t"
749 #define __VEX_INJECT_IR_CODE "lr 5,5\n\t"
751 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
752 _zzq_default, _zzq_request, \
753 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
755 ({volatile unsigned long long int _zzq_args[6]; \
756 volatile unsigned long long int _zzq_result; \
757 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
758 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
759 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
760 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
761 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
762 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
767 __SPECIAL_INSTRUCTION_PREAMBLE \
768 __CLIENT_REQUEST_CODE \
771 : "=d" (_zzq_result) \
772 : "a" (&_zzq_args[0]), "0" (_zzq_default) \
773 : "cc", "2", "3", "memory" \
778 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
779 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
780 volatile unsigned long long int __addr; \
781 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
782 __GET_NR_CONTEXT_CODE \
786 : "cc", "3", "memory" \
788 _zzq_orig->nraddr = __addr; \
791 #define VALGRIND_CALL_NOREDIR_R1 \
792 __SPECIAL_INSTRUCTION_PREAMBLE \
795 #define VALGRIND_VEX_INJECT_IR() \
797 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
798 __VEX_INJECT_IR_CODE); \
805 #if defined(PLAT_mips32_linux)
817 #define __SPECIAL_INSTRUCTION_PREAMBLE \
818 "srl $0, $0, 13\n\t" \
819 "srl $0, $0, 29\n\t" \
820 "srl $0, $0, 3\n\t" \
823 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
824 _zzq_default, _zzq_request, \
825 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
827 ({ volatile unsigned int _zzq_args[6]; \
828 volatile unsigned int _zzq_result; \
829 _zzq_args[0] = (unsigned int)(_zzq_request); \
830 _zzq_args[1] = (unsigned int)(_zzq_arg1); \
831 _zzq_args[2] = (unsigned int)(_zzq_arg2); \
832 _zzq_args[3] = (unsigned int)(_zzq_arg3); \
833 _zzq_args[4] = (unsigned int)(_zzq_arg4); \
834 _zzq_args[5] = (unsigned int)(_zzq_arg5); \
835 __asm__ volatile("move $11, %1\n\t" \
837 __SPECIAL_INSTRUCTION_PREAMBLE \
839 "or $13, $13, $13\n\t" \
841 : "=r" (_zzq_result) \
842 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
847 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
848 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
849 volatile unsigned int __addr; \
850 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
852 "or $14, $14, $14\n\t" \
858 _zzq_orig->nraddr = __addr; \
861 #define VALGRIND_CALL_NOREDIR_T9 \
862 __SPECIAL_INSTRUCTION_PREAMBLE \
864 "or $15, $15, $15\n\t"
866 #define VALGRIND_VEX_INJECT_IR() \
868 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
869 "or $11, $11, $11\n\t" \
878 #if defined(PLAT_mips64_linux)
882 unsigned long long nraddr;
890 #define __SPECIAL_INSTRUCTION_PREAMBLE \
891 "dsll $0,$0, 3 ; dsll $0,$0,13\n\t" \
892 "dsll $0,$0,29 ; dsll $0,$0,19\n\t"
894 #define VALGRIND_DO_CLIENT_REQUEST_EXPR( \
895 _zzq_default, _zzq_request, \
896 _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
898 ({ volatile unsigned long long int _zzq_args[6]; \
899 volatile unsigned long long int _zzq_result; \
900 _zzq_args[0] = (unsigned long long int)(_zzq_request); \
901 _zzq_args[1] = (unsigned long long int)(_zzq_arg1); \
902 _zzq_args[2] = (unsigned long long int)(_zzq_arg2); \
903 _zzq_args[3] = (unsigned long long int)(_zzq_arg3); \
904 _zzq_args[4] = (unsigned long long int)(_zzq_arg4); \
905 _zzq_args[5] = (unsigned long long int)(_zzq_arg5); \
906 __asm__ volatile("move $11, %1\n\t" \
908 __SPECIAL_INSTRUCTION_PREAMBLE \
910 "or $13, $13, $13\n\t" \
912 : "=r" (_zzq_result) \
913 : "r" (_zzq_default), "r" (&_zzq_args[0]) \
918 #define VALGRIND_GET_NR_CONTEXT(_zzq_rlval) \
919 { volatile OrigFn* _zzq_orig = &(_zzq_rlval); \
920 volatile unsigned long long int __addr; \
921 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
923 "or $14, $14, $14\n\t" \
928 _zzq_orig->nraddr = __addr; \
931 #define VALGRIND_CALL_NOREDIR_T9 \
932 __SPECIAL_INSTRUCTION_PREAMBLE \
934 "or $15, $15, $15\n\t"
936 #define VALGRIND_VEX_INJECT_IR() \
938 __asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
939 "or $11, $11, $11\n\t" \
981 #define VG_CONCAT4(_aa,_bb,_cc,_dd) _aa##_bb##_cc##_dd
983 #define I_WRAP_SONAME_FNNAME_ZU(soname,fnname) \
984 VG_CONCAT4(_vgw00000ZU_,soname,_,fnname)
986 #define I_WRAP_SONAME_FNNAME_ZZ(soname,fnname) \
987 VG_CONCAT4(_vgw00000ZZ_,soname,_,fnname)
993 #define VALGRIND_GET_ORIG_FN(_lval) VALGRIND_GET_NR_CONTEXT(_lval)
1001 #define I_REPLACE_SONAME_FNNAME_ZU(soname,fnname) \
1002 VG_CONCAT4(_vgr00000ZU_,soname,_,fnname)
1004 #define I_REPLACE_SONAME_FNNAME_ZZ(soname,fnname) \
1005 VG_CONCAT4(_vgr00000ZZ_,soname,_,fnname)
1010 #define CALL_FN_v_v(fnptr) \
1011 do { volatile unsigned long _junk; \
1012 CALL_FN_W_v(_junk,fnptr); } while (0)
1014 #define CALL_FN_v_W(fnptr, arg1) \
1015 do { volatile unsigned long _junk; \
1016 CALL_FN_W_W(_junk,fnptr,arg1); } while (0)
1018 #define CALL_FN_v_WW(fnptr, arg1,arg2) \
1019 do { volatile unsigned long _junk; \
1020 CALL_FN_W_WW(_junk,fnptr,arg1,arg2); } while (0)
1022 #define CALL_FN_v_WWW(fnptr, arg1,arg2,arg3) \
1023 do { volatile unsigned long _junk; \
1024 CALL_FN_W_WWW(_junk,fnptr,arg1,arg2,arg3); } while (0)
1026 #define CALL_FN_v_WWWW(fnptr, arg1,arg2,arg3,arg4) \
1027 do { volatile unsigned long _junk; \
1028 CALL_FN_W_WWWW(_junk,fnptr,arg1,arg2,arg3,arg4); } while (0)
1030 #define CALL_FN_v_5W(fnptr, arg1,arg2,arg3,arg4,arg5) \
1031 do { volatile unsigned long _junk; \
1032 CALL_FN_W_5W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5); } while (0)
1034 #define CALL_FN_v_6W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6) \
1035 do { volatile unsigned long _junk; \
1036 CALL_FN_W_6W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6); } while (0)
1038 #define CALL_FN_v_7W(fnptr, arg1,arg2,arg3,arg4,arg5,arg6,arg7) \
1039 do { volatile unsigned long _junk; \
1040 CALL_FN_W_7W(_junk,fnptr,arg1,arg2,arg3,arg4,arg5,arg6,arg7); } while (0)
1044 #if defined(PLAT_x86_linux) || defined(PLAT_x86_darwin)
1048 #define __CALLER_SAVED_REGS "ecx", "edx"
1055 #define VALGRIND_ALIGN_STACK \
1056 "movl %%esp,%%edi\n\t" \
1057 "andl $0xfffffff0,%%esp\n\t"
1058 #define VALGRIND_RESTORE_STACK \
1059 "movl %%edi,%%esp\n\t"
1064 #define CALL_FN_W_v(lval, orig) \
1066 volatile OrigFn _orig = (orig); \
1067 volatile unsigned long _argvec[1]; \
1068 volatile unsigned long _res; \
1069 _argvec[0] = (unsigned long)_orig.nraddr; \
1071 VALGRIND_ALIGN_STACK \
1072 "movl (%%eax), %%eax\n\t" \
1073 VALGRIND_CALL_NOREDIR_EAX \
1074 VALGRIND_RESTORE_STACK \
1076 :
"a" (&_argvec[0]) \
1077 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1079 lval = (__typeof__(lval)) _res; \
1082 #define CALL_FN_W_W(lval, orig, arg1) \
1084 volatile OrigFn _orig = (orig); \
1085 volatile unsigned long _argvec[2]; \
1086 volatile unsigned long _res; \
1087 _argvec[0] = (unsigned long)_orig.nraddr; \
1088 _argvec[1] = (unsigned long)(arg1); \
1090 VALGRIND_ALIGN_STACK \
1091 "subl $12, %%esp\n\t" \
1092 "pushl 4(%%eax)\n\t" \
1093 "movl (%%eax), %%eax\n\t"
\
1094 VALGRIND_CALL_NOREDIR_EAX \
1095 VALGRIND_RESTORE_STACK \
1097 :
"a" (&_argvec[0]) \
1098 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1100 lval = (__typeof__(lval)) _res; \
1103 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1105 volatile OrigFn _orig = (orig); \
1106 volatile unsigned long _argvec[3]; \
1107 volatile unsigned long _res; \
1108 _argvec[0] = (unsigned long)_orig.nraddr; \
1109 _argvec[1] = (unsigned long)(arg1); \
1110 _argvec[2] = (unsigned long)(arg2); \
1112 VALGRIND_ALIGN_STACK \
1113 "subl $8, %%esp\n\t" \
1114 "pushl 8(%%eax)\n\t" \
1115 "pushl 4(%%eax)\n\t" \
1116 "movl (%%eax), %%eax\n\t"
\
1117 VALGRIND_CALL_NOREDIR_EAX \
1118 VALGRIND_RESTORE_STACK \
1120 :
"a" (&_argvec[0]) \
1121 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1123 lval = (__typeof__(lval)) _res; \
1126 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1128 volatile OrigFn _orig = (orig); \
1129 volatile unsigned long _argvec[4]; \
1130 volatile unsigned long _res; \
1131 _argvec[0] = (unsigned long)_orig.nraddr; \
1132 _argvec[1] = (unsigned long)(arg1); \
1133 _argvec[2] = (unsigned long)(arg2); \
1134 _argvec[3] = (unsigned long)(arg3); \
1136 VALGRIND_ALIGN_STACK \
1137 "subl $4, %%esp\n\t" \
1138 "pushl 12(%%eax)\n\t" \
1139 "pushl 8(%%eax)\n\t" \
1140 "pushl 4(%%eax)\n\t" \
1141 "movl (%%eax), %%eax\n\t"
\
1142 VALGRIND_CALL_NOREDIR_EAX \
1143 VALGRIND_RESTORE_STACK \
1145 :
"a" (&_argvec[0]) \
1146 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1148 lval = (__typeof__(lval)) _res; \
1151 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1153 volatile OrigFn _orig = (orig); \
1154 volatile unsigned long _argvec[5]; \
1155 volatile unsigned long _res; \
1156 _argvec[0] = (unsigned long)_orig.nraddr; \
1157 _argvec[1] = (unsigned long)(arg1); \
1158 _argvec[2] = (unsigned long)(arg2); \
1159 _argvec[3] = (unsigned long)(arg3); \
1160 _argvec[4] = (unsigned long)(arg4); \
1162 VALGRIND_ALIGN_STACK \
1163 "pushl 16(%%eax)\n\t" \
1164 "pushl 12(%%eax)\n\t" \
1165 "pushl 8(%%eax)\n\t" \
1166 "pushl 4(%%eax)\n\t" \
1167 "movl (%%eax), %%eax\n\t"
\
1168 VALGRIND_CALL_NOREDIR_EAX \
1169 VALGRIND_RESTORE_STACK \
1171 :
"a" (&_argvec[0]) \
1172 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1174 lval = (__typeof__(lval)) _res; \
1177 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1179 volatile OrigFn _orig = (orig); \
1180 volatile unsigned long _argvec[6]; \
1181 volatile unsigned long _res; \
1182 _argvec[0] = (unsigned long)_orig.nraddr; \
1183 _argvec[1] = (unsigned long)(arg1); \
1184 _argvec[2] = (unsigned long)(arg2); \
1185 _argvec[3] = (unsigned long)(arg3); \
1186 _argvec[4] = (unsigned long)(arg4); \
1187 _argvec[5] = (unsigned long)(arg5); \
1189 VALGRIND_ALIGN_STACK \
1190 "subl $12, %%esp\n\t" \
1191 "pushl 20(%%eax)\n\t" \
1192 "pushl 16(%%eax)\n\t" \
1193 "pushl 12(%%eax)\n\t" \
1194 "pushl 8(%%eax)\n\t" \
1195 "pushl 4(%%eax)\n\t" \
1196 "movl (%%eax), %%eax\n\t"
\
1197 VALGRIND_CALL_NOREDIR_EAX \
1198 VALGRIND_RESTORE_STACK \
1200 :
"a" (&_argvec[0]) \
1201 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1203 lval = (__typeof__(lval)) _res; \
1206 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1208 volatile OrigFn _orig = (orig); \
1209 volatile unsigned long _argvec[7]; \
1210 volatile unsigned long _res; \
1211 _argvec[0] = (unsigned long)_orig.nraddr; \
1212 _argvec[1] = (unsigned long)(arg1); \
1213 _argvec[2] = (unsigned long)(arg2); \
1214 _argvec[3] = (unsigned long)(arg3); \
1215 _argvec[4] = (unsigned long)(arg4); \
1216 _argvec[5] = (unsigned long)(arg5); \
1217 _argvec[6] = (unsigned long)(arg6); \
1219 VALGRIND_ALIGN_STACK \
1220 "subl $8, %%esp\n\t" \
1221 "pushl 24(%%eax)\n\t" \
1222 "pushl 20(%%eax)\n\t" \
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_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1240 volatile OrigFn _orig = (orig); \
1241 volatile unsigned long _argvec[8]; \
1242 volatile unsigned long _res; \
1243 _argvec[0] = (unsigned long)_orig.nraddr; \
1244 _argvec[1] = (unsigned long)(arg1); \
1245 _argvec[2] = (unsigned long)(arg2); \
1246 _argvec[3] = (unsigned long)(arg3); \
1247 _argvec[4] = (unsigned long)(arg4); \
1248 _argvec[5] = (unsigned long)(arg5); \
1249 _argvec[6] = (unsigned long)(arg6); \
1250 _argvec[7] = (unsigned long)(arg7); \
1252 VALGRIND_ALIGN_STACK \
1253 "subl $4, %%esp\n\t" \
1254 "pushl 28(%%eax)\n\t" \
1255 "pushl 24(%%eax)\n\t" \
1256 "pushl 20(%%eax)\n\t" \
1257 "pushl 16(%%eax)\n\t" \
1258 "pushl 12(%%eax)\n\t" \
1259 "pushl 8(%%eax)\n\t" \
1260 "pushl 4(%%eax)\n\t" \
1261 "movl (%%eax), %%eax\n\t"
\
1262 VALGRIND_CALL_NOREDIR_EAX \
1263 VALGRIND_RESTORE_STACK \
1265 :
"a" (&_argvec[0]) \
1266 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1268 lval = (__typeof__(lval)) _res; \
1271 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1274 volatile OrigFn _orig = (orig); \
1275 volatile unsigned long _argvec[9]; \
1276 volatile unsigned long _res; \
1277 _argvec[0] = (unsigned long)_orig.nraddr; \
1278 _argvec[1] = (unsigned long)(arg1); \
1279 _argvec[2] = (unsigned long)(arg2); \
1280 _argvec[3] = (unsigned long)(arg3); \
1281 _argvec[4] = (unsigned long)(arg4); \
1282 _argvec[5] = (unsigned long)(arg5); \
1283 _argvec[6] = (unsigned long)(arg6); \
1284 _argvec[7] = (unsigned long)(arg7); \
1285 _argvec[8] = (unsigned long)(arg8); \
1287 VALGRIND_ALIGN_STACK \
1288 "pushl 32(%%eax)\n\t" \
1289 "pushl 28(%%eax)\n\t" \
1290 "pushl 24(%%eax)\n\t" \
1291 "pushl 20(%%eax)\n\t" \
1292 "pushl 16(%%eax)\n\t" \
1293 "pushl 12(%%eax)\n\t" \
1294 "pushl 8(%%eax)\n\t" \
1295 "pushl 4(%%eax)\n\t" \
1296 "movl (%%eax), %%eax\n\t"
\
1297 VALGRIND_CALL_NOREDIR_EAX \
1298 VALGRIND_RESTORE_STACK \
1300 :
"a" (&_argvec[0]) \
1301 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1303 lval = (__typeof__(lval)) _res; \
1306 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1309 volatile OrigFn _orig = (orig); \
1310 volatile unsigned long _argvec[10]; \
1311 volatile unsigned long _res; \
1312 _argvec[0] = (unsigned long)_orig.nraddr; \
1313 _argvec[1] = (unsigned long)(arg1); \
1314 _argvec[2] = (unsigned long)(arg2); \
1315 _argvec[3] = (unsigned long)(arg3); \
1316 _argvec[4] = (unsigned long)(arg4); \
1317 _argvec[5] = (unsigned long)(arg5); \
1318 _argvec[6] = (unsigned long)(arg6); \
1319 _argvec[7] = (unsigned long)(arg7); \
1320 _argvec[8] = (unsigned long)(arg8); \
1321 _argvec[9] = (unsigned long)(arg9); \
1323 VALGRIND_ALIGN_STACK \
1324 "subl $12, %%esp\n\t" \
1325 "pushl 36(%%eax)\n\t" \
1326 "pushl 32(%%eax)\n\t" \
1327 "pushl 28(%%eax)\n\t" \
1328 "pushl 24(%%eax)\n\t" \
1329 "pushl 20(%%eax)\n\t" \
1330 "pushl 16(%%eax)\n\t" \
1331 "pushl 12(%%eax)\n\t" \
1332 "pushl 8(%%eax)\n\t" \
1333 "pushl 4(%%eax)\n\t" \
1334 "movl (%%eax), %%eax\n\t"
\
1335 VALGRIND_CALL_NOREDIR_EAX \
1336 VALGRIND_RESTORE_STACK \
1338 :
"a" (&_argvec[0]) \
1339 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1341 lval = (__typeof__(lval)) _res; \
1344 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1345 arg7,arg8,arg9,arg10) \
1347 volatile OrigFn _orig = (orig); \
1348 volatile unsigned long _argvec[11]; \
1349 volatile unsigned long _res; \
1350 _argvec[0] = (unsigned long)_orig.nraddr; \
1351 _argvec[1] = (unsigned long)(arg1); \
1352 _argvec[2] = (unsigned long)(arg2); \
1353 _argvec[3] = (unsigned long)(arg3); \
1354 _argvec[4] = (unsigned long)(arg4); \
1355 _argvec[5] = (unsigned long)(arg5); \
1356 _argvec[6] = (unsigned long)(arg6); \
1357 _argvec[7] = (unsigned long)(arg7); \
1358 _argvec[8] = (unsigned long)(arg8); \
1359 _argvec[9] = (unsigned long)(arg9); \
1360 _argvec[10] = (unsigned long)(arg10); \
1362 VALGRIND_ALIGN_STACK \
1363 "subl $8, %%esp\n\t" \
1364 "pushl 40(%%eax)\n\t" \
1365 "pushl 36(%%eax)\n\t" \
1366 "pushl 32(%%eax)\n\t" \
1367 "pushl 28(%%eax)\n\t" \
1368 "pushl 24(%%eax)\n\t" \
1369 "pushl 20(%%eax)\n\t" \
1370 "pushl 16(%%eax)\n\t" \
1371 "pushl 12(%%eax)\n\t" \
1372 "pushl 8(%%eax)\n\t" \
1373 "pushl 4(%%eax)\n\t" \
1374 "movl (%%eax), %%eax\n\t"
\
1375 VALGRIND_CALL_NOREDIR_EAX \
1376 VALGRIND_RESTORE_STACK \
1378 :
"a" (&_argvec[0]) \
1379 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1381 lval = (__typeof__(lval)) _res; \
1384 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
1385 arg6,arg7,arg8,arg9,arg10, \
1388 volatile OrigFn _orig = (orig); \
1389 volatile unsigned long _argvec[12]; \
1390 volatile unsigned long _res; \
1391 _argvec[0] = (unsigned long)_orig.nraddr; \
1392 _argvec[1] = (unsigned long)(arg1); \
1393 _argvec[2] = (unsigned long)(arg2); \
1394 _argvec[3] = (unsigned long)(arg3); \
1395 _argvec[4] = (unsigned long)(arg4); \
1396 _argvec[5] = (unsigned long)(arg5); \
1397 _argvec[6] = (unsigned long)(arg6); \
1398 _argvec[7] = (unsigned long)(arg7); \
1399 _argvec[8] = (unsigned long)(arg8); \
1400 _argvec[9] = (unsigned long)(arg9); \
1401 _argvec[10] = (unsigned long)(arg10); \
1402 _argvec[11] = (unsigned long)(arg11); \
1404 VALGRIND_ALIGN_STACK \
1405 "subl $4, %%esp\n\t" \
1406 "pushl 44(%%eax)\n\t" \
1407 "pushl 40(%%eax)\n\t" \
1408 "pushl 36(%%eax)\n\t" \
1409 "pushl 32(%%eax)\n\t" \
1410 "pushl 28(%%eax)\n\t" \
1411 "pushl 24(%%eax)\n\t" \
1412 "pushl 20(%%eax)\n\t" \
1413 "pushl 16(%%eax)\n\t" \
1414 "pushl 12(%%eax)\n\t" \
1415 "pushl 8(%%eax)\n\t" \
1416 "pushl 4(%%eax)\n\t" \
1417 "movl (%%eax), %%eax\n\t"
\
1418 VALGRIND_CALL_NOREDIR_EAX \
1419 VALGRIND_RESTORE_STACK \
1421 :
"a" (&_argvec[0]) \
1422 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1424 lval = (__typeof__(lval)) _res; \
1427 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
1428 arg6,arg7,arg8,arg9,arg10, \
1431 volatile OrigFn _orig = (orig); \
1432 volatile unsigned long _argvec[13]; \
1433 volatile unsigned long _res; \
1434 _argvec[0] = (unsigned long)_orig.nraddr; \
1435 _argvec[1] = (unsigned long)(arg1); \
1436 _argvec[2] = (unsigned long)(arg2); \
1437 _argvec[3] = (unsigned long)(arg3); \
1438 _argvec[4] = (unsigned long)(arg4); \
1439 _argvec[5] = (unsigned long)(arg5); \
1440 _argvec[6] = (unsigned long)(arg6); \
1441 _argvec[7] = (unsigned long)(arg7); \
1442 _argvec[8] = (unsigned long)(arg8); \
1443 _argvec[9] = (unsigned long)(arg9); \
1444 _argvec[10] = (unsigned long)(arg10); \
1445 _argvec[11] = (unsigned long)(arg11); \
1446 _argvec[12] = (unsigned long)(arg12); \
1448 VALGRIND_ALIGN_STACK \
1449 "pushl 48(%%eax)\n\t" \
1450 "pushl 44(%%eax)\n\t" \
1451 "pushl 40(%%eax)\n\t" \
1452 "pushl 36(%%eax)\n\t" \
1453 "pushl 32(%%eax)\n\t" \
1454 "pushl 28(%%eax)\n\t" \
1455 "pushl 24(%%eax)\n\t" \
1456 "pushl 20(%%eax)\n\t" \
1457 "pushl 16(%%eax)\n\t" \
1458 "pushl 12(%%eax)\n\t" \
1459 "pushl 8(%%eax)\n\t" \
1460 "pushl 4(%%eax)\n\t" \
1461 "movl (%%eax), %%eax\n\t"
\
1462 VALGRIND_CALL_NOREDIR_EAX \
1463 VALGRIND_RESTORE_STACK \
1465 :
"a" (&_argvec[0]) \
1466 :
"cc", "memory", __CALLER_SAVED_REGS, "edi" \
1468 lval = (__typeof__(lval)) _res; \
1475 #if defined(PLAT_amd64_linux) || defined(PLAT_amd64_darwin)
1480 #define __CALLER_SAVED_REGS "rcx", "rdx", "rsi", \
1481 "rdi", "r8", "r9", "r10", "r11"
1537 #if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
1538 # define __FRAME_POINTER \
1539 ,"r"(__builtin_dwarf_cfa())
1540 # define VALGRIND_CFI_PROLOGUE \
1541 "movq %%rbp, %%r15\n\t" \
1542 "movq %2, %%rbp\n\t" \
1543 ".cfi_remember_state\n\t" \
1544 ".cfi_def_cfa rbp, 0\n\t"
1545 # define VALGRIND_CFI_EPILOGUE \
1546 "movq %%r15, %%rbp\n\t" \
1547 ".cfi_restore_state\n\t"
1549 # define __FRAME_POINTER
1550 # define VALGRIND_CFI_PROLOGUE
1551 # define VALGRIND_CFI_EPILOGUE
1559 #define VALGRIND_ALIGN_STACK \
1560 "movq %%rsp,%%r14\n\t" \
1561 "andq $0xfffffffffffffff0,%%rsp\n\t"
1562 #define VALGRIND_RESTORE_STACK \
1563 "movq %%r14,%%rsp\n\t"
1589 #define CALL_FN_W_v(lval, orig) \
1591 volatile OrigFn _orig = (orig); \
1592 volatile unsigned long _argvec[1]; \
1593 volatile unsigned long _res; \
1594 _argvec[0] = (unsigned long)_orig.nraddr; \
1596 VALGRIND_CFI_PROLOGUE \
1597 VALGRIND_ALIGN_STACK \
1598 "subq $128,%%rsp\n\t" \
1599 "movq (%%rax), %%rax\n\t"
\
1600 VALGRIND_CALL_NOREDIR_RAX \
1601 VALGRIND_RESTORE_STACK \
1602 VALGRIND_CFI_EPILOGUE \
1604 :
"a" (&_argvec[0]) __FRAME_POINTER \
1605 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1607 lval = (__typeof__(lval)) _res; \
1610 #define CALL_FN_W_W(lval, orig, arg1) \
1612 volatile OrigFn _orig = (orig); \
1613 volatile unsigned long _argvec[2]; \
1614 volatile unsigned long _res; \
1615 _argvec[0] = (unsigned long)_orig.nraddr; \
1616 _argvec[1] = (unsigned long)(arg1); \
1618 VALGRIND_CFI_PROLOGUE \
1619 VALGRIND_ALIGN_STACK \
1620 "subq $128,%%rsp\n\t" \
1621 "movq 8(%%rax), %%rdi\n\t" \
1622 "movq (%%rax), %%rax\n\t"
\
1623 VALGRIND_CALL_NOREDIR_RAX \
1624 VALGRIND_RESTORE_STACK \
1625 VALGRIND_CFI_EPILOGUE \
1627 :
"a" (&_argvec[0]) __FRAME_POINTER \
1628 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1630 lval = (__typeof__(lval)) _res; \
1633 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
1635 volatile OrigFn _orig = (orig); \
1636 volatile unsigned long _argvec[3]; \
1637 volatile unsigned long _res; \
1638 _argvec[0] = (unsigned long)_orig.nraddr; \
1639 _argvec[1] = (unsigned long)(arg1); \
1640 _argvec[2] = (unsigned long)(arg2); \
1642 VALGRIND_CFI_PROLOGUE \
1643 VALGRIND_ALIGN_STACK \
1644 "subq $128,%%rsp\n\t" \
1645 "movq 16(%%rax), %%rsi\n\t" \
1646 "movq 8(%%rax), %%rdi\n\t" \
1647 "movq (%%rax), %%rax\n\t"
\
1648 VALGRIND_CALL_NOREDIR_RAX \
1649 VALGRIND_RESTORE_STACK \
1650 VALGRIND_CFI_EPILOGUE \
1652 :
"a" (&_argvec[0]) __FRAME_POINTER \
1653 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1655 lval = (__typeof__(lval)) _res; \
1658 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
1660 volatile OrigFn _orig = (orig); \
1661 volatile unsigned long _argvec[4]; \
1662 volatile unsigned long _res; \
1663 _argvec[0] = (unsigned long)_orig.nraddr; \
1664 _argvec[1] = (unsigned long)(arg1); \
1665 _argvec[2] = (unsigned long)(arg2); \
1666 _argvec[3] = (unsigned long)(arg3); \
1668 VALGRIND_CFI_PROLOGUE \
1669 VALGRIND_ALIGN_STACK \
1670 "subq $128,%%rsp\n\t" \
1671 "movq 24(%%rax), %%rdx\n\t" \
1672 "movq 16(%%rax), %%rsi\n\t" \
1673 "movq 8(%%rax), %%rdi\n\t" \
1674 "movq (%%rax), %%rax\n\t"
\
1675 VALGRIND_CALL_NOREDIR_RAX \
1676 VALGRIND_RESTORE_STACK \
1677 VALGRIND_CFI_EPILOGUE \
1679 :
"a" (&_argvec[0]) __FRAME_POINTER \
1680 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1682 lval = (__typeof__(lval)) _res; \
1685 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
1687 volatile OrigFn _orig = (orig); \
1688 volatile unsigned long _argvec[5]; \
1689 volatile unsigned long _res; \
1690 _argvec[0] = (unsigned long)_orig.nraddr; \
1691 _argvec[1] = (unsigned long)(arg1); \
1692 _argvec[2] = (unsigned long)(arg2); \
1693 _argvec[3] = (unsigned long)(arg3); \
1694 _argvec[4] = (unsigned long)(arg4); \
1696 VALGRIND_CFI_PROLOGUE \
1697 VALGRIND_ALIGN_STACK \
1698 "subq $128,%%rsp\n\t" \
1699 "movq 32(%%rax), %%rcx\n\t" \
1700 "movq 24(%%rax), %%rdx\n\t" \
1701 "movq 16(%%rax), %%rsi\n\t" \
1702 "movq 8(%%rax), %%rdi\n\t" \
1703 "movq (%%rax), %%rax\n\t"
\
1704 VALGRIND_CALL_NOREDIR_RAX \
1705 VALGRIND_RESTORE_STACK \
1706 VALGRIND_CFI_EPILOGUE \
1708 :
"a" (&_argvec[0]) __FRAME_POINTER \
1709 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1711 lval = (__typeof__(lval)) _res; \
1714 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
1716 volatile OrigFn _orig = (orig); \
1717 volatile unsigned long _argvec[6]; \
1718 volatile unsigned long _res; \
1719 _argvec[0] = (unsigned long)_orig.nraddr; \
1720 _argvec[1] = (unsigned long)(arg1); \
1721 _argvec[2] = (unsigned long)(arg2); \
1722 _argvec[3] = (unsigned long)(arg3); \
1723 _argvec[4] = (unsigned long)(arg4); \
1724 _argvec[5] = (unsigned long)(arg5); \
1726 VALGRIND_CFI_PROLOGUE \
1727 VALGRIND_ALIGN_STACK \
1728 "subq $128,%%rsp\n\t" \
1729 "movq 40(%%rax), %%r8\n\t" \
1730 "movq 32(%%rax), %%rcx\n\t" \
1731 "movq 24(%%rax), %%rdx\n\t" \
1732 "movq 16(%%rax), %%rsi\n\t" \
1733 "movq 8(%%rax), %%rdi\n\t" \
1734 "movq (%%rax), %%rax\n\t"
\
1735 VALGRIND_CALL_NOREDIR_RAX \
1736 VALGRIND_RESTORE_STACK \
1737 VALGRIND_CFI_EPILOGUE \
1739 :
"a" (&_argvec[0]) __FRAME_POINTER \
1740 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1742 lval = (__typeof__(lval)) _res; \
1745 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
1747 volatile OrigFn _orig = (orig); \
1748 volatile unsigned long _argvec[7]; \
1749 volatile unsigned long _res; \
1750 _argvec[0] = (unsigned long)_orig.nraddr; \
1751 _argvec[1] = (unsigned long)(arg1); \
1752 _argvec[2] = (unsigned long)(arg2); \
1753 _argvec[3] = (unsigned long)(arg3); \
1754 _argvec[4] = (unsigned long)(arg4); \
1755 _argvec[5] = (unsigned long)(arg5); \
1756 _argvec[6] = (unsigned long)(arg6); \
1758 VALGRIND_CFI_PROLOGUE \
1759 VALGRIND_ALIGN_STACK \
1760 "subq $128,%%rsp\n\t" \
1761 "movq 48(%%rax), %%r9\n\t" \
1762 "movq 40(%%rax), %%r8\n\t" \
1763 "movq 32(%%rax), %%rcx\n\t" \
1764 "movq 24(%%rax), %%rdx\n\t" \
1765 "movq 16(%%rax), %%rsi\n\t" \
1766 "movq 8(%%rax), %%rdi\n\t" \
1767 "movq (%%rax), %%rax\n\t"
\
1768 VALGRIND_CALL_NOREDIR_RAX \
1769 VALGRIND_RESTORE_STACK \
1770 VALGRIND_CFI_EPILOGUE \
1772 :
"a" (&_argvec[0]) __FRAME_POINTER \
1773 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1775 lval = (__typeof__(lval)) _res; \
1778 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1781 volatile OrigFn _orig = (orig); \
1782 volatile unsigned long _argvec[8]; \
1783 volatile unsigned long _res; \
1784 _argvec[0] = (unsigned long)_orig.nraddr; \
1785 _argvec[1] = (unsigned long)(arg1); \
1786 _argvec[2] = (unsigned long)(arg2); \
1787 _argvec[3] = (unsigned long)(arg3); \
1788 _argvec[4] = (unsigned long)(arg4); \
1789 _argvec[5] = (unsigned long)(arg5); \
1790 _argvec[6] = (unsigned long)(arg6); \
1791 _argvec[7] = (unsigned long)(arg7); \
1793 VALGRIND_CFI_PROLOGUE \
1794 VALGRIND_ALIGN_STACK \
1795 "subq $136,%%rsp\n\t" \
1796 "pushq 56(%%rax)\n\t" \
1797 "movq 48(%%rax), %%r9\n\t" \
1798 "movq 40(%%rax), %%r8\n\t" \
1799 "movq 32(%%rax), %%rcx\n\t" \
1800 "movq 24(%%rax), %%rdx\n\t" \
1801 "movq 16(%%rax), %%rsi\n\t" \
1802 "movq 8(%%rax), %%rdi\n\t" \
1803 "movq (%%rax), %%rax\n\t"
\
1804 VALGRIND_CALL_NOREDIR_RAX \
1805 VALGRIND_RESTORE_STACK \
1806 VALGRIND_CFI_EPILOGUE \
1808 :
"a" (&_argvec[0]) __FRAME_POINTER \
1809 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1811 lval = (__typeof__(lval)) _res; \
1814 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1817 volatile OrigFn _orig = (orig); \
1818 volatile unsigned long _argvec[9]; \
1819 volatile unsigned long _res; \
1820 _argvec[0] = (unsigned long)_orig.nraddr; \
1821 _argvec[1] = (unsigned long)(arg1); \
1822 _argvec[2] = (unsigned long)(arg2); \
1823 _argvec[3] = (unsigned long)(arg3); \
1824 _argvec[4] = (unsigned long)(arg4); \
1825 _argvec[5] = (unsigned long)(arg5); \
1826 _argvec[6] = (unsigned long)(arg6); \
1827 _argvec[7] = (unsigned long)(arg7); \
1828 _argvec[8] = (unsigned long)(arg8); \
1830 VALGRIND_CFI_PROLOGUE \
1831 VALGRIND_ALIGN_STACK \
1832 "subq $128,%%rsp\n\t" \
1833 "pushq 64(%%rax)\n\t" \
1834 "pushq 56(%%rax)\n\t" \
1835 "movq 48(%%rax), %%r9\n\t" \
1836 "movq 40(%%rax), %%r8\n\t" \
1837 "movq 32(%%rax), %%rcx\n\t" \
1838 "movq 24(%%rax), %%rdx\n\t" \
1839 "movq 16(%%rax), %%rsi\n\t" \
1840 "movq 8(%%rax), %%rdi\n\t" \
1841 "movq (%%rax), %%rax\n\t"
\
1842 VALGRIND_CALL_NOREDIR_RAX \
1843 VALGRIND_RESTORE_STACK \
1844 VALGRIND_CFI_EPILOGUE \
1846 :
"a" (&_argvec[0]) __FRAME_POINTER \
1847 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1849 lval = (__typeof__(lval)) _res; \
1852 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1855 volatile OrigFn _orig = (orig); \
1856 volatile unsigned long _argvec[10]; \
1857 volatile unsigned long _res; \
1858 _argvec[0] = (unsigned long)_orig.nraddr; \
1859 _argvec[1] = (unsigned long)(arg1); \
1860 _argvec[2] = (unsigned long)(arg2); \
1861 _argvec[3] = (unsigned long)(arg3); \
1862 _argvec[4] = (unsigned long)(arg4); \
1863 _argvec[5] = (unsigned long)(arg5); \
1864 _argvec[6] = (unsigned long)(arg6); \
1865 _argvec[7] = (unsigned long)(arg7); \
1866 _argvec[8] = (unsigned long)(arg8); \
1867 _argvec[9] = (unsigned long)(arg9); \
1869 VALGRIND_CFI_PROLOGUE \
1870 VALGRIND_ALIGN_STACK \
1871 "subq $136,%%rsp\n\t" \
1872 "pushq 72(%%rax)\n\t" \
1873 "pushq 64(%%rax)\n\t" \
1874 "pushq 56(%%rax)\n\t" \
1875 "movq 48(%%rax), %%r9\n\t" \
1876 "movq 40(%%rax), %%r8\n\t" \
1877 "movq 32(%%rax), %%rcx\n\t" \
1878 "movq 24(%%rax), %%rdx\n\t" \
1879 "movq 16(%%rax), %%rsi\n\t" \
1880 "movq 8(%%rax), %%rdi\n\t" \
1881 "movq (%%rax), %%rax\n\t"
\
1882 VALGRIND_CALL_NOREDIR_RAX \
1883 VALGRIND_RESTORE_STACK \
1884 VALGRIND_CFI_EPILOGUE \
1886 :
"a" (&_argvec[0]) __FRAME_POINTER \
1887 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1889 lval = (__typeof__(lval)) _res; \
1892 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1893 arg7,arg8,arg9,arg10) \
1895 volatile OrigFn _orig = (orig); \
1896 volatile unsigned long _argvec[11]; \
1897 volatile unsigned long _res; \
1898 _argvec[0] = (unsigned long)_orig.nraddr; \
1899 _argvec[1] = (unsigned long)(arg1); \
1900 _argvec[2] = (unsigned long)(arg2); \
1901 _argvec[3] = (unsigned long)(arg3); \
1902 _argvec[4] = (unsigned long)(arg4); \
1903 _argvec[5] = (unsigned long)(arg5); \
1904 _argvec[6] = (unsigned long)(arg6); \
1905 _argvec[7] = (unsigned long)(arg7); \
1906 _argvec[8] = (unsigned long)(arg8); \
1907 _argvec[9] = (unsigned long)(arg9); \
1908 _argvec[10] = (unsigned long)(arg10); \
1910 VALGRIND_CFI_PROLOGUE \
1911 VALGRIND_ALIGN_STACK \
1912 "subq $128,%%rsp\n\t" \
1913 "pushq 80(%%rax)\n\t" \
1914 "pushq 72(%%rax)\n\t" \
1915 "pushq 64(%%rax)\n\t" \
1916 "pushq 56(%%rax)\n\t" \
1917 "movq 48(%%rax), %%r9\n\t" \
1918 "movq 40(%%rax), %%r8\n\t" \
1919 "movq 32(%%rax), %%rcx\n\t" \
1920 "movq 24(%%rax), %%rdx\n\t" \
1921 "movq 16(%%rax), %%rsi\n\t" \
1922 "movq 8(%%rax), %%rdi\n\t" \
1923 "movq (%%rax), %%rax\n\t"
\
1924 VALGRIND_CALL_NOREDIR_RAX \
1925 VALGRIND_RESTORE_STACK \
1926 VALGRIND_CFI_EPILOGUE \
1928 :
"a" (&_argvec[0]) __FRAME_POINTER \
1929 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1931 lval = (__typeof__(lval)) _res; \
1934 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1935 arg7,arg8,arg9,arg10,arg11) \
1937 volatile OrigFn _orig = (orig); \
1938 volatile unsigned long _argvec[12]; \
1939 volatile unsigned long _res; \
1940 _argvec[0] = (unsigned long)_orig.nraddr; \
1941 _argvec[1] = (unsigned long)(arg1); \
1942 _argvec[2] = (unsigned long)(arg2); \
1943 _argvec[3] = (unsigned long)(arg3); \
1944 _argvec[4] = (unsigned long)(arg4); \
1945 _argvec[5] = (unsigned long)(arg5); \
1946 _argvec[6] = (unsigned long)(arg6); \
1947 _argvec[7] = (unsigned long)(arg7); \
1948 _argvec[8] = (unsigned long)(arg8); \
1949 _argvec[9] = (unsigned long)(arg9); \
1950 _argvec[10] = (unsigned long)(arg10); \
1951 _argvec[11] = (unsigned long)(arg11); \
1953 VALGRIND_CFI_PROLOGUE \
1954 VALGRIND_ALIGN_STACK \
1955 "subq $136,%%rsp\n\t" \
1956 "pushq 88(%%rax)\n\t" \
1957 "pushq 80(%%rax)\n\t" \
1958 "pushq 72(%%rax)\n\t" \
1959 "pushq 64(%%rax)\n\t" \
1960 "pushq 56(%%rax)\n\t" \
1961 "movq 48(%%rax), %%r9\n\t" \
1962 "movq 40(%%rax), %%r8\n\t" \
1963 "movq 32(%%rax), %%rcx\n\t" \
1964 "movq 24(%%rax), %%rdx\n\t" \
1965 "movq 16(%%rax), %%rsi\n\t" \
1966 "movq 8(%%rax), %%rdi\n\t" \
1967 "movq (%%rax), %%rax\n\t"
\
1968 VALGRIND_CALL_NOREDIR_RAX \
1969 VALGRIND_RESTORE_STACK \
1970 VALGRIND_CFI_EPILOGUE \
1972 :
"a" (&_argvec[0]) __FRAME_POINTER \
1973 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
1975 lval = (__typeof__(lval)) _res; \
1978 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
1979 arg7,arg8,arg9,arg10,arg11,arg12) \
1981 volatile OrigFn _orig = (orig); \
1982 volatile unsigned long _argvec[13]; \
1983 volatile unsigned long _res; \
1984 _argvec[0] = (unsigned long)_orig.nraddr; \
1985 _argvec[1] = (unsigned long)(arg1); \
1986 _argvec[2] = (unsigned long)(arg2); \
1987 _argvec[3] = (unsigned long)(arg3); \
1988 _argvec[4] = (unsigned long)(arg4); \
1989 _argvec[5] = (unsigned long)(arg5); \
1990 _argvec[6] = (unsigned long)(arg6); \
1991 _argvec[7] = (unsigned long)(arg7); \
1992 _argvec[8] = (unsigned long)(arg8); \
1993 _argvec[9] = (unsigned long)(arg9); \
1994 _argvec[10] = (unsigned long)(arg10); \
1995 _argvec[11] = (unsigned long)(arg11); \
1996 _argvec[12] = (unsigned long)(arg12); \
1998 VALGRIND_CFI_PROLOGUE \
1999 VALGRIND_ALIGN_STACK \
2000 "subq $128,%%rsp\n\t" \
2001 "pushq 96(%%rax)\n\t" \
2002 "pushq 88(%%rax)\n\t" \
2003 "pushq 80(%%rax)\n\t" \
2004 "pushq 72(%%rax)\n\t" \
2005 "pushq 64(%%rax)\n\t" \
2006 "pushq 56(%%rax)\n\t" \
2007 "movq 48(%%rax), %%r9\n\t" \
2008 "movq 40(%%rax), %%r8\n\t" \
2009 "movq 32(%%rax), %%rcx\n\t" \
2010 "movq 24(%%rax), %%rdx\n\t" \
2011 "movq 16(%%rax), %%rsi\n\t" \
2012 "movq 8(%%rax), %%rdi\n\t" \
2013 "movq (%%rax), %%rax\n\t"
\
2014 VALGRIND_CALL_NOREDIR_RAX \
2015 VALGRIND_RESTORE_STACK \
2016 VALGRIND_CFI_EPILOGUE \
2018 :
"a" (&_argvec[0]) __FRAME_POINTER \
2019 :
"cc", "memory", __CALLER_SAVED_REGS, "r14", "r15" \
2021 lval = (__typeof__(lval)) _res; \
2028 #if defined(PLAT_ppc32_linux)
2054 #define __CALLER_SAVED_REGS \
2055 "lr", "ctr", "xer", \
2056 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2057 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
2065 #define VALGRIND_ALIGN_STACK \
2067 "rlwinm 1,1,0,0,27\n\t"
2068 #define VALGRIND_RESTORE_STACK \
2074 #define CALL_FN_W_v(lval, orig) \
2076 volatile OrigFn _orig = (orig); \
2077 volatile unsigned long _argvec[1]; \
2078 volatile unsigned long _res; \
2079 _argvec[0] = (unsigned long)_orig.nraddr; \
2081 VALGRIND_ALIGN_STACK \
2083 "lwz 11,0(11)\n\t"
\
2084 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2085 VALGRIND_RESTORE_STACK \
2088 :
"r" (&_argvec[0]) \
2089 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2091 lval = (__typeof__(lval)) _res; \
2094 #define CALL_FN_W_W(lval, orig, arg1) \
2096 volatile OrigFn _orig = (orig); \
2097 volatile unsigned long _argvec[2]; \
2098 volatile unsigned long _res; \
2099 _argvec[0] = (unsigned long)_orig.nraddr; \
2100 _argvec[1] = (unsigned long)arg1; \
2102 VALGRIND_ALIGN_STACK \
2105 "lwz 11,0(11)\n\t" \
2106 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2107 VALGRIND_RESTORE_STACK \
2110 :
"r" (&_argvec[0]) \
2111 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2113 lval = (__typeof__(lval)) _res; \
2116 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
2118 volatile OrigFn _orig = (orig); \
2119 volatile unsigned long _argvec[3]; \
2120 volatile unsigned long _res; \
2121 _argvec[0] = (unsigned long)_orig.nraddr; \
2122 _argvec[1] = (unsigned long)arg1; \
2123 _argvec[2] = (unsigned long)arg2; \
2125 VALGRIND_ALIGN_STACK \
2129 "lwz 11,0(11)\n\t"
\
2130 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2131 VALGRIND_RESTORE_STACK \
2134 :
"r" (&_argvec[0]) \
2135 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2137 lval = (__typeof__(lval)) _res; \
2140 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2142 volatile OrigFn _orig = (orig); \
2143 volatile unsigned long _argvec[4]; \
2144 volatile unsigned long _res; \
2145 _argvec[0] = (unsigned long)_orig.nraddr; \
2146 _argvec[1] = (unsigned long)arg1; \
2147 _argvec[2] = (unsigned long)arg2; \
2148 _argvec[3] = (unsigned long)arg3; \
2150 VALGRIND_ALIGN_STACK \
2154 "lwz 5,12(11)\n\t" \
2155 "lwz 11,0(11)\n\t"
\
2156 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2157 VALGRIND_RESTORE_STACK \
2160 :
"r" (&_argvec[0]) \
2161 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2163 lval = (__typeof__(lval)) _res; \
2166 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2168 volatile OrigFn _orig = (orig); \
2169 volatile unsigned long _argvec[5]; \
2170 volatile unsigned long _res; \
2171 _argvec[0] = (unsigned long)_orig.nraddr; \
2172 _argvec[1] = (unsigned long)arg1; \
2173 _argvec[2] = (unsigned long)arg2; \
2174 _argvec[3] = (unsigned long)arg3; \
2175 _argvec[4] = (unsigned long)arg4; \
2177 VALGRIND_ALIGN_STACK \
2181 "lwz 5,12(11)\n\t" \
2182 "lwz 6,16(11)\n\t"
\
2183 "lwz 11,0(11)\n\t" \
2184 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2185 VALGRIND_RESTORE_STACK \
2188 :
"r" (&_argvec[0]) \
2189 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2191 lval = (__typeof__(lval)) _res; \
2194 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2196 volatile OrigFn _orig = (orig); \
2197 volatile unsigned long _argvec[6]; \
2198 volatile unsigned long _res; \
2199 _argvec[0] = (unsigned long)_orig.nraddr; \
2200 _argvec[1] = (unsigned long)arg1; \
2201 _argvec[2] = (unsigned long)arg2; \
2202 _argvec[3] = (unsigned long)arg3; \
2203 _argvec[4] = (unsigned long)arg4; \
2204 _argvec[5] = (unsigned long)arg5; \
2206 VALGRIND_ALIGN_STACK \
2210 "lwz 5,12(11)\n\t" \
2211 "lwz 6,16(11)\n\t"
\
2212 "lwz 7,20(11)\n\t" \
2213 "lwz 11,0(11)\n\t"
\
2214 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2215 VALGRIND_RESTORE_STACK \
2218 :
"r" (&_argvec[0]) \
2219 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2221 lval = (__typeof__(lval)) _res; \
2224 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2226 volatile OrigFn _orig = (orig); \
2227 volatile unsigned long _argvec[7]; \
2228 volatile unsigned long _res; \
2229 _argvec[0] = (unsigned long)_orig.nraddr; \
2230 _argvec[1] = (unsigned long)arg1; \
2231 _argvec[2] = (unsigned long)arg2; \
2232 _argvec[3] = (unsigned long)arg3; \
2233 _argvec[4] = (unsigned long)arg4; \
2234 _argvec[5] = (unsigned long)arg5; \
2235 _argvec[6] = (unsigned long)arg6; \
2237 VALGRIND_ALIGN_STACK \
2241 "lwz 5,12(11)\n\t" \
2242 "lwz 6,16(11)\n\t"
\
2243 "lwz 7,20(11)\n\t" \
2244 "lwz 8,24(11)\n\t" \
2245 "lwz 11,0(11)\n\t"
\
2246 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2247 VALGRIND_RESTORE_STACK \
2250 :
"r" (&_argvec[0]) \
2251 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2253 lval = (__typeof__(lval)) _res; \
2256 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2259 volatile OrigFn _orig = (orig); \
2260 volatile unsigned long _argvec[8]; \
2261 volatile unsigned long _res; \
2262 _argvec[0] = (unsigned long)_orig.nraddr; \
2263 _argvec[1] = (unsigned long)arg1; \
2264 _argvec[2] = (unsigned long)arg2; \
2265 _argvec[3] = (unsigned long)arg3; \
2266 _argvec[4] = (unsigned long)arg4; \
2267 _argvec[5] = (unsigned long)arg5; \
2268 _argvec[6] = (unsigned long)arg6; \
2269 _argvec[7] = (unsigned long)arg7; \
2271 VALGRIND_ALIGN_STACK \
2275 "lwz 5,12(11)\n\t" \
2276 "lwz 6,16(11)\n\t"
\
2277 "lwz 7,20(11)\n\t" \
2278 "lwz 8,24(11)\n\t" \
2279 "lwz 9,28(11)\n\t" \
2280 "lwz 11,0(11)\n\t"
\
2281 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2282 VALGRIND_RESTORE_STACK \
2285 :
"r" (&_argvec[0]) \
2286 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2288 lval = (__typeof__(lval)) _res; \
2291 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2294 volatile OrigFn _orig = (orig); \
2295 volatile unsigned long _argvec[9]; \
2296 volatile unsigned long _res; \
2297 _argvec[0] = (unsigned long)_orig.nraddr; \
2298 _argvec[1] = (unsigned long)arg1; \
2299 _argvec[2] = (unsigned long)arg2; \
2300 _argvec[3] = (unsigned long)arg3; \
2301 _argvec[4] = (unsigned long)arg4; \
2302 _argvec[5] = (unsigned long)arg5; \
2303 _argvec[6] = (unsigned long)arg6; \
2304 _argvec[7] = (unsigned long)arg7; \
2305 _argvec[8] = (unsigned long)arg8; \
2307 VALGRIND_ALIGN_STACK \
2311 "lwz 5,12(11)\n\t" \
2312 "lwz 6,16(11)\n\t"
\
2313 "lwz 7,20(11)\n\t" \
2314 "lwz 8,24(11)\n\t" \
2315 "lwz 9,28(11)\n\t" \
2316 "lwz 10,32(11)\n\t"
\
2317 "lwz 11,0(11)\n\t" \
2318 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2319 VALGRIND_RESTORE_STACK \
2322 :
"r" (&_argvec[0]) \
2323 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2325 lval = (__typeof__(lval)) _res; \
2328 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2331 volatile OrigFn _orig = (orig); \
2332 volatile unsigned long _argvec[10]; \
2333 volatile unsigned long _res; \
2334 _argvec[0] = (unsigned long)_orig.nraddr; \
2335 _argvec[1] = (unsigned long)arg1; \
2336 _argvec[2] = (unsigned long)arg2; \
2337 _argvec[3] = (unsigned long)arg3; \
2338 _argvec[4] = (unsigned long)arg4; \
2339 _argvec[5] = (unsigned long)arg5; \
2340 _argvec[6] = (unsigned long)arg6; \
2341 _argvec[7] = (unsigned long)arg7; \
2342 _argvec[8] = (unsigned long)arg8; \
2343 _argvec[9] = (unsigned long)arg9; \
2345 VALGRIND_ALIGN_STACK \
2347 "addi 1,1,-16\n\t" \
2349 "lwz 3,36(11)\n\t" \
2354 "lwz 5,12(11)\n\t" \
2355 "lwz 6,16(11)\n\t"
\
2356 "lwz 7,20(11)\n\t" \
2357 "lwz 8,24(11)\n\t" \
2358 "lwz 9,28(11)\n\t" \
2359 "lwz 10,32(11)\n\t"
\
2360 "lwz 11,0(11)\n\t" \
2361 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2362 VALGRIND_RESTORE_STACK \
2365 :
"r" (&_argvec[0]) \
2366 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2368 lval = (__typeof__(lval)) _res; \
2371 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2372 arg7,arg8,arg9,arg10) \
2374 volatile OrigFn _orig = (orig); \
2375 volatile unsigned long _argvec[11]; \
2376 volatile unsigned long _res; \
2377 _argvec[0] = (unsigned long)_orig.nraddr; \
2378 _argvec[1] = (unsigned long)arg1; \
2379 _argvec[2] = (unsigned long)arg2; \
2380 _argvec[3] = (unsigned long)arg3; \
2381 _argvec[4] = (unsigned long)arg4; \
2382 _argvec[5] = (unsigned long)arg5; \
2383 _argvec[6] = (unsigned long)arg6; \
2384 _argvec[7] = (unsigned long)arg7; \
2385 _argvec[8] = (unsigned long)arg8; \
2386 _argvec[9] = (unsigned long)arg9; \
2387 _argvec[10] = (unsigned long)arg10; \
2389 VALGRIND_ALIGN_STACK \
2391 "addi 1,1,-16\n\t" \
2393 "lwz 3,40(11)\n\t" \
2396 "lwz 3,36(11)\n\t" \
2401 "lwz 5,12(11)\n\t" \
2402 "lwz 6,16(11)\n\t"
\
2403 "lwz 7,20(11)\n\t" \
2404 "lwz 8,24(11)\n\t" \
2405 "lwz 9,28(11)\n\t" \
2406 "lwz 10,32(11)\n\t"
\
2407 "lwz 11,0(11)\n\t" \
2408 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2409 VALGRIND_RESTORE_STACK \
2412 :
"r" (&_argvec[0]) \
2413 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2415 lval = (__typeof__(lval)) _res; \
2418 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2419 arg7,arg8,arg9,arg10,arg11) \
2421 volatile OrigFn _orig = (orig); \
2422 volatile unsigned long _argvec[12]; \
2423 volatile unsigned long _res; \
2424 _argvec[0] = (unsigned long)_orig.nraddr; \
2425 _argvec[1] = (unsigned long)arg1; \
2426 _argvec[2] = (unsigned long)arg2; \
2427 _argvec[3] = (unsigned long)arg3; \
2428 _argvec[4] = (unsigned long)arg4; \
2429 _argvec[5] = (unsigned long)arg5; \
2430 _argvec[6] = (unsigned long)arg6; \
2431 _argvec[7] = (unsigned long)arg7; \
2432 _argvec[8] = (unsigned long)arg8; \
2433 _argvec[9] = (unsigned long)arg9; \
2434 _argvec[10] = (unsigned long)arg10; \
2435 _argvec[11] = (unsigned long)arg11; \
2437 VALGRIND_ALIGN_STACK \
2439 "addi 1,1,-32\n\t" \
2441 "lwz 3,44(11)\n\t" \
2444 "lwz 3,40(11)\n\t" \
2447 "lwz 3,36(11)\n\t" \
2452 "lwz 5,12(11)\n\t" \
2453 "lwz 6,16(11)\n\t"
\
2454 "lwz 7,20(11)\n\t" \
2455 "lwz 8,24(11)\n\t" \
2456 "lwz 9,28(11)\n\t" \
2457 "lwz 10,32(11)\n\t"
\
2458 "lwz 11,0(11)\n\t" \
2459 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2460 VALGRIND_RESTORE_STACK \
2463 :
"r" (&_argvec[0]) \
2464 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2466 lval = (__typeof__(lval)) _res; \
2469 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2470 arg7,arg8,arg9,arg10,arg11,arg12) \
2472 volatile OrigFn _orig = (orig); \
2473 volatile unsigned long _argvec[13]; \
2474 volatile unsigned long _res; \
2475 _argvec[0] = (unsigned long)_orig.nraddr; \
2476 _argvec[1] = (unsigned long)arg1; \
2477 _argvec[2] = (unsigned long)arg2; \
2478 _argvec[3] = (unsigned long)arg3; \
2479 _argvec[4] = (unsigned long)arg4; \
2480 _argvec[5] = (unsigned long)arg5; \
2481 _argvec[6] = (unsigned long)arg6; \
2482 _argvec[7] = (unsigned long)arg7; \
2483 _argvec[8] = (unsigned long)arg8; \
2484 _argvec[9] = (unsigned long)arg9; \
2485 _argvec[10] = (unsigned long)arg10; \
2486 _argvec[11] = (unsigned long)arg11; \
2487 _argvec[12] = (unsigned long)arg12; \
2489 VALGRIND_ALIGN_STACK \
2491 "addi 1,1,-32\n\t" \
2493 "lwz 3,48(11)\n\t" \
2496 "lwz 3,44(11)\n\t" \
2499 "lwz 3,40(11)\n\t" \
2502 "lwz 3,36(11)\n\t" \
2507 "lwz 5,12(11)\n\t" \
2508 "lwz 6,16(11)\n\t"
\
2509 "lwz 7,20(11)\n\t" \
2510 "lwz 8,24(11)\n\t" \
2511 "lwz 9,28(11)\n\t" \
2512 "lwz 10,32(11)\n\t"
\
2513 "lwz 11,0(11)\n\t" \
2514 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2515 VALGRIND_RESTORE_STACK \
2518 :
"r" (&_argvec[0]) \
2519 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2521 lval = (__typeof__(lval)) _res; \
2528 #if defined(PLAT_ppc64_linux)
2533 #define __CALLER_SAVED_REGS \
2534 "lr", "ctr", "xer", \
2535 "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
2536 "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", \
2544 #define VALGRIND_ALIGN_STACK \
2546 "rldicr 1,1,0,59\n\t"
2547 #define VALGRIND_RESTORE_STACK \
2553 #define CALL_FN_W_v(lval, orig) \
2555 volatile OrigFn _orig = (orig); \
2556 volatile unsigned long _argvec[3+0]; \
2557 volatile unsigned long _res; \
2559 _argvec[1] = (unsigned long)_orig.r2; \
2560 _argvec[2] = (unsigned long)_orig.nraddr; \
2562 VALGRIND_ALIGN_STACK \
2564 "std 2,-16(11)\n\t"
\
2566 "ld 11, 0(11)\n\t" \
2567 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2570 "ld 2,-16(11)\n\t"
\
2571 VALGRIND_RESTORE_STACK \
2573 :
"r" (&_argvec[2]) \
2574 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2576 lval = (__typeof__(lval)) _res; \
2579 #define CALL_FN_W_W(lval, orig, arg1) \
2581 volatile OrigFn _orig = (orig); \
2582 volatile unsigned long _argvec[3+1]; \
2583 volatile unsigned long _res; \
2585 _argvec[1] = (unsigned long)_orig.r2; \
2586 _argvec[2] = (unsigned long)_orig.nraddr; \
2587 _argvec[2+1] = (unsigned long)arg1; \
2589 VALGRIND_ALIGN_STACK \
2591 "std 2,-16(11)\n\t"
\
2594 "ld 11, 0(11)\n\t" \
2595 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2598 "ld 2,-16(11)\n\t"
\
2599 VALGRIND_RESTORE_STACK \
2601 :
"r" (&_argvec[2]) \
2602 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2604 lval = (__typeof__(lval)) _res; \
2607 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
2609 volatile OrigFn _orig = (orig); \
2610 volatile unsigned long _argvec[3+2]; \
2611 volatile unsigned long _res; \
2613 _argvec[1] = (unsigned long)_orig.r2; \
2614 _argvec[2] = (unsigned long)_orig.nraddr; \
2615 _argvec[2+1] = (unsigned long)arg1; \
2616 _argvec[2+2] = (unsigned long)arg2; \
2618 VALGRIND_ALIGN_STACK \
2620 "std 2,-16(11)\n\t"
\
2623 "ld 4, 16(11)\n\t" \
2624 "ld 11, 0(11)\n\t" \
2625 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2628 "ld 2,-16(11)\n\t"
\
2629 VALGRIND_RESTORE_STACK \
2631 :
"r" (&_argvec[2]) \
2632 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2634 lval = (__typeof__(lval)) _res; \
2637 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
2639 volatile OrigFn _orig = (orig); \
2640 volatile unsigned long _argvec[3+3]; \
2641 volatile unsigned long _res; \
2643 _argvec[1] = (unsigned long)_orig.r2; \
2644 _argvec[2] = (unsigned long)_orig.nraddr; \
2645 _argvec[2+1] = (unsigned long)arg1; \
2646 _argvec[2+2] = (unsigned long)arg2; \
2647 _argvec[2+3] = (unsigned long)arg3; \
2649 VALGRIND_ALIGN_STACK \
2651 "std 2,-16(11)\n\t"
\
2654 "ld 4, 16(11)\n\t" \
2655 "ld 5, 24(11)\n\t" \
2656 "ld 11, 0(11)\n\t" \
2657 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2660 "ld 2,-16(11)\n\t"
\
2661 VALGRIND_RESTORE_STACK \
2663 :
"r" (&_argvec[2]) \
2664 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2666 lval = (__typeof__(lval)) _res; \
2669 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
2671 volatile OrigFn _orig = (orig); \
2672 volatile unsigned long _argvec[3+4]; \
2673 volatile unsigned long _res; \
2675 _argvec[1] = (unsigned long)_orig.r2; \
2676 _argvec[2] = (unsigned long)_orig.nraddr; \
2677 _argvec[2+1] = (unsigned long)arg1; \
2678 _argvec[2+2] = (unsigned long)arg2; \
2679 _argvec[2+3] = (unsigned long)arg3; \
2680 _argvec[2+4] = (unsigned long)arg4; \
2682 VALGRIND_ALIGN_STACK \
2684 "std 2,-16(11)\n\t"
\
2687 "ld 4, 16(11)\n\t" \
2688 "ld 5, 24(11)\n\t" \
2689 "ld 6, 32(11)\n\t" \
2690 "ld 11, 0(11)\n\t" \
2691 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2694 "ld 2,-16(11)\n\t"
\
2695 VALGRIND_RESTORE_STACK \
2697 :
"r" (&_argvec[2]) \
2698 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2700 lval = (__typeof__(lval)) _res; \
2703 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
2705 volatile OrigFn _orig = (orig); \
2706 volatile unsigned long _argvec[3+5]; \
2707 volatile unsigned long _res; \
2709 _argvec[1] = (unsigned long)_orig.r2; \
2710 _argvec[2] = (unsigned long)_orig.nraddr; \
2711 _argvec[2+1] = (unsigned long)arg1; \
2712 _argvec[2+2] = (unsigned long)arg2; \
2713 _argvec[2+3] = (unsigned long)arg3; \
2714 _argvec[2+4] = (unsigned long)arg4; \
2715 _argvec[2+5] = (unsigned long)arg5; \
2717 VALGRIND_ALIGN_STACK \
2719 "std 2,-16(11)\n\t"
\
2722 "ld 4, 16(11)\n\t" \
2723 "ld 5, 24(11)\n\t" \
2724 "ld 6, 32(11)\n\t" \
2725 "ld 7, 40(11)\n\t" \
2726 "ld 11, 0(11)\n\t" \
2727 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2730 "ld 2,-16(11)\n\t"
\
2731 VALGRIND_RESTORE_STACK \
2733 :
"r" (&_argvec[2]) \
2734 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2736 lval = (__typeof__(lval)) _res; \
2739 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
2741 volatile OrigFn _orig = (orig); \
2742 volatile unsigned long _argvec[3+6]; \
2743 volatile unsigned long _res; \
2745 _argvec[1] = (unsigned long)_orig.r2; \
2746 _argvec[2] = (unsigned long)_orig.nraddr; \
2747 _argvec[2+1] = (unsigned long)arg1; \
2748 _argvec[2+2] = (unsigned long)arg2; \
2749 _argvec[2+3] = (unsigned long)arg3; \
2750 _argvec[2+4] = (unsigned long)arg4; \
2751 _argvec[2+5] = (unsigned long)arg5; \
2752 _argvec[2+6] = (unsigned long)arg6; \
2754 VALGRIND_ALIGN_STACK \
2756 "std 2,-16(11)\n\t"
\
2759 "ld 4, 16(11)\n\t" \
2760 "ld 5, 24(11)\n\t" \
2761 "ld 6, 32(11)\n\t" \
2762 "ld 7, 40(11)\n\t" \
2763 "ld 8, 48(11)\n\t" \
2764 "ld 11, 0(11)\n\t" \
2765 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2768 "ld 2,-16(11)\n\t"
\
2769 VALGRIND_RESTORE_STACK \
2771 :
"r" (&_argvec[2]) \
2772 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2774 lval = (__typeof__(lval)) _res; \
2777 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2780 volatile OrigFn _orig = (orig); \
2781 volatile unsigned long _argvec[3+7]; \
2782 volatile unsigned long _res; \
2784 _argvec[1] = (unsigned long)_orig.r2; \
2785 _argvec[2] = (unsigned long)_orig.nraddr; \
2786 _argvec[2+1] = (unsigned long)arg1; \
2787 _argvec[2+2] = (unsigned long)arg2; \
2788 _argvec[2+3] = (unsigned long)arg3; \
2789 _argvec[2+4] = (unsigned long)arg4; \
2790 _argvec[2+5] = (unsigned long)arg5; \
2791 _argvec[2+6] = (unsigned long)arg6; \
2792 _argvec[2+7] = (unsigned long)arg7; \
2794 VALGRIND_ALIGN_STACK \
2796 "std 2,-16(11)\n\t"
\
2799 "ld 4, 16(11)\n\t" \
2800 "ld 5, 24(11)\n\t" \
2801 "ld 6, 32(11)\n\t" \
2802 "ld 7, 40(11)\n\t" \
2803 "ld 8, 48(11)\n\t" \
2804 "ld 9, 56(11)\n\t" \
2805 "ld 11, 0(11)\n\t" \
2806 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2809 "ld 2,-16(11)\n\t"
\
2810 VALGRIND_RESTORE_STACK \
2812 :
"r" (&_argvec[2]) \
2813 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2815 lval = (__typeof__(lval)) _res; \
2818 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2821 volatile OrigFn _orig = (orig); \
2822 volatile unsigned long _argvec[3+8]; \
2823 volatile unsigned long _res; \
2825 _argvec[1] = (unsigned long)_orig.r2; \
2826 _argvec[2] = (unsigned long)_orig.nraddr; \
2827 _argvec[2+1] = (unsigned long)arg1; \
2828 _argvec[2+2] = (unsigned long)arg2; \
2829 _argvec[2+3] = (unsigned long)arg3; \
2830 _argvec[2+4] = (unsigned long)arg4; \
2831 _argvec[2+5] = (unsigned long)arg5; \
2832 _argvec[2+6] = (unsigned long)arg6; \
2833 _argvec[2+7] = (unsigned long)arg7; \
2834 _argvec[2+8] = (unsigned long)arg8; \
2836 VALGRIND_ALIGN_STACK \
2838 "std 2,-16(11)\n\t"
\
2841 "ld 4, 16(11)\n\t" \
2842 "ld 5, 24(11)\n\t" \
2843 "ld 6, 32(11)\n\t" \
2844 "ld 7, 40(11)\n\t" \
2845 "ld 8, 48(11)\n\t" \
2846 "ld 9, 56(11)\n\t" \
2847 "ld 10, 64(11)\n\t" \
2848 "ld 11, 0(11)\n\t" \
2849 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2852 "ld 2,-16(11)\n\t"
\
2853 VALGRIND_RESTORE_STACK \
2855 :
"r" (&_argvec[2]) \
2856 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2858 lval = (__typeof__(lval)) _res; \
2861 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2864 volatile OrigFn _orig = (orig); \
2865 volatile unsigned long _argvec[3+9]; \
2866 volatile unsigned long _res; \
2868 _argvec[1] = (unsigned long)_orig.r2; \
2869 _argvec[2] = (unsigned long)_orig.nraddr; \
2870 _argvec[2+1] = (unsigned long)arg1; \
2871 _argvec[2+2] = (unsigned long)arg2; \
2872 _argvec[2+3] = (unsigned long)arg3; \
2873 _argvec[2+4] = (unsigned long)arg4; \
2874 _argvec[2+5] = (unsigned long)arg5; \
2875 _argvec[2+6] = (unsigned long)arg6; \
2876 _argvec[2+7] = (unsigned long)arg7; \
2877 _argvec[2+8] = (unsigned long)arg8; \
2878 _argvec[2+9] = (unsigned long)arg9; \
2880 VALGRIND_ALIGN_STACK \
2882 "std 2,-16(11)\n\t"
\
2884 "addi 1,1,-128\n\t" \
2887 "std 3,112(1)\n\t" \
2890 "ld 4, 16(11)\n\t" \
2891 "ld 5, 24(11)\n\t" \
2892 "ld 6, 32(11)\n\t" \
2893 "ld 7, 40(11)\n\t" \
2894 "ld 8, 48(11)\n\t" \
2895 "ld 9, 56(11)\n\t" \
2896 "ld 10, 64(11)\n\t" \
2897 "ld 11, 0(11)\n\t" \
2898 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2901 "ld 2,-16(11)\n\t"
\
2902 VALGRIND_RESTORE_STACK \
2904 :
"r" (&_argvec[2]) \
2905 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2907 lval = (__typeof__(lval)) _res; \
2910 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2911 arg7,arg8,arg9,arg10) \
2913 volatile OrigFn _orig = (orig); \
2914 volatile unsigned long _argvec[3+10]; \
2915 volatile unsigned long _res; \
2917 _argvec[1] = (unsigned long)_orig.r2; \
2918 _argvec[2] = (unsigned long)_orig.nraddr; \
2919 _argvec[2+1] = (unsigned long)arg1; \
2920 _argvec[2+2] = (unsigned long)arg2; \
2921 _argvec[2+3] = (unsigned long)arg3; \
2922 _argvec[2+4] = (unsigned long)arg4; \
2923 _argvec[2+5] = (unsigned long)arg5; \
2924 _argvec[2+6] = (unsigned long)arg6; \
2925 _argvec[2+7] = (unsigned long)arg7; \
2926 _argvec[2+8] = (unsigned long)arg8; \
2927 _argvec[2+9] = (unsigned long)arg9; \
2928 _argvec[2+10] = (unsigned long)arg10; \
2930 VALGRIND_ALIGN_STACK \
2932 "std 2,-16(11)\n\t"
\
2934 "addi 1,1,-128\n\t" \
2937 "std 3,120(1)\n\t" \
2940 "std 3,112(1)\n\t" \
2943 "ld 4, 16(11)\n\t" \
2944 "ld 5, 24(11)\n\t" \
2945 "ld 6, 32(11)\n\t" \
2946 "ld 7, 40(11)\n\t" \
2947 "ld 8, 48(11)\n\t" \
2948 "ld 9, 56(11)\n\t" \
2949 "ld 10, 64(11)\n\t" \
2950 "ld 11, 0(11)\n\t" \
2951 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
2954 "ld 2,-16(11)\n\t"
\
2955 VALGRIND_RESTORE_STACK \
2957 :
"r" (&_argvec[2]) \
2958 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
2960 lval = (__typeof__(lval)) _res; \
2963 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
2964 arg7,arg8,arg9,arg10,arg11) \
2966 volatile OrigFn _orig = (orig); \
2967 volatile unsigned long _argvec[3+11]; \
2968 volatile unsigned long _res; \
2970 _argvec[1] = (unsigned long)_orig.r2; \
2971 _argvec[2] = (unsigned long)_orig.nraddr; \
2972 _argvec[2+1] = (unsigned long)arg1; \
2973 _argvec[2+2] = (unsigned long)arg2; \
2974 _argvec[2+3] = (unsigned long)arg3; \
2975 _argvec[2+4] = (unsigned long)arg4; \
2976 _argvec[2+5] = (unsigned long)arg5; \
2977 _argvec[2+6] = (unsigned long)arg6; \
2978 _argvec[2+7] = (unsigned long)arg7; \
2979 _argvec[2+8] = (unsigned long)arg8; \
2980 _argvec[2+9] = (unsigned long)arg9; \
2981 _argvec[2+10] = (unsigned long)arg10; \
2982 _argvec[2+11] = (unsigned long)arg11; \
2984 VALGRIND_ALIGN_STACK \
2986 "std 2,-16(11)\n\t"
\
2988 "addi 1,1,-144\n\t" \
2991 "std 3,128(1)\n\t" \
2994 "std 3,120(1)\n\t" \
2997 "std 3,112(1)\n\t" \
3000 "ld 4, 16(11)\n\t" \
3001 "ld 5, 24(11)\n\t" \
3002 "ld 6, 32(11)\n\t" \
3003 "ld 7, 40(11)\n\t" \
3004 "ld 8, 48(11)\n\t" \
3005 "ld 9, 56(11)\n\t" \
3006 "ld 10, 64(11)\n\t" \
3007 "ld 11, 0(11)\n\t" \
3008 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R11 \
3011 "ld 2,-16(11)\n\t"
\
3012 VALGRIND_RESTORE_STACK \
3014 :
"r" (&_argvec[2]) \
3015 :
"cc", "memory", __CALLER_SAVED_REGS, "r28" \
3017 lval = (__typeof__(lval)) _res; \
3020 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3021 arg7,arg8,arg9,arg10,arg11,arg12) \
3023 volatile OrigFn _orig = (orig); \
3024 volatile unsigned long _argvec[3+12]; \
3025 volatile unsigned long _res; \
3027 _argvec[1] = (unsigned long)_orig.r2; \
3028 _argvec[2] = (unsigned long)_orig.nraddr; \
3029 _argvec[2+1] = (unsigned long)arg1; \
3030 _argvec[2+2] = (unsigned long)arg2; \
3031 _argvec[2+3] = (unsigned long)arg3; \
3032 _argvec[2+4] = (unsigned long)arg4; \
3033 _argvec[2+5] = (unsigned long)arg5; \
3034 _argvec[2+6] = (unsigned long)arg6; \
3035 _argvec[2+7] = (unsigned long)arg7; \
3036 _argvec[2+8] = (unsigned long)arg8; \
3037 _argvec[2+9] = (unsigned long)arg9; \
3038 _argvec[2+10] = (unsigned long)arg10; \
3039 _argvec[2+11] = (unsigned long)arg11; \
3040 _argvec[2+12] = (unsigned long)arg12; \
3042 VALGRIND_ALIGN_STACK \
3044 "std 2,-16(11)\n\t"
\
3046 "addi 1,1,-144\n\t" \
3049 "std 3,136(1)\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; \
3085 #if defined(PLAT_arm_linux)
3088 #define __CALLER_SAVED_REGS "r0", "r1", "r2", "r3","r4","r14"
3103 #define VALGRIND_ALIGN_STACK \
3106 "bic r4, r4, #7\n\t" \
3108 #define VALGRIND_RESTORE_STACK \
3114 #define CALL_FN_W_v(lval, orig) \
3116 volatile OrigFn _orig = (orig); \
3117 volatile unsigned long _argvec[1]; \
3118 volatile unsigned long _res; \
3119 _argvec[0] = (unsigned long)_orig.nraddr; \
3121 VALGRIND_ALIGN_STACK \
3122 "ldr r4, [%1] \n\t" \
3123 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3124 VALGRIND_RESTORE_STACK \
3127 :
"0" (&_argvec[0]) \
3128 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3130 lval = (__typeof__(lval)) _res; \
3133 #define CALL_FN_W_W(lval, orig, arg1) \
3135 volatile OrigFn _orig = (orig); \
3136 volatile unsigned long _argvec[2]; \
3137 volatile unsigned long _res; \
3138 _argvec[0] = (unsigned long)_orig.nraddr; \
3139 _argvec[1] = (unsigned long)(arg1); \
3141 VALGRIND_ALIGN_STACK \
3142 "ldr r0, [%1, #4] \n\t" \
3143 "ldr r4, [%1] \n\t"
\
3144 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3145 VALGRIND_RESTORE_STACK \
3148 :
"0" (&_argvec[0]) \
3149 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3151 lval = (__typeof__(lval)) _res; \
3154 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
3156 volatile OrigFn _orig = (orig); \
3157 volatile unsigned long _argvec[3]; \
3158 volatile unsigned long _res; \
3159 _argvec[0] = (unsigned long)_orig.nraddr; \
3160 _argvec[1] = (unsigned long)(arg1); \
3161 _argvec[2] = (unsigned long)(arg2); \
3163 VALGRIND_ALIGN_STACK \
3164 "ldr r0, [%1, #4] \n\t" \
3165 "ldr r1, [%1, #8] \n\t" \
3166 "ldr r4, [%1] \n\t"
\
3167 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3168 VALGRIND_RESTORE_STACK \
3171 :
"0" (&_argvec[0]) \
3172 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3174 lval = (__typeof__(lval)) _res; \
3177 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
3179 volatile OrigFn _orig = (orig); \
3180 volatile unsigned long _argvec[4]; \
3181 volatile unsigned long _res; \
3182 _argvec[0] = (unsigned long)_orig.nraddr; \
3183 _argvec[1] = (unsigned long)(arg1); \
3184 _argvec[2] = (unsigned long)(arg2); \
3185 _argvec[3] = (unsigned long)(arg3); \
3187 VALGRIND_ALIGN_STACK \
3188 "ldr r0, [%1, #4] \n\t" \
3189 "ldr r1, [%1, #8] \n\t" \
3190 "ldr r2, [%1, #12] \n\t" \
3191 "ldr r4, [%1] \n\t"
\
3192 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3193 VALGRIND_RESTORE_STACK \
3196 :
"0" (&_argvec[0]) \
3197 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3199 lval = (__typeof__(lval)) _res; \
3202 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
3204 volatile OrigFn _orig = (orig); \
3205 volatile unsigned long _argvec[5]; \
3206 volatile unsigned long _res; \
3207 _argvec[0] = (unsigned long)_orig.nraddr; \
3208 _argvec[1] = (unsigned long)(arg1); \
3209 _argvec[2] = (unsigned long)(arg2); \
3210 _argvec[3] = (unsigned long)(arg3); \
3211 _argvec[4] = (unsigned long)(arg4); \
3213 VALGRIND_ALIGN_STACK \
3214 "ldr r0, [%1, #4] \n\t" \
3215 "ldr r1, [%1, #8] \n\t" \
3216 "ldr r2, [%1, #12] \n\t" \
3217 "ldr r3, [%1, #16] \n\t" \
3218 "ldr r4, [%1] \n\t"
\
3219 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3220 VALGRIND_RESTORE_STACK \
3223 :
"0" (&_argvec[0]) \
3224 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3226 lval = (__typeof__(lval)) _res; \
3229 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
3231 volatile OrigFn _orig = (orig); \
3232 volatile unsigned long _argvec[6]; \
3233 volatile unsigned long _res; \
3234 _argvec[0] = (unsigned long)_orig.nraddr; \
3235 _argvec[1] = (unsigned long)(arg1); \
3236 _argvec[2] = (unsigned long)(arg2); \
3237 _argvec[3] = (unsigned long)(arg3); \
3238 _argvec[4] = (unsigned long)(arg4); \
3239 _argvec[5] = (unsigned long)(arg5); \
3241 VALGRIND_ALIGN_STACK \
3242 "sub sp, sp, #4 \n\t" \
3243 "ldr r0, [%1, #20] \n\t" \
3245 "ldr r0, [%1, #4] \n\t" \
3246 "ldr r1, [%1, #8] \n\t" \
3247 "ldr r2, [%1, #12] \n\t" \
3248 "ldr r3, [%1, #16] \n\t" \
3249 "ldr r4, [%1] \n\t"
\
3250 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3251 VALGRIND_RESTORE_STACK \
3254 :
"0" (&_argvec[0]) \
3255 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3257 lval = (__typeof__(lval)) _res; \
3260 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
3262 volatile OrigFn _orig = (orig); \
3263 volatile unsigned long _argvec[7]; \
3264 volatile unsigned long _res; \
3265 _argvec[0] = (unsigned long)_orig.nraddr; \
3266 _argvec[1] = (unsigned long)(arg1); \
3267 _argvec[2] = (unsigned long)(arg2); \
3268 _argvec[3] = (unsigned long)(arg3); \
3269 _argvec[4] = (unsigned long)(arg4); \
3270 _argvec[5] = (unsigned long)(arg5); \
3271 _argvec[6] = (unsigned long)(arg6); \
3273 VALGRIND_ALIGN_STACK \
3274 "ldr r0, [%1, #20] \n\t" \
3275 "ldr r1, [%1, #24] \n\t" \
3276 "push {r0, r1} \n\t" \
3277 "ldr r0, [%1, #4] \n\t" \
3278 "ldr r1, [%1, #8] \n\t" \
3279 "ldr r2, [%1, #12] \n\t" \
3280 "ldr r3, [%1, #16] \n\t" \
3281 "ldr r4, [%1] \n\t"
\
3282 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3283 VALGRIND_RESTORE_STACK \
3286 :
"0" (&_argvec[0]) \
3287 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3289 lval = (__typeof__(lval)) _res; \
3292 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3295 volatile OrigFn _orig = (orig); \
3296 volatile unsigned long _argvec[8]; \
3297 volatile unsigned long _res; \
3298 _argvec[0] = (unsigned long)_orig.nraddr; \
3299 _argvec[1] = (unsigned long)(arg1); \
3300 _argvec[2] = (unsigned long)(arg2); \
3301 _argvec[3] = (unsigned long)(arg3); \
3302 _argvec[4] = (unsigned long)(arg4); \
3303 _argvec[5] = (unsigned long)(arg5); \
3304 _argvec[6] = (unsigned long)(arg6); \
3305 _argvec[7] = (unsigned long)(arg7); \
3307 VALGRIND_ALIGN_STACK \
3308 "sub sp, sp, #4 \n\t" \
3309 "ldr r0, [%1, #20] \n\t" \
3310 "ldr r1, [%1, #24] \n\t" \
3311 "ldr r2, [%1, #28] \n\t" \
3312 "push {r0, r1, r2} \n\t" \
3313 "ldr r0, [%1, #4] \n\t" \
3314 "ldr r1, [%1, #8] \n\t" \
3315 "ldr r2, [%1, #12] \n\t" \
3316 "ldr r3, [%1, #16] \n\t" \
3317 "ldr r4, [%1] \n\t"
\
3318 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3319 VALGRIND_RESTORE_STACK \
3322 :
"0" (&_argvec[0]) \
3323 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3325 lval = (__typeof__(lval)) _res; \
3328 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3331 volatile OrigFn _orig = (orig); \
3332 volatile unsigned long _argvec[9]; \
3333 volatile unsigned long _res; \
3334 _argvec[0] = (unsigned long)_orig.nraddr; \
3335 _argvec[1] = (unsigned long)(arg1); \
3336 _argvec[2] = (unsigned long)(arg2); \
3337 _argvec[3] = (unsigned long)(arg3); \
3338 _argvec[4] = (unsigned long)(arg4); \
3339 _argvec[5] = (unsigned long)(arg5); \
3340 _argvec[6] = (unsigned long)(arg6); \
3341 _argvec[7] = (unsigned long)(arg7); \
3342 _argvec[8] = (unsigned long)(arg8); \
3344 VALGRIND_ALIGN_STACK \
3345 "ldr r0, [%1, #20] \n\t" \
3346 "ldr r1, [%1, #24] \n\t" \
3347 "ldr r2, [%1, #28] \n\t" \
3348 "ldr r3, [%1, #32] \n\t" \
3349 "push {r0, r1, r2, r3} \n\t" \
3350 "ldr r0, [%1, #4] \n\t" \
3351 "ldr r1, [%1, #8] \n\t" \
3352 "ldr r2, [%1, #12] \n\t" \
3353 "ldr r3, [%1, #16] \n\t" \
3354 "ldr r4, [%1] \n\t"
\
3355 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3356 VALGRIND_RESTORE_STACK \
3359 :
"0" (&_argvec[0]) \
3360 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3362 lval = (__typeof__(lval)) _res; \
3365 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3368 volatile OrigFn _orig = (orig); \
3369 volatile unsigned long _argvec[10]; \
3370 volatile unsigned long _res; \
3371 _argvec[0] = (unsigned long)_orig.nraddr; \
3372 _argvec[1] = (unsigned long)(arg1); \
3373 _argvec[2] = (unsigned long)(arg2); \
3374 _argvec[3] = (unsigned long)(arg3); \
3375 _argvec[4] = (unsigned long)(arg4); \
3376 _argvec[5] = (unsigned long)(arg5); \
3377 _argvec[6] = (unsigned long)(arg6); \
3378 _argvec[7] = (unsigned long)(arg7); \
3379 _argvec[8] = (unsigned long)(arg8); \
3380 _argvec[9] = (unsigned long)(arg9); \
3382 VALGRIND_ALIGN_STACK \
3383 "sub sp, sp, #4 \n\t" \
3384 "ldr r0, [%1, #20] \n\t" \
3385 "ldr r1, [%1, #24] \n\t" \
3386 "ldr r2, [%1, #28] \n\t" \
3387 "ldr r3, [%1, #32] \n\t" \
3388 "ldr r4, [%1, #36] \n\t" \
3389 "push {r0, r1, r2, r3, r4} \n\t" \
3390 "ldr r0, [%1, #4] \n\t" \
3391 "ldr r1, [%1, #8] \n\t" \
3392 "ldr r2, [%1, #12] \n\t" \
3393 "ldr r3, [%1, #16] \n\t" \
3394 "ldr r4, [%1] \n\t"
\
3395 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3396 VALGRIND_RESTORE_STACK \
3399 :
"0" (&_argvec[0]) \
3400 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3402 lval = (__typeof__(lval)) _res; \
3405 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
3406 arg7,arg8,arg9,arg10) \
3408 volatile OrigFn _orig = (orig); \
3409 volatile unsigned long _argvec[11]; \
3410 volatile unsigned long _res; \
3411 _argvec[0] = (unsigned long)_orig.nraddr; \
3412 _argvec[1] = (unsigned long)(arg1); \
3413 _argvec[2] = (unsigned long)(arg2); \
3414 _argvec[3] = (unsigned long)(arg3); \
3415 _argvec[4] = (unsigned long)(arg4); \
3416 _argvec[5] = (unsigned long)(arg5); \
3417 _argvec[6] = (unsigned long)(arg6); \
3418 _argvec[7] = (unsigned long)(arg7); \
3419 _argvec[8] = (unsigned long)(arg8); \
3420 _argvec[9] = (unsigned long)(arg9); \
3421 _argvec[10] = (unsigned long)(arg10); \
3423 VALGRIND_ALIGN_STACK \
3424 "ldr r0, [%1, #40] \n\t" \
3426 "ldr r0, [%1, #20] \n\t" \
3427 "ldr r1, [%1, #24] \n\t" \
3428 "ldr r2, [%1, #28] \n\t" \
3429 "ldr r3, [%1, #32] \n\t" \
3430 "ldr r4, [%1, #36] \n\t" \
3431 "push {r0, r1, r2, r3, r4} \n\t" \
3432 "ldr r0, [%1, #4] \n\t" \
3433 "ldr r1, [%1, #8] \n\t" \
3434 "ldr r2, [%1, #12] \n\t" \
3435 "ldr r3, [%1, #16] \n\t" \
3436 "ldr r4, [%1] \n\t"
\
3437 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3438 VALGRIND_RESTORE_STACK \
3441 :
"0" (&_argvec[0]) \
3442 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3444 lval = (__typeof__(lval)) _res; \
3447 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
3448 arg6,arg7,arg8,arg9,arg10, \
3451 volatile OrigFn _orig = (orig); \
3452 volatile unsigned long _argvec[12]; \
3453 volatile unsigned long _res; \
3454 _argvec[0] = (unsigned long)_orig.nraddr; \
3455 _argvec[1] = (unsigned long)(arg1); \
3456 _argvec[2] = (unsigned long)(arg2); \
3457 _argvec[3] = (unsigned long)(arg3); \
3458 _argvec[4] = (unsigned long)(arg4); \
3459 _argvec[5] = (unsigned long)(arg5); \
3460 _argvec[6] = (unsigned long)(arg6); \
3461 _argvec[7] = (unsigned long)(arg7); \
3462 _argvec[8] = (unsigned long)(arg8); \
3463 _argvec[9] = (unsigned long)(arg9); \
3464 _argvec[10] = (unsigned long)(arg10); \
3465 _argvec[11] = (unsigned long)(arg11); \
3467 VALGRIND_ALIGN_STACK \
3468 "sub sp, sp, #4 \n\t" \
3469 "ldr r0, [%1, #40] \n\t" \
3470 "ldr r1, [%1, #44] \n\t" \
3471 "push {r0, r1} \n\t" \
3472 "ldr r0, [%1, #20] \n\t" \
3473 "ldr r1, [%1, #24] \n\t" \
3474 "ldr r2, [%1, #28] \n\t" \
3475 "ldr r3, [%1, #32] \n\t" \
3476 "ldr r4, [%1, #36] \n\t" \
3477 "push {r0, r1, r2, r3, r4} \n\t" \
3478 "ldr r0, [%1, #4] \n\t" \
3479 "ldr r1, [%1, #8] \n\t" \
3480 "ldr r2, [%1, #12] \n\t" \
3481 "ldr r3, [%1, #16] \n\t" \
3482 "ldr r4, [%1] \n\t"
\
3483 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3484 VALGRIND_RESTORE_STACK \
3487 :
"0" (&_argvec[0]) \
3488 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3490 lval = (__typeof__(lval)) _res; \
3493 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
3494 arg6,arg7,arg8,arg9,arg10, \
3497 volatile OrigFn _orig = (orig); \
3498 volatile unsigned long _argvec[13]; \
3499 volatile unsigned long _res; \
3500 _argvec[0] = (unsigned long)_orig.nraddr; \
3501 _argvec[1] = (unsigned long)(arg1); \
3502 _argvec[2] = (unsigned long)(arg2); \
3503 _argvec[3] = (unsigned long)(arg3); \
3504 _argvec[4] = (unsigned long)(arg4); \
3505 _argvec[5] = (unsigned long)(arg5); \
3506 _argvec[6] = (unsigned long)(arg6); \
3507 _argvec[7] = (unsigned long)(arg7); \
3508 _argvec[8] = (unsigned long)(arg8); \
3509 _argvec[9] = (unsigned long)(arg9); \
3510 _argvec[10] = (unsigned long)(arg10); \
3511 _argvec[11] = (unsigned long)(arg11); \
3512 _argvec[12] = (unsigned long)(arg12); \
3514 VALGRIND_ALIGN_STACK \
3515 "ldr r0, [%1, #40] \n\t" \
3516 "ldr r1, [%1, #44] \n\t" \
3517 "ldr r2, [%1, #48] \n\t" \
3518 "push {r0, r1, r2} \n\t" \
3519 "ldr r0, [%1, #20] \n\t" \
3520 "ldr r1, [%1, #24] \n\t" \
3521 "ldr r2, [%1, #28] \n\t" \
3522 "ldr r3, [%1, #32] \n\t" \
3523 "ldr r4, [%1, #36] \n\t" \
3524 "push {r0, r1, r2, r3, r4} \n\t" \
3525 "ldr r0, [%1, #4] \n\t" \
3526 "ldr r1, [%1, #8] \n\t" \
3527 "ldr r2, [%1, #12] \n\t" \
3528 "ldr r3, [%1, #16] \n\t" \
3529 "ldr r4, [%1] \n\t"
\
3530 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_R4 \
3531 VALGRIND_RESTORE_STACK \
3534 :
"0" (&_argvec[0]) \
3535 :
"cc", "memory", __CALLER_SAVED_REGS, "r10" \
3537 lval = (__typeof__(lval)) _res; \
3544 #if defined(PLAT_arm64_linux)
3547 #define __CALLER_SAVED_REGS \
3548 "x0", "x1", "x2", "x3","x4", "x5", "x6", "x7", "x8", "x9", \
3549 "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", \
3550 "x18", "x19", "x20", "x30", \
3551 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", \
3552 "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", \
3553 "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", \
3554 "v26", "v27", "v28", "v29", "v30", "v31"
3558 #define VALGRIND_ALIGN_STACK \
3560 "bic sp, x21, #15\n\t"
3561 #define VALGRIND_RESTORE_STACK \
3567 #define CALL_FN_W_v(lval, orig) \
3569 volatile OrigFn _orig = (orig); \
3570 volatile unsigned long _argvec[1]; \
3571 volatile unsigned long _res; \
3572 _argvec[0] = (unsigned long)_orig.nraddr; \
3574 VALGRIND_ALIGN_STACK \
3575 "ldr x8, [%1] \n\t" \
3576 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
3577 VALGRIND_RESTORE_STACK \
3580 :
"0" (&_argvec[0]) \
3581 :
"cc", "memory", __CALLER_SAVED_REGS, "x21" \
3583 lval = (__typeof__(lval)) _res; \
3586 #define CALL_FN_W_W(lval, orig, arg1) \
3588 volatile OrigFn _orig = (orig); \
3589 volatile unsigned long _argvec[2]; \
3590 volatile unsigned long _res; \
3591 _argvec[0] = (unsigned long)_orig.nraddr; \
3592 _argvec[1] = (unsigned long)(arg1); \
3594 VALGRIND_ALIGN_STACK \
3595 "ldr x0, [%1, #8] \n\t" \
3596 "ldr x8, [%1] \n\t"
\
3597 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
3598 VALGRIND_RESTORE_STACK \
3601 :
"0" (&_argvec[0]) \
3602 :
"cc", "memory", __CALLER_SAVED_REGS, "x21" \
3604 lval = (__typeof__(lval)) _res; \
3607 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
3609 volatile OrigFn _orig = (orig); \
3610 volatile unsigned long _argvec[3]; \
3611 volatile unsigned long _res; \
3612 _argvec[0] = (unsigned long)_orig.nraddr; \
3613 _argvec[1] = (unsigned long)(arg1); \
3614 _argvec[2] = (unsigned long)(arg2); \
3616 VALGRIND_ALIGN_STACK \
3617 "ldr x0, [%1, #8] \n\t" \
3618 "ldr x1, [%1, #16] \n\t" \
3619 "ldr x8, [%1] \n\t"
\
3620 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
3621 VALGRIND_RESTORE_STACK \
3624 :
"0" (&_argvec[0]) \
3625 :
"cc", "memory", __CALLER_SAVED_REGS
\
3627 lval = (__typeof__(lval)) _res; \
3630 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
3632 volatile OrigFn _orig = (orig); \
3633 volatile unsigned long _argvec[4]; \
3634 volatile unsigned long _res; \
3635 _argvec[0] = (unsigned long)_orig.nraddr; \
3636 _argvec[1] = (unsigned long)(arg1); \
3637 _argvec[2] = (unsigned long)(arg2); \
3638 _argvec[3] = (unsigned long)(arg3); \
3640 VALGRIND_ALIGN_STACK \
3641 "ldr x0, [%1, #8] \n\t" \
3642 "ldr x1, [%1, #16] \n\t" \
3643 "ldr x2, [%1, #24] \n\t" \
3644 "ldr x8, [%1] \n\t"
\
3645 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
3646 VALGRIND_RESTORE_STACK \
3649 :
"0" (&_argvec[0]) \
3650 :
"cc", "memory", __CALLER_SAVED_REGS
\
3652 lval = (__typeof__(lval)) _res; \
3655 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
3657 volatile OrigFn _orig = (orig); \
3658 volatile unsigned long _argvec[5]; \
3659 volatile unsigned long _res; \
3660 _argvec[0] = (unsigned long)_orig.nraddr; \
3661 _argvec[1] = (unsigned long)(arg1); \
3662 _argvec[2] = (unsigned long)(arg2); \
3663 _argvec[3] = (unsigned long)(arg3); \
3664 _argvec[4] = (unsigned long)(arg4); \
3666 VALGRIND_ALIGN_STACK \
3667 "ldr x0, [%1, #8] \n\t" \
3668 "ldr x1, [%1, #16] \n\t" \
3669 "ldr x2, [%1, #24] \n\t" \
3670 "ldr x3, [%1, #32] \n\t" \
3671 "ldr x8, [%1] \n\t"
\
3672 VALGRIND_BRANCH_AND_LINK_TO_NOREDIR_X8 \
3673 VALGRIND_RESTORE_STACK \
3676 :
"0" (&_argvec[0]) \
3677 :
"cc", "memory", __CALLER_SAVED_REGS
\
3679 lval = (__typeof__(lval)) _res; \
3686 #if defined(PLAT_s390x_linux)
3692 #if defined(__GNUC__) && defined(__GCC_HAVE_DWARF2_CFI_ASM)
3693 # define __FRAME_POINTER \
3694 ,"d"(__builtin_dwarf_cfa())
3695 # define VALGRIND_CFI_PROLOGUE \
3696 ".cfi_remember_state\n\t" \
3700 ".cfi_def_cfa r11, 0\n\t"
3701 # define VALGRIND_CFI_EPILOGUE \
3703 ".cfi_restore_state\n\t"
3705 # define __FRAME_POINTER
3706 # define VALGRIND_CFI_PROLOGUE \
3708 # define VALGRIND_CFI_EPILOGUE
3720 #define __CALLER_SAVED_REGS "0","1","2","3","4","5","14", \
3721 "f0","f1","f2","f3","f4","f5","f6","f7"
3732 #define CALL_FN_W_v(lval, orig) \
3734 volatile OrigFn _orig = (orig); \
3735 volatile unsigned long _argvec[1]; \
3736 volatile unsigned long _res; \
3737 _argvec[0] = (unsigned long)_orig.nraddr; \
3739 VALGRIND_CFI_PROLOGUE \
3740 "aghi 15,-160\n\t" \
3742 VALGRIND_CALL_NOREDIR_R1 \
3745 VALGRIND_CFI_EPILOGUE \
3747 :
"d" (&_argvec[0]) __FRAME_POINTER \
3748 :
"cc", "memory", __CALLER_SAVED_REGS,"7" \
3750 lval = (__typeof__(lval)) _res; \
3754 #define CALL_FN_W_W(lval, orig, arg1) \
3756 volatile OrigFn _orig = (orig); \
3757 volatile unsigned long _argvec[2]; \
3758 volatile unsigned long _res; \
3759 _argvec[0] = (unsigned long)_orig.nraddr; \
3760 _argvec[1] = (unsigned long)arg1; \
3762 VALGRIND_CFI_PROLOGUE \
3763 "aghi 15,-160\n\t" \
3766 VALGRIND_CALL_NOREDIR_R1 \
3769 VALGRIND_CFI_EPILOGUE \
3771 :
"a" (&_argvec[0]) __FRAME_POINTER \
3772 :
"cc", "memory", __CALLER_SAVED_REGS,"7" \
3774 lval = (__typeof__(lval)) _res; \
3777 #define CALL_FN_W_WW(lval, orig, arg1, arg2) \
3779 volatile OrigFn _orig = (orig); \
3780 volatile unsigned long _argvec[3]; \
3781 volatile unsigned long _res; \
3782 _argvec[0] = (unsigned long)_orig.nraddr; \
3783 _argvec[1] = (unsigned long)arg1; \
3784 _argvec[2] = (unsigned long)arg2; \
3786 VALGRIND_CFI_PROLOGUE \
3787 "aghi 15,-160\n\t" \
3791 VALGRIND_CALL_NOREDIR_R1 \
3794 VALGRIND_CFI_EPILOGUE \
3796 :
"a" (&_argvec[0]) __FRAME_POINTER \
3797 :
"cc", "memory", __CALLER_SAVED_REGS,"7" \
3799 lval = (__typeof__(lval)) _res; \
3802 #define CALL_FN_W_WWW(lval, orig, arg1, arg2, arg3) \
3804 volatile OrigFn _orig = (orig); \
3805 volatile unsigned long _argvec[4]; \
3806 volatile unsigned long _res; \
3807 _argvec[0] = (unsigned long)_orig.nraddr; \
3808 _argvec[1] = (unsigned long)arg1; \
3809 _argvec[2] = (unsigned long)arg2; \
3810 _argvec[3] = (unsigned long)arg3; \
3812 VALGRIND_CFI_PROLOGUE \
3813 "aghi 15,-160\n\t" \
3818 VALGRIND_CALL_NOREDIR_R1 \
3821 VALGRIND_CFI_EPILOGUE \
3823 :
"a" (&_argvec[0]) __FRAME_POINTER \
3824 :
"cc", "memory", __CALLER_SAVED_REGS,"7" \
3826 lval = (__typeof__(lval)) _res; \
3829 #define CALL_FN_W_WWWW(lval, orig, arg1, arg2, arg3, arg4) \
3831 volatile OrigFn _orig = (orig); \
3832 volatile unsigned long _argvec[5]; \
3833 volatile unsigned long _res; \
3834 _argvec[0] = (unsigned long)_orig.nraddr; \
3835 _argvec[1] = (unsigned long)arg1; \
3836 _argvec[2] = (unsigned long)arg2; \
3837 _argvec[3] = (unsigned long)arg3; \
3838 _argvec[4] = (unsigned long)arg4; \
3840 VALGRIND_CFI_PROLOGUE \
3841 "aghi 15,-160\n\t" \
3847 VALGRIND_CALL_NOREDIR_R1 \
3850 VALGRIND_CFI_EPILOGUE \
3852 :
"a" (&_argvec[0]) __FRAME_POINTER \
3853 :
"cc", "memory", __CALLER_SAVED_REGS,"7" \
3855 lval = (__typeof__(lval)) _res; \
3858 #define CALL_FN_W_5W(lval, orig, arg1, arg2, arg3, arg4, arg5) \
3860 volatile OrigFn _orig = (orig); \
3861 volatile unsigned long _argvec[6]; \
3862 volatile unsigned long _res; \
3863 _argvec[0] = (unsigned long)_orig.nraddr; \
3864 _argvec[1] = (unsigned long)arg1; \
3865 _argvec[2] = (unsigned long)arg2; \
3866 _argvec[3] = (unsigned long)arg3; \
3867 _argvec[4] = (unsigned long)arg4; \
3868 _argvec[5] = (unsigned long)arg5; \
3870 VALGRIND_CFI_PROLOGUE \
3871 "aghi 15,-160\n\t" \
3878 VALGRIND_CALL_NOREDIR_R1 \
3881 VALGRIND_CFI_EPILOGUE \
3883 :
"a" (&_argvec[0]) __FRAME_POINTER \
3884 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
3886 lval = (__typeof__(lval)) _res; \
3889 #define CALL_FN_W_6W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
3892 volatile OrigFn _orig = (orig); \
3893 volatile unsigned long _argvec[7]; \
3894 volatile unsigned long _res; \
3895 _argvec[0] = (unsigned long)_orig.nraddr; \
3896 _argvec[1] = (unsigned long)arg1; \
3897 _argvec[2] = (unsigned long)arg2; \
3898 _argvec[3] = (unsigned long)arg3; \
3899 _argvec[4] = (unsigned long)arg4; \
3900 _argvec[5] = (unsigned long)arg5; \
3901 _argvec[6] = (unsigned long)arg6; \
3903 VALGRIND_CFI_PROLOGUE \
3904 "aghi 15,-168\n\t" \
3910 "mvc 160(8,15), 48(1)\n\t" \
3912 VALGRIND_CALL_NOREDIR_R1 \
3915 VALGRIND_CFI_EPILOGUE \
3917 :
"a" (&_argvec[0]) __FRAME_POINTER \
3918 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
3920 lval = (__typeof__(lval)) _res; \
3923 #define CALL_FN_W_7W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
3926 volatile OrigFn _orig = (orig); \
3927 volatile unsigned long _argvec[8]; \
3928 volatile unsigned long _res; \
3929 _argvec[0] = (unsigned long)_orig.nraddr; \
3930 _argvec[1] = (unsigned long)arg1; \
3931 _argvec[2] = (unsigned long)arg2; \
3932 _argvec[3] = (unsigned long)arg3; \
3933 _argvec[4] = (unsigned long)arg4; \
3934 _argvec[5] = (unsigned long)arg5; \
3935 _argvec[6] = (unsigned long)arg6; \
3936 _argvec[7] = (unsigned long)arg7; \
3938 VALGRIND_CFI_PROLOGUE \
3939 "aghi 15,-176\n\t" \
3945 "mvc 160(8,15), 48(1)\n\t" \
3946 "mvc 168(8,15), 56(1)\n\t" \
3948 VALGRIND_CALL_NOREDIR_R1 \
3951 VALGRIND_CFI_EPILOGUE \
3953 :
"a" (&_argvec[0]) __FRAME_POINTER \
3954 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
3956 lval = (__typeof__(lval)) _res; \
3959 #define CALL_FN_W_8W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
3962 volatile OrigFn _orig = (orig); \
3963 volatile unsigned long _argvec[9]; \
3964 volatile unsigned long _res; \
3965 _argvec[0] = (unsigned long)_orig.nraddr; \
3966 _argvec[1] = (unsigned long)arg1; \
3967 _argvec[2] = (unsigned long)arg2; \
3968 _argvec[3] = (unsigned long)arg3; \
3969 _argvec[4] = (unsigned long)arg4; \
3970 _argvec[5] = (unsigned long)arg5; \
3971 _argvec[6] = (unsigned long)arg6; \
3972 _argvec[7] = (unsigned long)arg7; \
3973 _argvec[8] = (unsigned long)arg8; \
3975 VALGRIND_CFI_PROLOGUE \
3976 "aghi 15,-184\n\t" \
3982 "mvc 160(8,15), 48(1)\n\t" \
3983 "mvc 168(8,15), 56(1)\n\t" \
3984 "mvc 176(8,15), 64(1)\n\t" \
3986 VALGRIND_CALL_NOREDIR_R1 \
3989 VALGRIND_CFI_EPILOGUE \
3991 :
"a" (&_argvec[0]) __FRAME_POINTER \
3992 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
3994 lval = (__typeof__(lval)) _res; \
3997 #define CALL_FN_W_9W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
3998 arg6, arg7 ,arg8, arg9) \
4000 volatile OrigFn _orig = (orig); \
4001 volatile unsigned long _argvec[10]; \
4002 volatile unsigned long _res; \
4003 _argvec[0] = (unsigned long)_orig.nraddr; \
4004 _argvec[1] = (unsigned long)arg1; \
4005 _argvec[2] = (unsigned long)arg2; \
4006 _argvec[3] = (unsigned long)arg3; \
4007 _argvec[4] = (unsigned long)arg4; \
4008 _argvec[5] = (unsigned long)arg5; \
4009 _argvec[6] = (unsigned long)arg6; \
4010 _argvec[7] = (unsigned long)arg7; \
4011 _argvec[8] = (unsigned long)arg8; \
4012 _argvec[9] = (unsigned long)arg9; \
4014 VALGRIND_CFI_PROLOGUE \
4015 "aghi 15,-192\n\t" \
4021 "mvc 160(8,15), 48(1)\n\t" \
4022 "mvc 168(8,15), 56(1)\n\t" \
4023 "mvc 176(8,15), 64(1)\n\t" \
4024 "mvc 184(8,15), 72(1)\n\t" \
4026 VALGRIND_CALL_NOREDIR_R1 \
4029 VALGRIND_CFI_EPILOGUE \
4031 :
"a" (&_argvec[0]) __FRAME_POINTER \
4032 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4034 lval = (__typeof__(lval)) _res; \
4037 #define CALL_FN_W_10W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4038 arg6, arg7 ,arg8, arg9, arg10) \
4040 volatile OrigFn _orig = (orig); \
4041 volatile unsigned long _argvec[11]; \
4042 volatile unsigned long _res; \
4043 _argvec[0] = (unsigned long)_orig.nraddr; \
4044 _argvec[1] = (unsigned long)arg1; \
4045 _argvec[2] = (unsigned long)arg2; \
4046 _argvec[3] = (unsigned long)arg3; \
4047 _argvec[4] = (unsigned long)arg4; \
4048 _argvec[5] = (unsigned long)arg5; \
4049 _argvec[6] = (unsigned long)arg6; \
4050 _argvec[7] = (unsigned long)arg7; \
4051 _argvec[8] = (unsigned long)arg8; \
4052 _argvec[9] = (unsigned long)arg9; \
4053 _argvec[10] = (unsigned long)arg10; \
4055 VALGRIND_CFI_PROLOGUE \
4056 "aghi 15,-200\n\t" \
4062 "mvc 160(8,15), 48(1)\n\t" \
4063 "mvc 168(8,15), 56(1)\n\t" \
4064 "mvc 176(8,15), 64(1)\n\t" \
4065 "mvc 184(8,15), 72(1)\n\t" \
4066 "mvc 192(8,15), 80(1)\n\t" \
4068 VALGRIND_CALL_NOREDIR_R1 \
4071 VALGRIND_CFI_EPILOGUE \
4073 :
"a" (&_argvec[0]) __FRAME_POINTER \
4074 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4076 lval = (__typeof__(lval)) _res; \
4079 #define CALL_FN_W_11W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4080 arg6, arg7 ,arg8, arg9, arg10, arg11) \
4082 volatile OrigFn _orig = (orig); \
4083 volatile unsigned long _argvec[12]; \
4084 volatile unsigned long _res; \
4085 _argvec[0] = (unsigned long)_orig.nraddr; \
4086 _argvec[1] = (unsigned long)arg1; \
4087 _argvec[2] = (unsigned long)arg2; \
4088 _argvec[3] = (unsigned long)arg3; \
4089 _argvec[4] = (unsigned long)arg4; \
4090 _argvec[5] = (unsigned long)arg5; \
4091 _argvec[6] = (unsigned long)arg6; \
4092 _argvec[7] = (unsigned long)arg7; \
4093 _argvec[8] = (unsigned long)arg8; \
4094 _argvec[9] = (unsigned long)arg9; \
4095 _argvec[10] = (unsigned long)arg10; \
4096 _argvec[11] = (unsigned long)arg11; \
4098 VALGRIND_CFI_PROLOGUE \
4099 "aghi 15,-208\n\t" \
4105 "mvc 160(8,15), 48(1)\n\t" \
4106 "mvc 168(8,15), 56(1)\n\t" \
4107 "mvc 176(8,15), 64(1)\n\t" \
4108 "mvc 184(8,15), 72(1)\n\t" \
4109 "mvc 192(8,15), 80(1)\n\t" \
4110 "mvc 200(8,15), 88(1)\n\t" \
4112 VALGRIND_CALL_NOREDIR_R1 \
4115 VALGRIND_CFI_EPILOGUE \
4117 :
"a" (&_argvec[0]) __FRAME_POINTER \
4118 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4120 lval = (__typeof__(lval)) _res; \
4123 #define CALL_FN_W_12W(lval, orig, arg1, arg2, arg3, arg4, arg5, \
4124 arg6, arg7 ,arg8, arg9, arg10, arg11, arg12)\
4126 volatile OrigFn _orig = (orig); \
4127 volatile unsigned long _argvec[13]; \
4128 volatile unsigned long _res; \
4129 _argvec[0] = (unsigned long)_orig.nraddr; \
4130 _argvec[1] = (unsigned long)arg1; \
4131 _argvec[2] = (unsigned long)arg2; \
4132 _argvec[3] = (unsigned long)arg3; \
4133 _argvec[4] = (unsigned long)arg4; \
4134 _argvec[5] = (unsigned long)arg5; \
4135 _argvec[6] = (unsigned long)arg6; \
4136 _argvec[7] = (unsigned long)arg7; \
4137 _argvec[8] = (unsigned long)arg8; \
4138 _argvec[9] = (unsigned long)arg9; \
4139 _argvec[10] = (unsigned long)arg10; \
4140 _argvec[11] = (unsigned long)arg11; \
4141 _argvec[12] = (unsigned long)arg12; \
4143 VALGRIND_CFI_PROLOGUE \
4144 "aghi 15,-216\n\t" \
4150 "mvc 160(8,15), 48(1)\n\t" \
4151 "mvc 168(8,15), 56(1)\n\t" \
4152 "mvc 176(8,15), 64(1)\n\t" \
4153 "mvc 184(8,15), 72(1)\n\t" \
4154 "mvc 192(8,15), 80(1)\n\t" \
4155 "mvc 200(8,15), 88(1)\n\t" \
4156 "mvc 208(8,15), 96(1)\n\t" \
4158 VALGRIND_CALL_NOREDIR_R1 \
4161 VALGRIND_CFI_EPILOGUE \
4163 :
"a" (&_argvec[0]) __FRAME_POINTER \
4164 :
"cc", "memory", __CALLER_SAVED_REGS,"6","7" \
4166 lval = (__typeof__(lval)) _res; \
4174 #if defined(PLAT_mips32_linux)
4177 #define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6", \
4178 "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
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 "subu $29, $29, 8 \n\t" \
4192 "sw $28, 0($29) \n\t" \
4193 "sw $31, 4($29) \n\t" \
4194 "subu $29, $29, 16 \n\t" \
4195 "lw $25, 0(%1) \n\t"
\
4196 VALGRIND_CALL_NOREDIR_T9 \
4197 "addu $29, $29, 16\n\t" \
4198 "lw $28, 0($29) \n\t" \
4199 "lw $31, 4($29) \n\t" \
4200 "addu $29, $29, 8 \n\t" \
4203 :
"0" (&_argvec[0]) \
4204 :
"memory", __CALLER_SAVED_REGS \
4206 lval = (__typeof__(lval)) _res; \
4209 #define CALL_FN_W_W(lval, orig, arg1) \
4211 volatile OrigFn _orig = (orig); \
4212 volatile unsigned long _argvec[2]; \
4213 volatile unsigned long _res; \
4214 _argvec[0] = (unsigned long)_orig.nraddr; \
4215 _argvec[1] = (unsigned long)(arg1); \
4217 "subu $29, $29, 8 \n\t" \
4218 "sw $28, 0($29) \n\t" \
4219 "sw $31, 4($29) \n\t" \
4220 "subu $29, $29, 16 \n\t" \
4221 "lw $4, 4(%1) \n\t"
\
4222 "lw $25, 0(%1) \n\t" \
4223 VALGRIND_CALL_NOREDIR_T9 \
4224 "addu $29, $29, 16 \n\t" \
4225 "lw $28, 0($29) \n\t" \
4226 "lw $31, 4($29) \n\t" \
4227 "addu $29, $29, 8 \n\t" \
4230 :
"0" (&_argvec[0]) \
4231 :
"memory", __CALLER_SAVED_REGS \
4233 lval = (__typeof__(lval)) _res; \
4236 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
4238 volatile OrigFn _orig = (orig); \
4239 volatile unsigned long _argvec[3]; \
4240 volatile unsigned long _res; \
4241 _argvec[0] = (unsigned long)_orig.nraddr; \
4242 _argvec[1] = (unsigned long)(arg1); \
4243 _argvec[2] = (unsigned long)(arg2); \
4245 "subu $29, $29, 8 \n\t" \
4246 "sw $28, 0($29) \n\t" \
4247 "sw $31, 4($29) \n\t" \
4248 "subu $29, $29, 16 \n\t" \
4249 "lw $4, 4(%1) \n\t" \
4250 "lw $5, 8(%1) \n\t" \
4251 "lw $25, 0(%1) \n\t"
\
4252 VALGRIND_CALL_NOREDIR_T9 \
4253 "addu $29, $29, 16 \n\t" \
4254 "lw $28, 0($29) \n\t" \
4255 "lw $31, 4($29) \n\t" \
4256 "addu $29, $29, 8 \n\t" \
4259 :
"0" (&_argvec[0]) \
4260 :
"memory", __CALLER_SAVED_REGS \
4262 lval = (__typeof__(lval)) _res; \
4265 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
4267 volatile OrigFn _orig = (orig); \
4268 volatile unsigned long _argvec[4]; \
4269 volatile unsigned long _res; \
4270 _argvec[0] = (unsigned long)_orig.nraddr; \
4271 _argvec[1] = (unsigned long)(arg1); \
4272 _argvec[2] = (unsigned long)(arg2); \
4273 _argvec[3] = (unsigned long)(arg3); \
4275 "subu $29, $29, 8 \n\t" \
4276 "sw $28, 0($29) \n\t" \
4277 "sw $31, 4($29) \n\t" \
4278 "subu $29, $29, 16 \n\t" \
4279 "lw $4, 4(%1) \n\t" \
4280 "lw $5, 8(%1) \n\t" \
4281 "lw $6, 12(%1) \n\t" \
4282 "lw $25, 0(%1) \n\t"
\
4283 VALGRIND_CALL_NOREDIR_T9 \
4284 "addu $29, $29, 16 \n\t" \
4285 "lw $28, 0($29) \n\t" \
4286 "lw $31, 4($29) \n\t" \
4287 "addu $29, $29, 8 \n\t" \
4290 :
"0" (&_argvec[0]) \
4291 :
"memory", __CALLER_SAVED_REGS \
4293 lval = (__typeof__(lval)) _res; \
4296 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
4298 volatile OrigFn _orig = (orig); \
4299 volatile unsigned long _argvec[5]; \
4300 volatile unsigned long _res; \
4301 _argvec[0] = (unsigned long)_orig.nraddr; \
4302 _argvec[1] = (unsigned long)(arg1); \
4303 _argvec[2] = (unsigned long)(arg2); \
4304 _argvec[3] = (unsigned long)(arg3); \
4305 _argvec[4] = (unsigned long)(arg4); \
4307 "subu $29, $29, 8 \n\t" \
4308 "sw $28, 0($29) \n\t" \
4309 "sw $31, 4($29) \n\t" \
4310 "subu $29, $29, 16 \n\t" \
4311 "lw $4, 4(%1) \n\t" \
4312 "lw $5, 8(%1) \n\t" \
4313 "lw $6, 12(%1) \n\t" \
4314 "lw $7, 16(%1) \n\t" \
4315 "lw $25, 0(%1) \n\t"
\
4316 VALGRIND_CALL_NOREDIR_T9 \
4317 "addu $29, $29, 16 \n\t" \
4318 "lw $28, 0($29) \n\t" \
4319 "lw $31, 4($29) \n\t" \
4320 "addu $29, $29, 8 \n\t" \
4323 :
"0" (&_argvec[0]) \
4324 :
"memory", __CALLER_SAVED_REGS \
4326 lval = (__typeof__(lval)) _res; \
4329 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
4331 volatile OrigFn _orig = (orig); \
4332 volatile unsigned long _argvec[6]; \
4333 volatile unsigned long _res; \
4334 _argvec[0] = (unsigned long)_orig.nraddr; \
4335 _argvec[1] = (unsigned long)(arg1); \
4336 _argvec[2] = (unsigned long)(arg2); \
4337 _argvec[3] = (unsigned long)(arg3); \
4338 _argvec[4] = (unsigned long)(arg4); \
4339 _argvec[5] = (unsigned long)(arg5); \
4341 "subu $29, $29, 8 \n\t" \
4342 "sw $28, 0($29) \n\t" \
4343 "sw $31, 4($29) \n\t" \
4344 "lw $4, 20(%1) \n\t" \
4345 "subu $29, $29, 24\n\t" \
4346 "sw $4, 16($29) \n\t" \
4347 "lw $4, 4(%1) \n\t" \
4348 "lw $5, 8(%1) \n\t" \
4349 "lw $6, 12(%1) \n\t" \
4350 "lw $7, 16(%1) \n\t" \
4351 "lw $25, 0(%1) \n\t"
\
4352 VALGRIND_CALL_NOREDIR_T9 \
4353 "addu $29, $29, 24 \n\t" \
4354 "lw $28, 0($29) \n\t" \
4355 "lw $31, 4($29) \n\t" \
4356 "addu $29, $29, 8 \n\t" \
4359 :
"0" (&_argvec[0]) \
4360 :
"memory", __CALLER_SAVED_REGS \
4362 lval = (__typeof__(lval)) _res; \
4364 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
4366 volatile OrigFn _orig = (orig); \
4367 volatile unsigned long _argvec[7]; \
4368 volatile unsigned long _res; \
4369 _argvec[0] = (unsigned long)_orig.nraddr; \
4370 _argvec[1] = (unsigned long)(arg1); \
4371 _argvec[2] = (unsigned long)(arg2); \
4372 _argvec[3] = (unsigned long)(arg3); \
4373 _argvec[4] = (unsigned long)(arg4); \
4374 _argvec[5] = (unsigned long)(arg5); \
4375 _argvec[6] = (unsigned long)(arg6); \
4377 "subu $29, $29, 8 \n\t" \
4378 "sw $28, 0($29) \n\t" \
4379 "sw $31, 4($29) \n\t" \
4380 "lw $4, 20(%1) \n\t" \
4381 "subu $29, $29, 32\n\t" \
4382 "sw $4, 16($29) \n\t" \
4383 "lw $4, 24(%1) \n\t" \
4385 "sw $4, 20($29) \n\t" \
4386 "lw $4, 4(%1) \n\t" \
4387 "lw $5, 8(%1) \n\t" \
4388 "lw $6, 12(%1) \n\t" \
4389 "lw $7, 16(%1) \n\t" \
4390 "lw $25, 0(%1) \n\t"
\
4391 VALGRIND_CALL_NOREDIR_T9 \
4392 "addu $29, $29, 32 \n\t" \
4393 "lw $28, 0($29) \n\t" \
4394 "lw $31, 4($29) \n\t" \
4395 "addu $29, $29, 8 \n\t" \
4398 :
"0" (&_argvec[0]) \
4399 :
"memory", __CALLER_SAVED_REGS \
4401 lval = (__typeof__(lval)) _res; \
4404 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4407 volatile OrigFn _orig = (orig); \
4408 volatile unsigned long _argvec[8]; \
4409 volatile unsigned long _res; \
4410 _argvec[0] = (unsigned long)_orig.nraddr; \
4411 _argvec[1] = (unsigned long)(arg1); \
4412 _argvec[2] = (unsigned long)(arg2); \
4413 _argvec[3] = (unsigned long)(arg3); \
4414 _argvec[4] = (unsigned long)(arg4); \
4415 _argvec[5] = (unsigned long)(arg5); \
4416 _argvec[6] = (unsigned long)(arg6); \
4417 _argvec[7] = (unsigned long)(arg7); \
4419 "subu $29, $29, 8 \n\t" \
4420 "sw $28, 0($29) \n\t" \
4421 "sw $31, 4($29) \n\t" \
4422 "lw $4, 20(%1) \n\t" \
4423 "subu $29, $29, 32\n\t" \
4424 "sw $4, 16($29) \n\t" \
4425 "lw $4, 24(%1) \n\t" \
4426 "sw $4, 20($29) \n\t" \
4427 "lw $4, 28(%1) \n\t" \
4428 "sw $4, 24($29) \n\t" \
4429 "lw $4, 4(%1) \n\t" \
4430 "lw $5, 8(%1) \n\t" \
4431 "lw $6, 12(%1) \n\t" \
4432 "lw $7, 16(%1) \n\t" \
4433 "lw $25, 0(%1) \n\t"
\
4434 VALGRIND_CALL_NOREDIR_T9 \
4435 "addu $29, $29, 32 \n\t" \
4436 "lw $28, 0($29) \n\t" \
4437 "lw $31, 4($29) \n\t" \
4438 "addu $29, $29, 8 \n\t" \
4441 :
"0" (&_argvec[0]) \
4442 :
"memory", __CALLER_SAVED_REGS \
4444 lval = (__typeof__(lval)) _res; \
4447 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4450 volatile OrigFn _orig = (orig); \
4451 volatile unsigned long _argvec[9]; \
4452 volatile unsigned long _res; \
4453 _argvec[0] = (unsigned long)_orig.nraddr; \
4454 _argvec[1] = (unsigned long)(arg1); \
4455 _argvec[2] = (unsigned long)(arg2); \
4456 _argvec[3] = (unsigned long)(arg3); \
4457 _argvec[4] = (unsigned long)(arg4); \
4458 _argvec[5] = (unsigned long)(arg5); \
4459 _argvec[6] = (unsigned long)(arg6); \
4460 _argvec[7] = (unsigned long)(arg7); \
4461 _argvec[8] = (unsigned long)(arg8); \
4463 "subu $29, $29, 8 \n\t" \
4464 "sw $28, 0($29) \n\t" \
4465 "sw $31, 4($29) \n\t" \
4466 "lw $4, 20(%1) \n\t" \
4467 "subu $29, $29, 40\n\t" \
4468 "sw $4, 16($29) \n\t" \
4469 "lw $4, 24(%1) \n\t" \
4470 "sw $4, 20($29) \n\t" \
4471 "lw $4, 28(%1) \n\t" \
4472 "sw $4, 24($29) \n\t" \
4473 "lw $4, 32(%1) \n\t" \
4474 "sw $4, 28($29) \n\t" \
4475 "lw $4, 4(%1) \n\t" \
4476 "lw $5, 8(%1) \n\t" \
4477 "lw $6, 12(%1) \n\t" \
4478 "lw $7, 16(%1) \n\t" \
4479 "lw $25, 0(%1) \n\t"
\
4480 VALGRIND_CALL_NOREDIR_T9 \
4481 "addu $29, $29, 40 \n\t" \
4482 "lw $28, 0($29) \n\t" \
4483 "lw $31, 4($29) \n\t" \
4484 "addu $29, $29, 8 \n\t" \
4487 :
"0" (&_argvec[0]) \
4488 :
"memory", __CALLER_SAVED_REGS \
4490 lval = (__typeof__(lval)) _res; \
4493 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4496 volatile OrigFn _orig = (orig); \
4497 volatile unsigned long _argvec[10]; \
4498 volatile unsigned long _res; \
4499 _argvec[0] = (unsigned long)_orig.nraddr; \
4500 _argvec[1] = (unsigned long)(arg1); \
4501 _argvec[2] = (unsigned long)(arg2); \
4502 _argvec[3] = (unsigned long)(arg3); \
4503 _argvec[4] = (unsigned long)(arg4); \
4504 _argvec[5] = (unsigned long)(arg5); \
4505 _argvec[6] = (unsigned long)(arg6); \
4506 _argvec[7] = (unsigned long)(arg7); \
4507 _argvec[8] = (unsigned long)(arg8); \
4508 _argvec[9] = (unsigned long)(arg9); \
4510 "subu $29, $29, 8 \n\t" \
4511 "sw $28, 0($29) \n\t" \
4512 "sw $31, 4($29) \n\t" \
4513 "lw $4, 20(%1) \n\t" \
4514 "subu $29, $29, 40\n\t" \
4515 "sw $4, 16($29) \n\t" \
4516 "lw $4, 24(%1) \n\t" \
4517 "sw $4, 20($29) \n\t" \
4518 "lw $4, 28(%1) \n\t" \
4519 "sw $4, 24($29) \n\t" \
4520 "lw $4, 32(%1) \n\t" \
4521 "sw $4, 28($29) \n\t" \
4522 "lw $4, 36(%1) \n\t" \
4523 "sw $4, 32($29) \n\t" \
4524 "lw $4, 4(%1) \n\t" \
4525 "lw $5, 8(%1) \n\t" \
4526 "lw $6, 12(%1) \n\t" \
4527 "lw $7, 16(%1) \n\t" \
4528 "lw $25, 0(%1) \n\t"
\
4529 VALGRIND_CALL_NOREDIR_T9 \
4530 "addu $29, $29, 40 \n\t" \
4531 "lw $28, 0($29) \n\t" \
4532 "lw $31, 4($29) \n\t" \
4533 "addu $29, $29, 8 \n\t" \
4536 :
"0" (&_argvec[0]) \
4537 :
"memory", __CALLER_SAVED_REGS \
4539 lval = (__typeof__(lval)) _res; \
4542 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4543 arg7,arg8,arg9,arg10) \
4545 volatile OrigFn _orig = (orig); \
4546 volatile unsigned long _argvec[11]; \
4547 volatile unsigned long _res; \
4548 _argvec[0] = (unsigned long)_orig.nraddr; \
4549 _argvec[1] = (unsigned long)(arg1); \
4550 _argvec[2] = (unsigned long)(arg2); \
4551 _argvec[3] = (unsigned long)(arg3); \
4552 _argvec[4] = (unsigned long)(arg4); \
4553 _argvec[5] = (unsigned long)(arg5); \
4554 _argvec[6] = (unsigned long)(arg6); \
4555 _argvec[7] = (unsigned long)(arg7); \
4556 _argvec[8] = (unsigned long)(arg8); \
4557 _argvec[9] = (unsigned long)(arg9); \
4558 _argvec[10] = (unsigned long)(arg10); \
4560 "subu $29, $29, 8 \n\t" \
4561 "sw $28, 0($29) \n\t" \
4562 "sw $31, 4($29) \n\t" \
4563 "lw $4, 20(%1) \n\t" \
4564 "subu $29, $29, 48\n\t" \
4565 "sw $4, 16($29) \n\t" \
4566 "lw $4, 24(%1) \n\t" \
4567 "sw $4, 20($29) \n\t" \
4568 "lw $4, 28(%1) \n\t" \
4569 "sw $4, 24($29) \n\t" \
4570 "lw $4, 32(%1) \n\t" \
4571 "sw $4, 28($29) \n\t" \
4572 "lw $4, 36(%1) \n\t" \
4573 "sw $4, 32($29) \n\t" \
4574 "lw $4, 40(%1) \n\t" \
4575 "sw $4, 36($29) \n\t" \
4576 "lw $4, 4(%1) \n\t" \
4577 "lw $5, 8(%1) \n\t" \
4578 "lw $6, 12(%1) \n\t" \
4579 "lw $7, 16(%1) \n\t" \
4580 "lw $25, 0(%1) \n\t"
\
4581 VALGRIND_CALL_NOREDIR_T9 \
4582 "addu $29, $29, 48 \n\t" \
4583 "lw $28, 0($29) \n\t" \
4584 "lw $31, 4($29) \n\t" \
4585 "addu $29, $29, 8 \n\t" \
4588 :
"0" (&_argvec[0]) \
4589 :
"memory", __CALLER_SAVED_REGS \
4591 lval = (__typeof__(lval)) _res; \
4594 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
4595 arg6,arg7,arg8,arg9,arg10, \
4598 volatile OrigFn _orig = (orig); \
4599 volatile unsigned long _argvec[12]; \
4600 volatile unsigned long _res; \
4601 _argvec[0] = (unsigned long)_orig.nraddr; \
4602 _argvec[1] = (unsigned long)(arg1); \
4603 _argvec[2] = (unsigned long)(arg2); \
4604 _argvec[3] = (unsigned long)(arg3); \
4605 _argvec[4] = (unsigned long)(arg4); \
4606 _argvec[5] = (unsigned long)(arg5); \
4607 _argvec[6] = (unsigned long)(arg6); \
4608 _argvec[7] = (unsigned long)(arg7); \
4609 _argvec[8] = (unsigned long)(arg8); \
4610 _argvec[9] = (unsigned long)(arg9); \
4611 _argvec[10] = (unsigned long)(arg10); \
4612 _argvec[11] = (unsigned long)(arg11); \
4614 "subu $29, $29, 8 \n\t" \
4615 "sw $28, 0($29) \n\t" \
4616 "sw $31, 4($29) \n\t" \
4617 "lw $4, 20(%1) \n\t" \
4618 "subu $29, $29, 48\n\t" \
4619 "sw $4, 16($29) \n\t" \
4620 "lw $4, 24(%1) \n\t" \
4621 "sw $4, 20($29) \n\t" \
4622 "lw $4, 28(%1) \n\t" \
4623 "sw $4, 24($29) \n\t" \
4624 "lw $4, 32(%1) \n\t" \
4625 "sw $4, 28($29) \n\t" \
4626 "lw $4, 36(%1) \n\t" \
4627 "sw $4, 32($29) \n\t" \
4628 "lw $4, 40(%1) \n\t" \
4629 "sw $4, 36($29) \n\t" \
4630 "lw $4, 44(%1) \n\t" \
4631 "sw $4, 40($29) \n\t" \
4632 "lw $4, 4(%1) \n\t" \
4633 "lw $5, 8(%1) \n\t" \
4634 "lw $6, 12(%1) \n\t" \
4635 "lw $7, 16(%1) \n\t" \
4636 "lw $25, 0(%1) \n\t"
\
4637 VALGRIND_CALL_NOREDIR_T9 \
4638 "addu $29, $29, 48 \n\t" \
4639 "lw $28, 0($29) \n\t" \
4640 "lw $31, 4($29) \n\t" \
4641 "addu $29, $29, 8 \n\t" \
4644 :
"0" (&_argvec[0]) \
4645 :
"memory", __CALLER_SAVED_REGS \
4647 lval = (__typeof__(lval)) _res; \
4650 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
4651 arg6,arg7,arg8,arg9,arg10, \
4654 volatile OrigFn _orig = (orig); \
4655 volatile unsigned long _argvec[13]; \
4656 volatile unsigned long _res; \
4657 _argvec[0] = (unsigned long)_orig.nraddr; \
4658 _argvec[1] = (unsigned long)(arg1); \
4659 _argvec[2] = (unsigned long)(arg2); \
4660 _argvec[3] = (unsigned long)(arg3); \
4661 _argvec[4] = (unsigned long)(arg4); \
4662 _argvec[5] = (unsigned long)(arg5); \
4663 _argvec[6] = (unsigned long)(arg6); \
4664 _argvec[7] = (unsigned long)(arg7); \
4665 _argvec[8] = (unsigned long)(arg8); \
4666 _argvec[9] = (unsigned long)(arg9); \
4667 _argvec[10] = (unsigned long)(arg10); \
4668 _argvec[11] = (unsigned long)(arg11); \
4669 _argvec[12] = (unsigned long)(arg12); \
4671 "subu $29, $29, 8 \n\t" \
4672 "sw $28, 0($29) \n\t" \
4673 "sw $31, 4($29) \n\t" \
4674 "lw $4, 20(%1) \n\t" \
4675 "subu $29, $29, 56\n\t" \
4676 "sw $4, 16($29) \n\t" \
4677 "lw $4, 24(%1) \n\t" \
4678 "sw $4, 20($29) \n\t" \
4679 "lw $4, 28(%1) \n\t" \
4680 "sw $4, 24($29) \n\t" \
4681 "lw $4, 32(%1) \n\t" \
4682 "sw $4, 28($29) \n\t" \
4683 "lw $4, 36(%1) \n\t" \
4684 "sw $4, 32($29) \n\t" \
4685 "lw $4, 40(%1) \n\t" \
4686 "sw $4, 36($29) \n\t" \
4687 "lw $4, 44(%1) \n\t" \
4688 "sw $4, 40($29) \n\t" \
4689 "lw $4, 48(%1) \n\t" \
4690 "sw $4, 44($29) \n\t" \
4691 "lw $4, 4(%1) \n\t" \
4692 "lw $5, 8(%1) \n\t" \
4693 "lw $6, 12(%1) \n\t" \
4694 "lw $7, 16(%1) \n\t" \
4695 "lw $25, 0(%1) \n\t"
\
4696 VALGRIND_CALL_NOREDIR_T9 \
4697 "addu $29, $29, 56 \n\t" \
4698 "lw $28, 0($29) \n\t" \
4699 "lw $31, 4($29) \n\t" \
4700 "addu $29, $29, 8 \n\t" \
4703 :
"r" (&_argvec[0]) \
4704 :
"memory", __CALLER_SAVED_REGS \
4706 lval = (__typeof__(lval)) _res; \
4713 #if defined(PLAT_mips64_linux)
4716 #define __CALLER_SAVED_REGS "$2", "$3", "$4", "$5", "$6", \
4717 "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", \
4723 #define CALL_FN_W_v(lval, orig) \
4725 volatile OrigFn _orig = (orig); \
4726 volatile unsigned long _argvec[1]; \
4727 volatile unsigned long _res; \
4728 _argvec[0] = (unsigned long)_orig.nraddr; \
4730 "ld $25, 0(%1)\n\t" \
4731 VALGRIND_CALL_NOREDIR_T9 \
4734 :
"0" (&_argvec[0]) \
4735 :
"memory", __CALLER_SAVED_REGS \
4737 lval = (__typeof__(lval)) _res; \
4740 #define CALL_FN_W_W(lval, orig, arg1) \
4742 volatile OrigFn _orig = (orig); \
4743 volatile unsigned long _argvec[2]; \
4744 volatile unsigned long _res; \
4745 _argvec[0] = (unsigned long)_orig.nraddr; \
4746 _argvec[1] = (unsigned long)(arg1); \
4748 "ld $4, 8(%1)\n\t" \
4749 "ld $25, 0(%1)\n\t" \
4750 VALGRIND_CALL_NOREDIR_T9 \
4753 :
"r" (&_argvec[0]) \
4754 :
"memory", __CALLER_SAVED_REGS \
4756 lval = (__typeof__(lval)) _res; \
4759 #define CALL_FN_W_WW(lval, orig, arg1,arg2) \
4761 volatile OrigFn _orig = (orig); \
4762 volatile unsigned long _argvec[3]; \
4763 volatile unsigned long _res; \
4764 _argvec[0] = (unsigned long)_orig.nraddr; \
4765 _argvec[1] = (unsigned long)(arg1); \
4766 _argvec[2] = (unsigned long)(arg2); \
4768 "ld $4, 8(%1)\n\t" \
4769 "ld $5, 16(%1)\n\t" \
4770 "ld $25, 0(%1)\n\t"
\
4771 VALGRIND_CALL_NOREDIR_T9 \
4774 :
"r" (&_argvec[0]) \
4775 :
"memory", __CALLER_SAVED_REGS \
4777 lval = (__typeof__(lval)) _res; \
4780 #define CALL_FN_W_WWW(lval, orig, arg1,arg2,arg3) \
4782 volatile OrigFn _orig = (orig); \
4783 volatile unsigned long _argvec[4]; \
4784 volatile unsigned long _res; \
4785 _argvec[0] = (unsigned long)_orig.nraddr; \
4786 _argvec[1] = (unsigned long)(arg1); \
4787 _argvec[2] = (unsigned long)(arg2); \
4788 _argvec[3] = (unsigned long)(arg3); \
4790 "ld $4, 8(%1)\n\t" \
4791 "ld $5, 16(%1)\n\t" \
4792 "ld $6, 24(%1)\n\t" \
4793 "ld $25, 0(%1)\n\t"
\
4794 VALGRIND_CALL_NOREDIR_T9 \
4797 :
"r" (&_argvec[0]) \
4798 :
"memory", __CALLER_SAVED_REGS \
4800 lval = (__typeof__(lval)) _res; \
4803 #define CALL_FN_W_WWWW(lval, orig, arg1,arg2,arg3,arg4) \
4805 volatile OrigFn _orig = (orig); \
4806 volatile unsigned long _argvec[5]; \
4807 volatile unsigned long _res; \
4808 _argvec[0] = (unsigned long)_orig.nraddr; \
4809 _argvec[1] = (unsigned long)(arg1); \
4810 _argvec[2] = (unsigned long)(arg2); \
4811 _argvec[3] = (unsigned long)(arg3); \
4812 _argvec[4] = (unsigned long)(arg4); \
4814 "ld $4, 8(%1)\n\t" \
4815 "ld $5, 16(%1)\n\t" \
4816 "ld $6, 24(%1)\n\t" \
4817 "ld $7, 32(%1)\n\t" \
4818 "ld $25, 0(%1)\n\t"
\
4819 VALGRIND_CALL_NOREDIR_T9 \
4822 :
"r" (&_argvec[0]) \
4823 :
"memory", __CALLER_SAVED_REGS \
4825 lval = (__typeof__(lval)) _res; \
4828 #define CALL_FN_W_5W(lval, orig, arg1,arg2,arg3,arg4,arg5) \
4830 volatile OrigFn _orig = (orig); \
4831 volatile unsigned long _argvec[6]; \
4832 volatile unsigned long _res; \
4833 _argvec[0] = (unsigned long)_orig.nraddr; \
4834 _argvec[1] = (unsigned long)(arg1); \
4835 _argvec[2] = (unsigned long)(arg2); \
4836 _argvec[3] = (unsigned long)(arg3); \
4837 _argvec[4] = (unsigned long)(arg4); \
4838 _argvec[5] = (unsigned long)(arg5); \
4840 "ld $4, 8(%1)\n\t" \
4841 "ld $5, 16(%1)\n\t" \
4842 "ld $6, 24(%1)\n\t" \
4843 "ld $7, 32(%1)\n\t" \
4844 "ld $8, 40(%1)\n\t" \
4845 "ld $25, 0(%1)\n\t"
\
4846 VALGRIND_CALL_NOREDIR_T9 \
4849 :
"r" (&_argvec[0]) \
4850 :
"memory", __CALLER_SAVED_REGS \
4852 lval = (__typeof__(lval)) _res; \
4855 #define CALL_FN_W_6W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6) \
4857 volatile OrigFn _orig = (orig); \
4858 volatile unsigned long _argvec[7]; \
4859 volatile unsigned long _res; \
4860 _argvec[0] = (unsigned long)_orig.nraddr; \
4861 _argvec[1] = (unsigned long)(arg1); \
4862 _argvec[2] = (unsigned long)(arg2); \
4863 _argvec[3] = (unsigned long)(arg3); \
4864 _argvec[4] = (unsigned long)(arg4); \
4865 _argvec[5] = (unsigned long)(arg5); \
4866 _argvec[6] = (unsigned long)(arg6); \
4868 "ld $4, 8(%1)\n\t" \
4869 "ld $5, 16(%1)\n\t" \
4870 "ld $6, 24(%1)\n\t" \
4871 "ld $7, 32(%1)\n\t" \
4872 "ld $8, 40(%1)\n\t" \
4873 "ld $9, 48(%1)\n\t" \
4874 "ld $25, 0(%1)\n\t"
\
4875 VALGRIND_CALL_NOREDIR_T9 \
4878 :
"r" (&_argvec[0]) \
4879 :
"memory", __CALLER_SAVED_REGS \
4881 lval = (__typeof__(lval)) _res; \
4884 #define CALL_FN_W_7W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4887 volatile OrigFn _orig = (orig); \
4888 volatile unsigned long _argvec[8]; \
4889 volatile unsigned long _res; \
4890 _argvec[0] = (unsigned long)_orig.nraddr; \
4891 _argvec[1] = (unsigned long)(arg1); \
4892 _argvec[2] = (unsigned long)(arg2); \
4893 _argvec[3] = (unsigned long)(arg3); \
4894 _argvec[4] = (unsigned long)(arg4); \
4895 _argvec[5] = (unsigned long)(arg5); \
4896 _argvec[6] = (unsigned long)(arg6); \
4897 _argvec[7] = (unsigned long)(arg7); \
4899 "ld $4, 8(%1)\n\t" \
4900 "ld $5, 16(%1)\n\t" \
4901 "ld $6, 24(%1)\n\t" \
4902 "ld $7, 32(%1)\n\t" \
4903 "ld $8, 40(%1)\n\t" \
4904 "ld $9, 48(%1)\n\t" \
4905 "ld $10, 56(%1)\n\t" \
4906 "ld $25, 0(%1) \n\t"
\
4907 VALGRIND_CALL_NOREDIR_T9 \
4910 :
"r" (&_argvec[0]) \
4911 :
"memory", __CALLER_SAVED_REGS \
4913 lval = (__typeof__(lval)) _res; \
4916 #define CALL_FN_W_8W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4919 volatile OrigFn _orig = (orig); \
4920 volatile unsigned long _argvec[9]; \
4921 volatile unsigned long _res; \
4922 _argvec[0] = (unsigned long)_orig.nraddr; \
4923 _argvec[1] = (unsigned long)(arg1); \
4924 _argvec[2] = (unsigned long)(arg2); \
4925 _argvec[3] = (unsigned long)(arg3); \
4926 _argvec[4] = (unsigned long)(arg4); \
4927 _argvec[5] = (unsigned long)(arg5); \
4928 _argvec[6] = (unsigned long)(arg6); \
4929 _argvec[7] = (unsigned long)(arg7); \
4930 _argvec[8] = (unsigned long)(arg8); \
4932 "ld $4, 8(%1)\n\t" \
4933 "ld $5, 16(%1)\n\t" \
4934 "ld $6, 24(%1)\n\t" \
4935 "ld $7, 32(%1)\n\t" \
4936 "ld $8, 40(%1)\n\t" \
4937 "ld $9, 48(%1)\n\t" \
4938 "ld $10, 56(%1)\n\t" \
4939 "ld $11, 64(%1)\n\t" \
4940 "ld $25, 0(%1) \n\t"
\
4941 VALGRIND_CALL_NOREDIR_T9 \
4944 :
"r" (&_argvec[0]) \
4945 :
"memory", __CALLER_SAVED_REGS \
4947 lval = (__typeof__(lval)) _res; \
4950 #define CALL_FN_W_9W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4953 volatile OrigFn _orig = (orig); \
4954 volatile unsigned long _argvec[10]; \
4955 volatile unsigned long _res; \
4956 _argvec[0] = (unsigned long)_orig.nraddr; \
4957 _argvec[1] = (unsigned long)(arg1); \
4958 _argvec[2] = (unsigned long)(arg2); \
4959 _argvec[3] = (unsigned long)(arg3); \
4960 _argvec[4] = (unsigned long)(arg4); \
4961 _argvec[5] = (unsigned long)(arg5); \
4962 _argvec[6] = (unsigned long)(arg6); \
4963 _argvec[7] = (unsigned long)(arg7); \
4964 _argvec[8] = (unsigned long)(arg8); \
4965 _argvec[9] = (unsigned long)(arg9); \
4967 "dsubu $29, $29, 8\n\t" \
4968 "ld $4, 72(%1)\n\t" \
4969 "sd $4, 0($29)\n\t" \
4970 "ld $4, 8(%1)\n\t" \
4971 "ld $5, 16(%1)\n\t" \
4972 "ld $6, 24(%1)\n\t" \
4973 "ld $7, 32(%1)\n\t" \
4974 "ld $8, 40(%1)\n\t" \
4975 "ld $9, 48(%1)\n\t" \
4976 "ld $10, 56(%1)\n\t" \
4977 "ld $11, 64(%1)\n\t" \
4978 "ld $25, 0(%1)\n\t"
\
4979 VALGRIND_CALL_NOREDIR_T9 \
4980 "daddu $29, $29, 8\n\t" \
4983 :
"r" (&_argvec[0]) \
4984 :
"memory", __CALLER_SAVED_REGS \
4986 lval = (__typeof__(lval)) _res; \
4989 #define CALL_FN_W_10W(lval, orig, arg1,arg2,arg3,arg4,arg5,arg6, \
4990 arg7,arg8,arg9,arg10) \
4992 volatile OrigFn _orig = (orig); \
4993 volatile unsigned long _argvec[11]; \
4994 volatile unsigned long _res; \
4995 _argvec[0] = (unsigned long)_orig.nraddr; \
4996 _argvec[1] = (unsigned long)(arg1); \
4997 _argvec[2] = (unsigned long)(arg2); \
4998 _argvec[3] = (unsigned long)(arg3); \
4999 _argvec[4] = (unsigned long)(arg4); \
5000 _argvec[5] = (unsigned long)(arg5); \
5001 _argvec[6] = (unsigned long)(arg6); \
5002 _argvec[7] = (unsigned long)(arg7); \
5003 _argvec[8] = (unsigned long)(arg8); \
5004 _argvec[9] = (unsigned long)(arg9); \
5005 _argvec[10] = (unsigned long)(arg10); \
5007 "dsubu $29, $29, 16\n\t" \
5008 "ld $4, 72(%1)\n\t" \
5009 "sd $4, 0($29)\n\t" \
5010 "ld $4, 80(%1)\n\t" \
5011 "sd $4, 8($29)\n\t" \
5012 "ld $4, 8(%1)\n\t" \
5013 "ld $5, 16(%1)\n\t" \
5014 "ld $6, 24(%1)\n\t" \
5015 "ld $7, 32(%1)\n\t" \
5016 "ld $8, 40(%1)\n\t" \
5017 "ld $9, 48(%1)\n\t" \
5018 "ld $10, 56(%1)\n\t" \
5019 "ld $11, 64(%1)\n\t" \
5020 "ld $25, 0(%1)\n\t"
\
5021 VALGRIND_CALL_NOREDIR_T9 \
5022 "daddu $29, $29, 16\n\t" \
5025 :
"r" (&_argvec[0]) \
5026 :
"memory", __CALLER_SAVED_REGS \
5028 lval = (__typeof__(lval)) _res; \
5031 #define CALL_FN_W_11W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
5032 arg6,arg7,arg8,arg9,arg10, \
5035 volatile OrigFn _orig = (orig); \
5036 volatile unsigned long _argvec[12]; \
5037 volatile unsigned long _res; \
5038 _argvec[0] = (unsigned long)_orig.nraddr; \
5039 _argvec[1] = (unsigned long)(arg1); \
5040 _argvec[2] = (unsigned long)(arg2); \
5041 _argvec[3] = (unsigned long)(arg3); \
5042 _argvec[4] = (unsigned long)(arg4); \
5043 _argvec[5] = (unsigned long)(arg5); \
5044 _argvec[6] = (unsigned long)(arg6); \
5045 _argvec[7] = (unsigned long)(arg7); \
5046 _argvec[8] = (unsigned long)(arg8); \
5047 _argvec[9] = (unsigned long)(arg9); \
5048 _argvec[10] = (unsigned long)(arg10); \
5049 _argvec[11] = (unsigned long)(arg11); \
5051 "dsubu $29, $29, 24\n\t" \
5052 "ld $4, 72(%1)\n\t" \
5053 "sd $4, 0($29)\n\t" \
5054 "ld $4, 80(%1)\n\t" \
5055 "sd $4, 8($29)\n\t" \
5056 "ld $4, 88(%1)\n\t" \
5057 "sd $4, 16($29)\n\t" \
5058 "ld $4, 8(%1)\n\t" \
5059 "ld $5, 16(%1)\n\t" \
5060 "ld $6, 24(%1)\n\t" \
5061 "ld $7, 32(%1)\n\t" \
5062 "ld $8, 40(%1)\n\t" \
5063 "ld $9, 48(%1)\n\t" \
5064 "ld $10, 56(%1)\n\t" \
5065 "ld $11, 64(%1)\n\t" \
5066 "ld $25, 0(%1)\n\t"
\
5067 VALGRIND_CALL_NOREDIR_T9 \
5068 "daddu $29, $29, 24\n\t" \
5071 :
"r" (&_argvec[0]) \
5072 :
"memory", __CALLER_SAVED_REGS \
5074 lval = (__typeof__(lval)) _res; \
5077 #define CALL_FN_W_12W(lval, orig, arg1,arg2,arg3,arg4,arg5, \
5078 arg6,arg7,arg8,arg9,arg10, \
5081 volatile OrigFn _orig = (orig); \
5082 volatile unsigned long _argvec[13]; \
5083 volatile unsigned long _res; \
5084 _argvec[0] = (unsigned long)_orig.nraddr; \
5085 _argvec[1] = (unsigned long)(arg1); \
5086 _argvec[2] = (unsigned long)(arg2); \
5087 _argvec[3] = (unsigned long)(arg3); \
5088 _argvec[4] = (unsigned long)(arg4); \
5089 _argvec[5] = (unsigned long)(arg5); \
5090 _argvec[6] = (unsigned long)(arg6); \
5091 _argvec[7] = (unsigned long)(arg7); \
5092 _argvec[8] = (unsigned long)(arg8); \
5093 _argvec[9] = (unsigned long)(arg9); \
5094 _argvec[10] = (unsigned long)(arg10); \
5095 _argvec[11] = (unsigned long)(arg11); \
5096 _argvec[12] = (unsigned long)(arg12); \
5098 "dsubu $29, $29, 32\n\t" \
5099 "ld $4, 72(%1)\n\t" \
5100 "sd $4, 0($29)\n\t" \
5101 "ld $4, 80(%1)\n\t" \
5102 "sd $4, 8($29)\n\t" \
5103 "ld $4, 88(%1)\n\t" \
5104 "sd $4, 16($29)\n\t" \
5105 "ld $4, 96(%1)\n\t" \
5106 "sd $4, 24($29)\n\t" \
5107 "ld $4, 8(%1)\n\t" \
5108 "ld $5, 16(%1)\n\t" \
5109 "ld $6, 24(%1)\n\t" \
5110 "ld $7, 32(%1)\n\t" \
5111 "ld $8, 40(%1)\n\t" \
5112 "ld $9, 48(%1)\n\t" \
5113 "ld $10, 56(%1)\n\t" \
5114 "ld $11, 64(%1)\n\t" \
5115 "ld $25, 0(%1)\n\t"
\
5116 VALGRIND_CALL_NOREDIR_T9 \
5117 "daddu $29, $29, 32\n\t" \
5120 :
"r" (&_argvec[0]) \
5121 :
"memory", __CALLER_SAVED_REGS \
5123 lval = (__typeof__(lval)) _res; \
5144 #define VG_USERREQ_TOOL_BASE(a,b) \
5145 ((unsigned int)(((a)&0xff) << 24 | ((b)&0xff) << 16))
5146 #define VG_IS_TOOL_USERREQ(a, b, v) \
5147 (VG_USERREQ_TOOL_BASE(a,b) == ((v) & 0xffff0000))
5226 #if !defined(__GNUC__)
5227 # define __extension__
5235 #define RUNNING_ON_VALGRIND \
5236 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
5237 VG_USERREQ__RUNNING_ON_VALGRIND, \
5245 #define VALGRIND_DISCARD_TRANSLATIONS(_qzz_addr,_qzz_len) \
5246 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DISCARD_TRANSLATIONS, \
5247 _qzz_addr, _qzz_len, 0, 0, 0)
5255 #if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
5259 __attribute__((format(__printf__, 1, 2), __unused__));
5262 #if defined(_MSC_VER)
5267 #if defined(NVALGRIND)
5270 #if defined(_MSC_VER) || defined(__MINGW64__)
5273 unsigned long _qzz_res;
5276 va_start(vargs, format);
5277 #if defined(_MSC_VER) || defined(__MINGW64__)
5286 (
unsigned long)format,
5287 (
unsigned long)&vargs,
5291 return (
int)_qzz_res;
5295 #if defined(__GNUC__) || defined(__INTEL_COMPILER) && !defined(_MSC_VER)
5297 __attribute__((format(__printf__, 1, 2), __unused__));
5300 #if defined(_MSC_VER)
5305 #if defined(NVALGRIND)
5308 #if defined(_MSC_VER) || defined(__MINGW64__)
5311 unsigned long _qzz_res;
5314 va_start(vargs, format);
5315 #if defined(_MSC_VER) || defined(__MINGW64__)
5324 (
unsigned long)format,
5325 (
unsigned long)&vargs,
5329 return (
int)_qzz_res;
5357 #define VALGRIND_NON_SIMD_CALL0(_qyy_fn) \
5358 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
5359 VG_USERREQ__CLIENT_CALL0, \
5363 #define VALGRIND_NON_SIMD_CALL1(_qyy_fn, _qyy_arg1) \
5364 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
5365 VG_USERREQ__CLIENT_CALL1, \
5369 #define VALGRIND_NON_SIMD_CALL2(_qyy_fn, _qyy_arg1, _qyy_arg2) \
5370 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
5371 VG_USERREQ__CLIENT_CALL2, \
5373 _qyy_arg1, _qyy_arg2, 0, 0)
5375 #define VALGRIND_NON_SIMD_CALL3(_qyy_fn, _qyy_arg1, _qyy_arg2, _qyy_arg3) \
5376 VALGRIND_DO_CLIENT_REQUEST_EXPR(0 , \
5377 VG_USERREQ__CLIENT_CALL3, \
5379 _qyy_arg1, _qyy_arg2, \
5386 #define VALGRIND_COUNT_ERRORS \
5387 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR( \
5389 VG_USERREQ__COUNT_ERRORS, \
5493 #define VALGRIND_MALLOCLIKE_BLOCK(addr, sizeB, rzB, is_zeroed) \
5494 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MALLOCLIKE_BLOCK, \
5495 addr, sizeB, rzB, is_zeroed, 0)
5500 #define VALGRIND_RESIZEINPLACE_BLOCK(addr, oldSizeB, newSizeB, rzB) \
5501 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__RESIZEINPLACE_BLOCK, \
5502 addr, oldSizeB, newSizeB, rzB, 0)
5507 #define VALGRIND_FREELIKE_BLOCK(addr, rzB) \
5508 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__FREELIKE_BLOCK, \
5512 #define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed) \
5513 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CREATE_MEMPOOL, \
5514 pool, rzB, is_zeroed, 0, 0)
5517 #define VALGRIND_DESTROY_MEMPOOL(pool) \
5518 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__DESTROY_MEMPOOL, \
5522 #define VALGRIND_MEMPOOL_ALLOC(pool, addr, size) \
5523 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_ALLOC, \
5524 pool, addr, size, 0, 0)
5527 #define VALGRIND_MEMPOOL_FREE(pool, addr) \
5528 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_FREE, \
5529 pool, addr, 0, 0, 0)
5532 #define VALGRIND_MEMPOOL_TRIM(pool, addr, size) \
5533 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_TRIM, \
5534 pool, addr, size, 0, 0)
5537 #define VALGRIND_MOVE_MEMPOOL(poolA, poolB) \
5538 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MOVE_MEMPOOL, \
5539 poolA, poolB, 0, 0, 0)
5542 #define VALGRIND_MEMPOOL_CHANGE(pool, addrA, addrB, size) \
5543 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__MEMPOOL_CHANGE, \
5544 pool, addrA, addrB, size, 0)
5547 #define VALGRIND_MEMPOOL_EXISTS(pool) \
5548 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
5549 VG_USERREQ__MEMPOOL_EXISTS, \
5553 #define VALGRIND_STACK_REGISTER(start, end) \
5554 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
5555 VG_USERREQ__STACK_REGISTER, \
5556 start, end, 0, 0, 0)
5560 #define VALGRIND_STACK_DEREGISTER(id) \
5561 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_DEREGISTER, \
5565 #define VALGRIND_STACK_CHANGE(id, start, end) \
5566 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__STACK_CHANGE, \
5567 id, start, end, 0, 0)
5570 #define VALGRIND_LOAD_PDB_DEBUGINFO(fd, ptr, total_size, delta) \
5571 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__LOAD_PDB_DEBUGINFO, \
5572 fd, ptr, total_size, delta, 0)
5578 #define VALGRIND_MAP_IP_TO_SRCLOC(addr, buf64) \
5579 (unsigned)VALGRIND_DO_CLIENT_REQUEST_EXPR(0, \
5580 VG_USERREQ__MAP_IP_TO_SRCLOC, \
5581 addr, buf64, 0, 0, 0)
5591 #define VALGRIND_DISABLE_ERROR_REPORTING \
5592 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
5597 #define VALGRIND_ENABLE_ERROR_REPORTING \
5598 VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__CHANGE_ERR_DISABLEMENT, \
5606 #define VALGRIND_MONITOR_COMMAND(command) \
5607 VALGRIND_DO_CLIENT_REQUEST_EXPR(0, VG_USERREQ__GDB_MONITOR_COMMAND, \
5608 command, 0, 0, 0, 0)
5611 #undef PLAT_x86_darwin
5612 #undef PLAT_amd64_darwin
5613 #undef PLAT_x86_win32
5614 #undef PLAT_amd64_win64
5615 #undef PLAT_x86_linux
5616 #undef PLAT_amd64_linux
5617 #undef PLAT_ppc32_linux
5618 #undef PLAT_ppc64_linux
5619 #undef PLAT_arm_linux
5620 #undef PLAT_s390x_linux
5621 #undef PLAT_mips32_linux
5622 #undef PLAT_mips64_linux
static int VALGRIND_PRINTF_BACKTRACE(const char *format,...)
@ VG_USERREQ__DESTROY_MEMPOOL
@ VG_USERREQ__MAP_IP_TO_SRCLOC
@ VG_USERREQ__LOAD_PDB_DEBUGINFO
@ VG_USERREQ__VEX_INIT_FOR_IRI
@ VG_USERREQ__PRINTF_BACKTRACE
@ VG_USERREQ__GDB_MONITOR_COMMAND
@ VG_USERREQ__MEMPOOL_ALLOC
@ VG_USERREQ__RESIZEINPLACE_BLOCK
@ VG_USERREQ__MALLOCLIKE_BLOCK
@ VG_USERREQ__COUNT_ERRORS
@ VG_USERREQ__STACK_REGISTER
@ VG_USERREQ__MEMPOOL_CHANGE
@ VG_USERREQ__PRINTF_VALIST_BY_REF
@ VG_USERREQ__RUNNING_ON_VALGRIND
@ VG_USERREQ__CLIENT_CALL0
@ VG_USERREQ__DISCARD_TRANSLATIONS
@ VG_USERREQ__PRINTF_BACKTRACE_VALIST_BY_REF
@ VG_USERREQ__FREELIKE_BLOCK
@ VG_USERREQ__CREATE_MEMPOOL
@ VG_USERREQ__MOVE_MEMPOOL
@ VG_USERREQ__CLIENT_CALL3
@ VG_USERREQ__MEMPOOL_TRIM
@ VG_USERREQ__CLIENT_CALL2
@ VG_USERREQ__CHANGE_ERR_DISABLEMENT
@ VG_USERREQ__STACK_CHANGE
@ VG_USERREQ__STACK_DEREGISTER
@ VG_USERREQ__MEMPOOL_FREE
@ VG_USERREQ__MEMPOOL_EXISTS
@ VG_USERREQ__CLIENT_CALL1
static int VALGRIND_PRINTF(const char *format,...)
#define VALGRIND_DO_CLIENT_REQUEST_EXPR( _zzq_default, _zzq_request, _zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5)