]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make function wrapping work on amd64-linux.
authorJulian Seward <jseward@acm.org>
Thu, 12 Jan 2006 13:34:20 +0000 (13:34 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 12 Jan 2006 13:34:20 +0000 (13:34 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5521

coregrind/m_dispatch/dispatch-amd64-linux.S
coregrind/m_scheduler/scheduler.c

index 5a0d07e80297c2d4126395383a75477cfe0fc5f3..64a35000aa6e22f3d3012f2f0cfca4362a24ea1a 100644 (file)
 
 
 /*------------------------------------------------------------*/
-/*--- The dispatch loop.                                   ---*/
+/*---                                                      ---*/
+/*--- The dispatch loop.  VG_(run_innerloop) is used to    ---*/
+/*--- run all translations except no-redir ones.           ---*/
+/*---                                                      ---*/
 /*------------------------------------------------------------*/
 
 /*----------------------------------------------------*/
@@ -272,13 +275,55 @@ run_innerloop_exit_REALLY:
        ret     
 
        
-       
-/* Other ways of getting out of the inner loop.  Placed out-of-line to
-   make it look cleaner. 
-*/
-
+/*------------------------------------------------------------*/
+/*---                                                      ---*/
+/*--- A special dispatcher, for running no-redir           ---*/
+/*--- translations.  Just runs the given translation once. ---*/
+/*---                                                      ---*/
+/*------------------------------------------------------------*/
 
+/* signature:
+void VG_(run_a_noredir_translation) ( UWord* argblock );
+*/
 
+/* Run a no-redir translation.  argblock points to 4 UWords, 2 to carry args
+   and 2 to carry results:
+      0: input:  ptr to translation
+      1: input:  ptr to guest state
+      2: output: next guest PC
+      3: output: guest state pointer afterwards (== thread return code)
+*/
+.align 16
+.global VG_(run_a_noredir_translation)
+VG_(run_a_noredir_translation):
+       /* Save callee-saves regs */
+       pushq %rbx
+       pushq %rbp
+       pushq %r12
+       pushq %r13
+       pushq %r14
+       pushq %r15
+
+       pushq %rdi  /* we will need it after running the translation */
+       movq 8(%rdi), %rbp
+       jmp *0(%rdi)
+       /*NOTREACHED*/
+       ud2
+       /* If the translation has been correctly constructed, we
+       should resume at the the following label. */
+.global VG_(run_a_noredir_translation__return_point)
+VG_(run_a_noredir_translation__return_point):
+       popq %rdi
+       movq %rax, 16(%rdi)
+       movq %rbp, 24(%rdi)
+
+       popq  %r15
+       popq  %r14
+       popq  %r13
+       popq  %r12
+       popq  %rbp
+       popq  %rbx
+       ret
 
 /* Let the linker know we don't need an executable stack */
 .section .note.GNU-stack,"",@progbits
index 32a042ae3377d3ea0de3a82977fc6c0fe895771a..d07cced1385a9fa562138f5d2ad4d6a22fae97bc 100644 (file)
@@ -657,33 +657,6 @@ static UInt run_noredir_translation ( Addr hcode, ThreadId tid )
 extern UWord run_a_translation ( UWord* argblock );
 #if defined(VGP_x86_linux)
 #elif defined(VGP_amd64_linux)
-asm("\n"
-".text\n"
-"run_a_translation:\n"
-"   pushq %rbx\n"
-"   pushq %rbp\n"
-"   pushq %r12\n"
-"   pushq %r13\n"
-"   pushq %r14\n"
-"   pushq %r15\n"
-
-"   pushq %rdi\n"  /* we will need it after running the translation */
-"   movq 8(%rdi), %rbp\n"
-"   call *0(%rdi)\n"
-
-"   popq %rdi\n"
-"   movq %rax, 16(%rdi)\n"
-"   movq %rbp, 24(%rdi)\n"
-
-"   popq  %r15\n"
-"   popq  %r14\n"
-"   popq  %r13\n"
-"   popq  %r12\n"
-"   popq  %rbp\n"
-"   popq  %rbx\n"
-"   ret\n"
-".previous\n"
-);
 #elif defined(VGP_ppc32_linux)
 asm("\n"
 ".text\n"