Search
lxdream.org :: lxdream :: r592:4343cbfdd21b
lxdream 0.9.1
released Jun 29
Download Now
changeset592:4343cbfdd21b
parent591:7b9612fd2395
child593:6c710c7c6835
authornkeynes
dateThu Jan 17 10:17:32 2008 +0000 (16 years ago)
Change recovery table to offset rather than pointer (so as to survive block moves)
src/sh4/sh4trans.c
src/sh4/xltcache.c
src/sh4/xltcache.h
1.1 --- a/src/sh4/sh4trans.c Thu Jan 17 10:11:37 2008 +0000
1.2 +++ b/src/sh4/sh4trans.c Thu Jan 17 10:17:32 2008 +0000
1.3 @@ -168,7 +168,7 @@
1.4 xlat_output = block->code + (xlat_output - oldstart);
1.5 }
1.6 memcpy( xlat_output, xlat_recovery, recovery_size);
1.7 - block->recover_table = (xlat_recovery_record_t)xlat_output;
1.8 + block->recover_table_offset = xlat_output - (uint8_t *)block->code;
1.9 block->recover_table_size = xlat_recovery_posn;
1.10 xlat_commit_block( finalsize, pc-start );
1.11 return block->code;
2.1 --- a/src/sh4/xltcache.c Thu Jan 17 10:11:37 2008 +0000
2.2 +++ b/src/sh4/xltcache.c Thu Jan 17 10:17:32 2008 +0000
2.3 @@ -213,7 +213,7 @@
2.4 if( code != NULL ) {
2.5 xlat_cache_block_t block = BLOCK_FOR_CODE(code);
2.6 uint32_t count = block->recover_table_size;
2.7 - xlat_recovery_record_t records = block->recover_table;
2.8 + xlat_recovery_record_t records = (xlat_recovery_record_t)(&block->code[block->recover_table_offset]);
2.9 uint32_t posn;
2.10 if( recover_after ) {
2.11 if( records[count-1].xlat_pc <= (uintptr_t)native_pc ) {
2.12 @@ -263,10 +263,10 @@
2.13 uint32_t xlat_get_code_size( void *block )
2.14 {
2.15 xlat_cache_block_t xlt = (xlat_cache_block_t)(((char *)block)-sizeof(struct xlat_cache_block));
2.16 - if( xlt->recover_table == NULL ) {
2.17 + if( xlt->recover_table_offset == 0 ) {
2.18 return xlt->size;
2.19 } else {
2.20 - return ((uint8_t *)xlt->recover_table) - ((uint8_t *)block);
2.21 + return xlt->recover_table_offset;
2.22 }
2.23 }
2.24
3.1 --- a/src/sh4/xltcache.h Thu Jan 17 10:11:37 2008 +0000
3.2 +++ b/src/sh4/xltcache.h Thu Jan 17 10:17:32 2008 +0000
3.3 @@ -41,7 +41,7 @@
3.4 int active; /* 0 = deleted, 1 = normal. 2 = accessed (temp-space only) */
3.5 uint32_t size;
3.6 void **lut_entry; /* For deletion */
3.7 - xlat_recovery_record_t recover_table;
3.8 + uint32_t recover_table_offset; // Offset from code[0] of the recovery table;
3.9 uint32_t recover_table_size;
3.10 unsigned char code[0];
3.11 } __attribute__((packed));
.