Search
lxdream.org :: lxdream/src/sh4/ia64abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia64abi.h
changeset 953:f4a156508ad1
prev927:17b6b9e245d8
next957:0f6131f6cc3a
author nkeynes
date Tue Jan 13 11:56:28 2009 +0000 (13 years ago)
permissions -rw-r--r--
last change Merge lxdream-mem branch back to trunk
file annotate diff log raw
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.3 @@ -24,6 +24,15 @@
1.4
1.5 #define load_ptr( reg, ptr ) load_imm64( reg, (uint64_t)ptr );
1.6
1.7 +static inline decode_address( int addr_reg )
1.8 +{
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.14 +}
1.15 +
1.16 /**
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.19 @@ -50,6 +59,19 @@
1.20 call_func0(ptr);
1.21 }
1.22
1.23 +static inline void call_func1_r32disp8( int preg, uint32_t disp8, int arg1 )
1.24 +{
1.25 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.26 + CALL_r32disp8(preg, disp8);
1.27 +}
1.28 +
1.29 +static inline void call_func1_r32disp8_exc( int preg, uint32_t disp8, int arg1, int pc )
1.30 +{
1.31 + REXW(); MOV_r32_r32(arg1, R_EDI);
1.32 + load_exc_backpatch(R_ESI);
1.33 + CALL_r32disp8(preg, disp8);
1.34 +}
1.35 +
1.36 #define CALL_FUNC2_SIZE 16
1.37 static inline void call_func2( void *ptr, int arg1, int arg2 )
1.38 {
1.39 @@ -58,42 +80,23 @@
1.40 call_func0(ptr);
1.41 }
1.42
1.43 -#define MEM_WRITE_DOUBLE_SIZE 35
1.44 -/**
1.45 - * Write a double (64-bit) value into memory, with the first word in arg2a, and
1.46 - * the second in arg2b
1.47 - */
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.50 {
1.51 - PUSH_r32(arg2b);
1.52 - PUSH_r32(addr);
1.53 - call_func2(sh4_write_long, addr, arg2a);
1.54 - POP_r32(R_EDI);
1.55 - POP_r32(R_ESI);
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.61 }
1.62
1.63 -#define MEM_READ_DOUBLE_SIZE 43
1.64 -/**
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.67 - */
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.70 {
1.71 - REXW(); SUB_imm8s_r32( 8, R_ESP );
1.72 - PUSH_r32(addr);
1.73 - call_func1(sh4_read_long, addr);
1.74 - POP_r32(R_EDI);
1.75 - PUSH_r32(R_EAX);
1.76 - ADD_imm8s_r32(4, R_EDI);
1.77 - call_func0(sh4_read_long);
1.78 - MOV_r32_r32(R_EAX, arg2b);
1.79 - POP_r32(arg2a);
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.85 }
1.86
1.87
1.88 +
1.89 /**
1.90 * Emit the 'start of block' assembly. Sets up the stack frame and save
1.91 * SI/DI as required
.