|
From: <sv...@va...> - 2006-01-12 13:34:26
|
Author: sewardj
Date: 2006-01-12 13:34:20 +0000 (Thu, 12 Jan 2006)
New Revision: 5521
Log:
Make function wrapping work on amd64-linux.
Modified:
trunk/coregrind/m_dispatch/dispatch-amd64-linux.S
trunk/coregrind/m_scheduler/scheduler.c
Modified: trunk/coregrind/m_dispatch/dispatch-amd64-linux.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_dispatch/dispatch-amd64-linux.S 2006-01-12 12:32:32=
UTC (rev 5520)
+++ trunk/coregrind/m_dispatch/dispatch-amd64-linux.S 2006-01-12 13:34:20=
UTC (rev 5521)
@@ -36,7 +36,10 @@
=20
=20
/*------------------------------------------------------------*/
-/*--- The dispatch loop. ---*/
+/*--- ---*/
+/*--- The dispatch loop. VG_(run_innerloop) is used to ---*/
+/*--- run all translations except no-redir ones. ---*/
+/*--- ---*/
/*------------------------------------------------------------*/
=20
/*----------------------------------------------------*/
@@ -272,13 +275,55 @@
ret=09
=20
=09
-=09
-/* Other ways of getting out of the inner loop. Placed out-of-line to
- make it look cleaner.=20
+/*------------------------------------------------------------*/
+/*--- ---*/
+/*--- A special dispatcher, for running no-redir ---*/
+/*--- translations. Just runs the given translation once. ---*/
+/*--- ---*/
+/*------------------------------------------------------------*/
+
+/* signature:
+void VG_(run_a_noredir_translation) ( UWord* argblock );
*/
=20
+/* 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 (=3D=3D thread return co=
de)
+*/
+.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
=20
+ 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)
=20
+ popq %r15
+ popq %r14
+ popq %r13
+ popq %r12
+ popq %rbp
+ popq %rbx
+ ret
=20
/* Let the linker know we don't need an executable stack */
.section .note.GNU-stack,"",@progbits
Modified: trunk/coregrind/m_scheduler/scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_scheduler/scheduler.c 2006-01-12 12:32:32 UTC (rev =
5520)
+++ trunk/coregrind/m_scheduler/scheduler.c 2006-01-12 13:34:20 UTC (rev =
5521)
@@ -657,33 +657,6 @@
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"
|