Search
lxdream.org :: lxdream/src/sh4/ia32abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia32abi.h
changeset 929:fd8cb0c82f5f
prev927:17b6b9e245d8
next930:07e5b11419db
author nkeynes
date Sat Dec 20 03:01:40 2008 +0000 (11 years ago)
branchlxdream-mem
permissions -rw-r--r--
last change First pass experiment using cached decoding.
file annotate diff log raw
1.1 --- a/src/sh4/ia32abi.h Mon Dec 15 10:44:56 2008 +0000
1.2 +++ b/src/sh4/ia32abi.h Sat Dec 20 03:01:40 2008 +0000
1.3 @@ -42,6 +42,22 @@
1.4 CALL_ptr(ptr);
1.5 }
1.6
1.7 +static inline void call_func1_r32( int addr_reg, int arg1 )
1.8 +{
1.9 + if( arg1 != R_EAX ) {
1.10 + MOV_r32_r32( arg1, R_EAX );
1.11 + }
1.12 + CALL_r32(addr_reg);
1.13 +}
1.14 +
1.15 +static inline void call_func1_r32ind( int preg, uint32_t disp32, int arg1 )
1.16 +{
1.17 + if( arg1 != R_EAX ) {
1.18 + MOV_r32_r32( arg1, R_EAX );
1.19 + }
1.20 + CALL_r32ind(preg, disp32);
1.21 +}
1.22 +
1.23 static inline void call_func2( void *ptr, int arg1, int arg2 )
1.24 {
1.25 if( arg2 != R_EDX ) {
1.26 @@ -53,6 +69,30 @@
1.27 CALL_ptr(ptr);
1.28 }
1.29
1.30 +static inline void call_func2_r32( int addr_reg, int arg1, int arg2 )
1.31 +{
1.32 + if( arg2 != R_EDX ) {
1.33 + MOV_r32_r32( arg2, R_EDX );
1.34 + }
1.35 + if( arg1 != R_EAX ) {
1.36 + MOV_r32_r32( arg1, R_EAX );
1.37 + }
1.38 + CALL_r32(addr_reg);
1.39 +}
1.40 +
1.41 +static inline void call_func2_r32ind( int preg, uint32_t disp32, int arg1, int arg2 )
1.42 +{
1.43 + if( arg2 != R_EDX ) {
1.44 + MOV_r32_r32( arg2, R_EDX );
1.45 + }
1.46 + if( arg1 != R_EAX ) {
1.47 + MOV_r32_r32( arg1, R_EAX );
1.48 + }
1.49 + CALL_r32ind(preg, disp32);
1.50 +}
1.51 +
1.52 +
1.53 +
1.54 static inline void call_func1_exc( void *ptr, int arg1, int pc )
1.55 {
1.56 if( arg1 != R_EAX ) {
1.57 @@ -174,12 +214,14 @@
1.58 {
1.59 PUSH_r32(R_EBP);
1.60 load_ptr( R_EBP, ((uint8_t *)&sh4r) + 128 );
1.61 - SUB_imm8s_r32( 8, R_ESP );
1.62 + PUSH_r32(R_EBX);
1.63 + SUB_imm8s_r32( 4, R_ESP );
1.64 }
1.65
1.66 static inline void exit_block( )
1.67 {
1.68 - ADD_imm8s_r32( 8, R_ESP );
1.69 + ADD_imm8s_r32( 4, R_ESP );
1.70 + POP_r32(R_EBX);
1.71 POP_r32(R_EBP);
1.72 RET();
1.73 }
.