Search
lxdream.org :: lxdream/src/sh4/sh4trans.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4trans.c
changeset 593:6c710c7c6835
prev592:4343cbfdd21b
next596:dfc0c93d882e
author nkeynes
date Thu Jan 17 21:26:58 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Fix block overruns from long epilogues
file annotate diff log raw
1.1 --- a/src/sh4/sh4trans.c Thu Jan 17 10:17:32 2008 +0000
1.2 +++ b/src/sh4/sh4trans.c Thu Jan 17 21:26:58 2008 +0000
1.3 @@ -88,6 +88,7 @@
1.4 code = xlat_get_code_by_vma( sh4r.pc );
1.5 if( code == NULL ) {
1.6 code = sh4_translate_basic_block( sh4r.pc );
1.7 +// xlat_check_integrity();
1.8 }
1.9 }
1.10 code = code();
1.11 @@ -152,21 +153,17 @@
1.12 }
1.13 } while( !done );
1.14 pc += (done - 2);
1.15 - if( eob - xlat_output < EPILOGUE_SIZE ) {
1.16 + int epilogue_size = sh4_translate_end_block_size();
1.17 + uint32_t recovery_size = sizeof(struct xlat_recovery_record)*xlat_recovery_posn;
1.18 + uint32_t finalsize = xlat_output - block->code + epilogue_size + recovery_size;
1.19 + if( eob - xlat_output < finalsize ) {
1.20 uint8_t *oldstart = block->code;
1.21 - block = xlat_extend_block( xlat_output - oldstart + EPILOGUE_SIZE );
1.22 + block = xlat_extend_block( finalsize );
1.23 xlat_output = block->code + (xlat_output - oldstart);
1.24 }
1.25 sh4_translate_end_block(pc);
1.26
1.27 /* Write the recovery records onto the end of the code block */
1.28 - uint32_t recovery_size = sizeof(struct xlat_recovery_record)*xlat_recovery_posn;
1.29 - uint32_t finalsize = xlat_output - block->code + recovery_size;
1.30 - if( finalsize > block->size ) {
1.31 - uint8_t *oldstart = block->code;
1.32 - block = xlat_extend_block( finalsize );
1.33 - xlat_output = block->code + (xlat_output - oldstart);
1.34 - }
1.35 memcpy( xlat_output, xlat_recovery, recovery_size);
1.36 block->recover_table_offset = xlat_output - (uint8_t *)block->code;
1.37 block->recover_table_size = xlat_recovery_posn;
.