Alexandre Julliard : winebuild: Use the correct registers for relay debugging of floating point arguments on x86_64 .

Alexandre Julliard julliard at winehq.org
Mon Aug 30 13:00:43 CDT 2010


Module: wine
Branch: master
Commit: 7c9b525128e6a6d60107442337efeee3b9ea8868
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7c9b525128e6a6d60107442337efeee3b9ea8868

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug 30 12:41:06 2010 +0200

winebuild: Use the correct registers for relay debugging of floating point arguments on x86_64.

---

 dlls/ntdll/relay.c       |    4 ++++
 tools/winebuild/spec32.c |   18 ++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c
index cd9412c..a2d5377 100644
--- a/dlls/ntdll/relay.c
+++ b/dlls/ntdll/relay.c
@@ -378,6 +378,10 @@ __ASM_GLOBAL_FUNC( call_entry_point,
                    "movq 8(%rsp),%rdx\n\t"
                    "movq 16(%rsp),%r8\n\t"
                    "movq 24(%rsp),%r9\n\t"
+                   "movq %rcx,%xmm0\n\t"
+                   "movq %rdx,%xmm1\n\t"
+                   "movq %r8,%xmm2\n\t"
+                   "movq %r9,%xmm3\n\t"
                    "callq *%rax\n\t"
                    "leaq -16(%rbp),%rsp\n\t"
                    "popq %rdi\n\t"
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 81f139c..030a6bc 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -58,6 +58,12 @@ static inline int needs_relay( const ORDDEF *odp )
     return 1;
 }
 
+static int is_float_arg( const ORDDEF *odp, unsigned int arg )
+{
+    if (arg >= odp->u.func.nb_args) return 0;
+    return (odp->u.func.args[arg] == ARG_FLOAT || odp->u.func.args[arg] == ARG_DOUBLE);
+}
+
 /* check if dll will output relay thunks */
 int has_relays( DLLSPEC *spec )
 {
@@ -189,10 +195,14 @@ static void output_relay_debug( DLLSPEC *spec )
             output( "\t.cfi_startproc\n" );
             output( "\tsubq $40,%%rsp\n" );
             output( "\t.cfi_adjust_cfa_offset 40\n" );
-            output( "\tmovq %%rcx,48(%%rsp)\n" );
-            output( "\tmovq %%rdx,56(%%rsp)\n" );
-            output( "\tmovq %%r8,64(%%rsp)\n" );
-            output( "\tmovq %%r9,72(%%rsp)\n" );
+            switch (args)
+            {
+            default: output( "\tmovq %%%s,72(%%rsp)\n", is_float_arg( odp, 3 ) ? "xmm3" : "r9" );
+            case 3:  output( "\tmovq %%%s,64(%%rsp)\n", is_float_arg( odp, 2 ) ? "xmm2" : "r8" );
+            case 2:  output( "\tmovq %%%s,56(%%rsp)\n", is_float_arg( odp, 1 ) ? "xmm1" : "rdx" );
+            case 1:  output( "\tmovq %%%s,48(%%rsp)\n", is_float_arg( odp, 0 ) ? "xmm0" : "rcx" );
+            case 0:  break;
+            }
             output( "\tleaq 40(%%rsp),%%r8\n" );
             output( "\tmovq $%u,%%rdx\n", (flags << 24) | (args << 16) | (i - spec->base) );
             output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" );




More information about the wine-cvs mailing list