Search
lxdream.org :: lxdream/src/xlat/x86/ia32abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/x86/ia32abi.h
changeset 1292:799fdd4f704a
prev1146:76c5d1064262
author nkeynes
date Fri Aug 24 08:53:50 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Move the generated prologue/epilogue code out into a common entry stub
(reduces space requirements) and pre-save all saved registers. Change
FASTCALL to use 3 regs instead of 2 since we can now keep everything in
regs.
file annotate diff log raw
1.1 --- a/src/xlat/x86/ia32abi.h Mon Nov 08 18:56:11 2010 +1000
1.2 +++ b/src/xlat/x86/ia32abi.h Fri Aug 24 08:53:50 2012 +1000
1.3 @@ -23,14 +23,18 @@
1.4
1.5 #define REG_ARG1 REG_EAX
1.6 #define REG_ARG2 REG_EDX
1.7 +#define REG_ARG3 REG_ECX
1.8 #define REG_RESULT1 REG_EAX
1.9 -#define MAX_REG_ARG 2
1.10 +#define MAX_REG_ARG 3
1.11 +#define REG_SAVE1 REG_ESI
1.12 +#define REG_SAVE2 REG_EDI
1.13 +#define REG_CALLPTR REG_EBX
1.14
1.15 -static inline void decode_address( uintptr_t base, int addr_reg )
1.16 +static inline void decode_address( uintptr_t base, int addr_reg, int target_reg )
1.17 {
1.18 - MOVL_r32_r32( addr_reg, REG_ECX );
1.19 - SHRL_imm_r32( 12, REG_ECX );
1.20 - MOVP_sib_rptr( 2, REG_ECX, -1, base, REG_ECX );
1.21 + MOVL_r32_r32( addr_reg, target_reg );
1.22 + SHRL_imm_r32( 12, target_reg );
1.23 + MOVP_sib_rptr( 2, target_reg, -1, base, target_reg );
1.24 }
1.25
1.26 /**
1.27 @@ -84,7 +88,19 @@
1.28 CALL_r32disp(preg, disp);
1.29 }
1.30
1.31 -#define CALL3_r32disp_r32_r32_r32(preg,disp,arg1,arg2,arg3) CALL2_r32disp_r32_r32(preg,disp,arg1,arg2)
1.32 +static inline void CALL3_r32disp_r32_r32_r32( int preg, uint32_t disp, int arg1, int arg2, int arg3)
1.33 +{
1.34 + if( arg3 != REG_ARG3 ) {
1.35 + MOVL_r32_r32( arg3, REG_ARG3 );
1.36 + }
1.37 + if( arg2 != REG_ARG2 ) {
1.38 + MOVL_r32_r32( arg2, REG_ARG2 );
1.39 + }
1.40 + if( arg1 != REG_ARG1 ) {
1.41 + MOVL_r32_r32( arg1, REG_ARG1 );
1.42 + }
1.43 + CALL_r32disp(preg, disp);
1.44 +}
1.45
1.46 #else
1.47
.