1.1 --- a/src/sh4/ia64abi.h Mon Dec 15 10:44:56 2008 +0000
1.2 +++ b/src/sh4/ia64abi.h Tue Jan 13 11:56:28 2009 +0000
1.5 #define load_ptr( reg, ptr ) load_imm64( reg, (uint64_t)ptr );
1.7 +static inline decode_address( int addr_reg )
1.9 + uintptr_t base = (sh4r.xlat_sh4_mode&SR_MD) ? (uintptr_t)sh4_address_space : (uintptr_t)sh4_user_address_space;
1.10 + MOV_r32_r32( addr_reg, R_ECX );
1.11 + SHR_imm8_r32( 12, R_ECX );
1.12 + load_ptr( R_EDI, base );
1.13 + REXW(); OP(0x8B); OP(0x0C); OP(0xCF); // mov.q [%rdi + %rcx*8], %rcx
1.17 * Note: clobbers EAX to make the indirect call - this isn't usually
1.18 * a problem since the callee will usually clobber it anyway.
1.23 +static inline void call_func1_r32disp8( int preg, uint32_t disp8, int arg1 )
1.25 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.26 + CALL_r32disp8(preg, disp8);
1.29 +static inline void call_func1_r32disp8_exc( int preg, uint32_t disp8, int arg1, int pc )
1.31 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.32 + load_exc_backpatch(R_ESI);
1.33 + CALL_r32disp8(preg, disp8);
1.36 #define CALL_FUNC2_SIZE 16
1.37 static inline void call_func2( void *ptr, int arg1, int arg2 )
1.43 -#define MEM_WRITE_DOUBLE_SIZE 35
1.45 - * Write a double (64-bit) value into memory, with the first word in arg2a, and
1.46 - * the second in arg2b
1.48 -static inline void MEM_WRITE_DOUBLE( int addr, int arg2a, int arg2b )
1.49 +static inline void call_func2_r32disp8( int preg, uint32_t disp8, int arg1, int arg2 )
1.53 - call_func2(sh4_write_long, addr, arg2a);
1.56 - ADD_imm8s_r32(4, R_EDI);
1.57 - call_func0(sh4_write_long);
1.58 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.59 + REXW(); MOV_r32_r32(arg2, R_ESI);
1.60 + CALL_r32disp8(preg, disp8);
1.63 -#define MEM_READ_DOUBLE_SIZE 43
1.65 - * Read a double (64-bit) value from memory, writing the first word into arg2a
1.66 - * and the second into arg2b. The addr must not be in EAX
1.68 -static inline void MEM_READ_DOUBLE( int addr, int arg2a, int arg2b )
1.69 +static inline void call_func2_r32disp8_exc( int preg, uint32_t disp8, int arg1, int arg2, int pc )
1.71 - REXW(); SUB_imm8s_r32( 8, R_ESP );
1.73 - call_func1(sh4_read_long, addr);
1.76 - ADD_imm8s_r32(4, R_EDI);
1.77 - call_func0(sh4_read_long);
1.78 - MOV_r32_r32(R_EAX, arg2b);
1.80 - REXW(); ADD_imm8s_r32( 8, R_ESP );
1.81 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.82 + REXW(); MOV_r32_r32(arg2, R_ESI);
1.83 + load_exc_backpatch(R_EDX);
1.84 + CALL_r32disp8(preg, disp8);
1.90 * Emit the 'start of block' assembly. Sets up the stack frame and save