revision 604:1024c3a9cb88
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 604:1024c3a9cb88 |
parent | 603:11564af1448b |
child | 605:6ecdb604306b |
author | nkeynes |
date | Tue Jan 22 11:30:37 2008 +0000 (16 years ago) |
Fix backpatching when the block moves during translation
src/sh4/ia32abi.h | view | annotate | diff | log | ||
src/sh4/ia32mac.h | view | annotate | diff | log | ||
src/sh4/ia64abi.h | view | annotate | diff | log | ||
src/sh4/sh4trans.h | view | annotate | diff | log | ||
src/sh4/sh4x86.c | view | annotate | diff | log | ||
src/sh4/sh4x86.in | view | annotate | diff | log |
1.1 --- a/src/sh4/ia32abi.h Tue Jan 22 11:29:43 2008 +00001.2 +++ b/src/sh4/ia32abi.h Tue Jan 22 11:30:37 2008 +00001.3 @@ -244,8 +244,8 @@1.4 RET();1.6 for( i=0; i< sh4_x86.backpatch_posn; i++ ) {1.7 - *sh4_x86.backpatch_list[i].fixup_addr =1.8 - xlat_output - ((uint8_t *)sh4_x86.backpatch_list[i].fixup_addr) - 4;1.9 + uint32_t *fixup_addr = (uint32_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset];1.10 + *fixup_addr = xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;1.11 if( sh4_x86.backpatch_list[i].exc_code < 0 ) {1.12 load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );1.13 int stack_adj = -1 - sh4_x86.backpatch_list[i].exc_code;
2.1 --- a/src/sh4/ia32mac.h Tue Jan 22 11:29:43 2008 +00002.2 +++ b/src/sh4/ia32mac.h Tue Jan 22 11:30:37 2008 +00002.3 @@ -269,8 +269,8 @@2.4 RET();2.6 for( i=0; i< sh4_x86.backpatch_posn; i++ ) {2.7 - *sh4_x86.backpatch_list[i].fixup_addr =2.8 - xlat_output - ((uint8_t *)sh4_x86.backpatch_list[i].fixup_addr) - 4;2.9 + uint32_t *fixup_addr = (uint32_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset];2.10 + *fixup_addr = xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;2.11 if( sh4_x86.backpatch_list[i].exc_code < 0 ) {2.12 load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );2.13 int stack_adj = -1 - sh4_x86.backpatch_list[i].exc_code;
3.1 --- a/src/sh4/ia64abi.h Tue Jan 22 11:29:43 2008 +00003.2 +++ b/src/sh4/ia64abi.h Tue Jan 22 11:30:37 2008 +00003.3 @@ -237,8 +237,8 @@3.4 RET();3.6 for( i=0; i< sh4_x86.backpatch_posn; i++ ) {3.7 - *sh4_x86.backpatch_list[i].fixup_addr =3.8 - xlat_output - ((uint8_t *)sh4_x86.backpatch_list[i].fixup_addr) - 4;3.9 + uint32_t *fixup_addr = (uint32_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset];3.10 + *fixup_addr = xlat_output - (uint8_t *)&xlat_current_block->code[sh4_x86.backpatch_list[i].fixup_offset] - 4;3.11 if( sh4_x86.backpatch_list[i].exc_code < 0 ) {3.12 load_imm32( R_EDX, sh4_x86.backpatch_list[i].fixup_icount );3.13 int stack_adj = -1 - sh4_x86.backpatch_list[i].exc_code;
4.1 --- a/src/sh4/sh4trans.h Tue Jan 22 11:29:43 2008 +00004.2 +++ b/src/sh4/sh4trans.h Tue Jan 22 11:30:37 2008 +00004.3 @@ -74,6 +74,7 @@4.5 extern uint8_t *xlat_output;4.6 extern struct xlat_recovery_record xlat_recovery[MAX_RECOVERY_SIZE];4.7 +extern xlat_cache_block_t xlat_current_block;4.8 extern uint32_t xlat_recovery_posn;4.10 /******************************************************************************
5.1 --- a/src/sh4/sh4x86.c Tue Jan 22 11:29:43 2008 +00005.2 +++ b/src/sh4/sh4x86.c Tue Jan 22 11:30:37 2008 +00005.3 @@ -35,7 +35,7 @@5.4 #define DEFAULT_BACKPATCH_SIZE 40965.6 struct backpatch_record {5.7 - uint32_t *fixup_addr;5.8 + uint32_t fixup_offset;5.9 uint32_t fixup_icount;5.10 int32_t exc_code;5.11 };5.12 @@ -115,7 +115,8 @@5.13 if( sh4_x86.in_delay_slot ) {5.14 fixup_pc -= 2;5.15 }5.16 - sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_addr = (uint32_t *)fixup_addr;5.17 + sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_offset =5.18 + ((uint8_t *)fixup_addr) - ((uint8_t *)xlat_current_block->code);5.19 sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_icount = (fixup_pc - sh4_x86.block_start_pc)>>1;5.20 sh4_x86.backpatch_list[sh4_x86.backpatch_posn].exc_code = exc_code;5.21 sh4_x86.backpatch_posn++;
6.1 --- a/src/sh4/sh4x86.in Tue Jan 22 11:29:43 2008 +00006.2 +++ b/src/sh4/sh4x86.in Tue Jan 22 11:30:37 2008 +00006.3 @@ -35,7 +35,7 @@6.4 #define DEFAULT_BACKPATCH_SIZE 40966.6 struct backpatch_record {6.7 - uint32_t *fixup_addr;6.8 + uint32_t fixup_offset;6.9 uint32_t fixup_icount;6.10 int32_t exc_code;6.11 };6.12 @@ -115,7 +115,8 @@6.13 if( sh4_x86.in_delay_slot ) {6.14 fixup_pc -= 2;6.15 }6.16 - sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_addr = (uint32_t *)fixup_addr;6.17 + sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_offset =6.18 + ((uint8_t *)fixup_addr) - ((uint8_t *)xlat_current_block->code);6.19 sh4_x86.backpatch_list[sh4_x86.backpatch_posn].fixup_icount = (fixup_pc - sh4_x86.block_start_pc)>>1;6.20 sh4_x86.backpatch_list[sh4_x86.backpatch_posn].exc_code = exc_code;6.21 sh4_x86.backpatch_posn++;
.