summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-02-13 12:35:16 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2008-02-13 12:36:32 +0000
commit8162d317d2f6f2dcc31f31c0c2d663c33dfee053 (patch)
treefca0447312e47867d8cea4d4e828b9bc58166352
parenta3534a27bfc9827a12d83f7b6464af98424cf8d4 (diff)
x86: emit absolute calls, as reallocating exec mem breaks relative ones
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_sse2.c5
-rw-r--r--src/mesa/x86/rtasm/x86sse.c13
-rw-r--r--src/mesa/x86/rtasm/x86sse.h3
3 files changed, 19 insertions, 2 deletions
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
index ecf4ca8d21..1e56e4afb6 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
@@ -328,8 +328,11 @@ emit_call(
struct x86_function *func,
void (* addr)() )
{
+ struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX );
+
DUMP_I( "CALL", addr );
- x86_call( func, addr );
+ x86_mov_reg_imm( func, ecx, (unsigned long) addr );
+ x86_call( func, ecx );
}
static void
diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c
index 385fb84c01..e944d00f9e 100644
--- a/src/mesa/x86/rtasm/x86sse.c
+++ b/src/mesa/x86/rtasm/x86sse.c
@@ -278,11 +278,24 @@ void x86_jmp( struct x86_function *p, unsigned char *label)
emit_1i(p, label - x86_get_label(p) - 4);
}
+#if 0
+/* This doesn't work once we start reallocating & copying the
+ * generated code on buffer fills, because the call is relative to the
+ * current pc.
+ */
void x86_call( struct x86_function *p, void (*label)())
{
emit_1ub(p, 0xe8);
emit_1i(p, cptr(label) - x86_get_label(p) - 4);
}
+#else
+void x86_call( struct x86_function *p, struct x86_reg reg)
+{
+ emit_1ub(p, 0xff);
+ emit_modrm(p, reg, reg);
+}
+#endif
+
/* michal:
* Temporary. As I need immediate operands, and dont want to mess with the codegen,
diff --git a/src/mesa/x86/rtasm/x86sse.h b/src/mesa/x86/rtasm/x86sse.h
index d53b6d71a6..c2aa416492 100644
--- a/src/mesa/x86/rtasm/x86sse.h
+++ b/src/mesa/x86/rtasm/x86sse.h
@@ -119,7 +119,8 @@ void x86_fixup_fwd_jump( struct x86_function *p,
void x86_jmp( struct x86_function *p, unsigned char *label );
-void x86_call( struct x86_function *p, void (*label)() );
+/* void x86_call( struct x86_function *p, void (*label)() ); */
+void x86_call( struct x86_function *p, struct x86_reg reg);
/* michal:
* Temporary. As I need immediate operands, and dont want to mess with the codegen,