Mesa (master): translate_sse: Fix generated code argument handling for msabi on x86_64

Jon TURNEY jturney at kemper.freedesktop.org
Fri Oct 18 13:17:53 UTC 2013


Module: Mesa
Branch: master
Commit: cedfd79be205f302a82635354679cd2ecaf3cc57
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cedfd79be205f302a82635354679cd2ecaf3cc57

Author: Jon TURNEY <jon.turney at dronecode.org.uk>
Date:   Thu Oct  3 21:15:11 2013 +0100

translate_sse: Fix generated code argument handling for msabi on x86_64

translate_sse.c contains code for msabi on x86_64, but it appears to be
untested.

Currently arguments 1 and 2 passed to the generated code are moved as 32-bit
quantities into the registers used by sysvabi, irrespective of the architecture.
Since these may be pointers, they must be moved as 64-bit quantities to avoid
truncation.

Commit f4dd0991719ef3e2606920c5100b372181c60899 disabled tranlate_sse.c on MinGW
x86_64, I don't know if was due to this issue, or a different one...

Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/translate/translate_sse.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c
index 726a9b1..3e12f1e 100644
--- a/src/gallium/auxiliary/translate/translate_sse.c
+++ b/src/gallium/auxiliary/translate/translate_sse.c
@@ -1308,14 +1308,22 @@ static boolean build_vertex_emit( struct translate_sse *p,
    x86_push(p->func, p->outbuf_EBX);
    x86_push(p->func, p->count_EBP);
 
-/* on non-Win64 x86-64, these are already in the right registers */
+   /* on non-Win64 x86-64, these are already in the right registers */
    if(x86_target(p->func) != X86_64_STD_ABI)
    {
       x86_push(p->func, p->machine_EDI);
       x86_push(p->func, p->idx_ESI);
 
-      x86_mov(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
-      x86_mov(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+      if(x86_target(p->func) != X86_32)
+      {
+        x64_mov64(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
+        x64_mov64(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+      }
+      else
+      {
+        x86_mov(p->func, p->machine_EDI, x86_fn_arg(p->func, 1));
+        x86_mov(p->func, p->idx_ESI, x86_fn_arg(p->func, 2));
+      }
    }
 
    x86_mov(p->func, p->count_EBP, x86_fn_arg(p->func, 3));




More information about the mesa-commit mailing list