Search
lxdream.org :: lxdream/src/sh4/ia32abi.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/ia32abi.h
changeset 927:17b6b9e245d8
prev926:68f3e0fe02f1
next929:fd8cb0c82f5f
next953:f4a156508ad1
author nkeynes
date Mon Dec 15 10:44:56 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Add return-address-modifying exception return code to mmu TLB lookups (a little bit faster)
file annotate diff log raw
1.1 --- a/src/sh4/ia32abi.h Sun Dec 14 07:50:48 2008 +0000
1.2 +++ b/src/sh4/ia32abi.h Mon Dec 15 10:44:56 2008 +0000
1.3 @@ -53,6 +53,27 @@
1.4 CALL_ptr(ptr);
1.5 }
1.6
1.7 +static inline void call_func1_exc( void *ptr, int arg1, int pc )
1.8 +{
1.9 + if( arg1 != R_EAX ) {
1.10 + MOV_r32_r32( arg1, R_EAX );
1.11 + }
1.12 + load_exc_backpatch(R_EDX);
1.13 + CALL_ptr(ptr);
1.14 +}
1.15 +
1.16 +static inline void call_func2_exc( void *ptr, int arg1, int arg2, int pc )
1.17 +{
1.18 + if( arg2 != R_EDX ) {
1.19 + MOV_r32_r32( arg2, R_EDX );
1.20 + }
1.21 + if( arg1 != R_EAX ) {
1.22 + MOV_r32_r32( arg1, R_EAX );
1.23 + }
1.24 + load_exc_backpatch(R_ECX);
1.25 + CALL_ptr(ptr);
1.26 +}
1.27 +
1.28 /**
1.29 * Write a double (64-bit) value into memory, with the first word in arg2a, and
1.30 * the second in arg2b
1.31 @@ -285,16 +306,17 @@
1.32
1.33 for( i=0; i< sh4_x86.backpatch_posn; i++ ) {
1.34 uint32_t *fixup_addr = (uint32_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset];
1.35 - *fixup_addr = xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;
1.36 if( sh4_x86.backpatch_list[i].exc_code < 0 ) {
1.37 + if( sh4_x86.backpatch_list[i].exc_code == -2 ) {
1.38 + *fixup_addr = (uint32_t)xlat_output;
1.39 + } else {
1.40 + *fixup_addr += xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;
1.41 + }
1.42 load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );
1.43 - int stack_adj = -1 - sh4_x86.backpatch_list[i].exc_code;
1.44 - if( stack_adj > 0 ) {
1.45 - ADD_imm8s_r32( stack_adj, R_ESP );
1.46 - }
1.47 int rel = preexc_ptr - xlat_output;
1.48 JMP_rel(rel);
1.49 } else {
1.50 + *fixup_addr += xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;
1.51 PUSH_imm32( sh4_x86.backpatch_list[i].exc_code );
1.52 load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );
1.53 int rel = end_ptr - xlat_output;
.