Search
lxdream.org :: lxdream :: r604:1024c3a9cb88
lxdream 0.9.1
released Jun 29
Download Now
changeset604:1024c3a9cb88
parent603:11564af1448b
child605:6ecdb604306b
authornkeynes
dateTue Jan 22 11:30:37 2008 +0000 (12 years ago)
Fix backpatching when the block moves during translation
src/sh4/ia32abi.h
src/sh4/ia32mac.h
src/sh4/ia64abi.h
src/sh4/sh4trans.h
src/sh4/sh4x86.c
src/sh4/sh4x86.in
1.1 --- a/src/sh4/ia32abi.h Tue Jan 22 11:29:43 2008 +0000
1.2 +++ b/src/sh4/ia32abi.h Tue Jan 22 11:30:37 2008 +0000
1.3 @@ -244,8 +244,8 @@
1.4 RET();
1.5
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 +0000
2.2 +++ b/src/sh4/ia32mac.h Tue Jan 22 11:30:37 2008 +0000
2.3 @@ -269,8 +269,8 @@
2.4 RET();
2.5
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 +0000
3.2 +++ b/src/sh4/ia64abi.h Tue Jan 22 11:30:37 2008 +0000
3.3 @@ -237,8 +237,8 @@
3.4 RET();
3.5
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 +0000
4.2 +++ b/src/sh4/sh4trans.h Tue Jan 22 11:30:37 2008 +0000
4.3 @@ -74,6 +74,7 @@
4.4
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.9
4.10 /******************************************************************************
5.1 --- a/src/sh4/sh4x86.c Tue Jan 22 11:29:43 2008 +0000
5.2 +++ b/src/sh4/sh4x86.c Tue Jan 22 11:30:37 2008 +0000
5.3 @@ -35,7 +35,7 @@
5.4 #define DEFAULT_BACKPATCH_SIZE 4096
5.5
5.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 +0000
6.2 +++ b/src/sh4/sh4x86.in Tue Jan 22 11:30:37 2008 +0000
6.3 @@ -35,7 +35,7 @@
6.4 #define DEFAULT_BACKPATCH_SIZE 4096
6.5
6.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++;
.