/*------------------------------------------------------------*/
-/*--- The dispatch loop. ---*/
+/*--- ---*/
+/*--- The dispatch loop. VG_(run_innerloop) is used to ---*/
+/*--- run all translations except no-redir ones. ---*/
+/*--- ---*/
/*------------------------------------------------------------*/
/*----------------------------------------------------*/
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
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"