Browse Source

x86: emit absolute calls, as reallocating exec mem breaks relative ones

tags/mesa_20090313
Keith Whitwell 17 years ago
parent
commit
8162d317d2
3 changed files with 19 additions and 2 deletions
  1. 4
    1
      src/mesa/pipe/tgsi/exec/tgsi_sse2.c
  2. 13
    0
      src/mesa/x86/rtasm/x86sse.c
  3. 2
    1
      src/mesa/x86/rtasm/x86sse.h

+ 4
- 1
src/mesa/pipe/tgsi/exec/tgsi_sse2.c View File

@@ -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

+ 13
- 0
src/mesa/x86/rtasm/x86sse.c View File

@@ -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,

+ 2
- 1
src/mesa/x86/rtasm/x86sse.h View File

@@ -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,

Loading…
Cancel
Save