Search
lxdream.org :: lxdream/src/sh4/sh4trans.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4trans.c
changeset 410:5f8413358e7f
prev408:af496b734734
next417:bd927df302a9
author nkeynes
date Sat Sep 29 11:06:40 2007 +0000 (14 years ago)
permissions -rw-r--r--
last change Change extend-block to take a requested size
Terminate blocks on page boundaries for easier invalidation
file annotate diff log raw
1.1 --- a/src/sh4/sh4trans.c Fri Sep 28 07:27:20 2007 +0000
1.2 +++ b/src/sh4/sh4trans.c Sat Sep 29 11:06:40 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: sh4trans.c,v 1.5 2007-09-28 07:27:20 nkeynes Exp $
1.6 + * $Id: sh4trans.c,v 1.6 2007-09-29 11:06:40 nkeynes Exp $
1.7 *
1.8 * SH4 translation core module. This part handles the non-target-specific
1.9 * section of the translation.
1.10 @@ -86,6 +86,7 @@
1.11 void * sh4_translate_basic_block( sh4addr_t start )
1.12 {
1.13 sh4addr_t pc = start;
1.14 + sh4addr_t lastpc = (pc&0xFFFFF000)+0x1000;
1.15 int done;
1.16 xlat_cache_block_t block = xlat_start_block( start );
1.17 xlat_output = (uint8_t *)block->code;
1.18 @@ -95,14 +96,23 @@
1.19 do {
1.20 if( eob - xlat_output < MAX_INSTRUCTION_SIZE ) {
1.21 uint8_t *oldstart = block->code;
1.22 - block = xlat_extend_block();
1.23 + block = xlat_extend_block( xlat_output - oldstart + MAX_INSTRUCTION_SIZE );
1.24 xlat_output = block->code + (xlat_output - oldstart);
1.25 eob = block->code + block->size;
1.26 }
1.27 done = sh4_x86_translate_instruction( pc );
1.28 + assert( xlat_output <= eob );
1.29 pc += 2;
1.30 + if ( pc >= lastpc ) {
1.31 + done = 2;
1.32 + }
1.33 } while( !done );
1.34 pc += (done - 2);
1.35 + if( eob - xlat_output < EPILOGUE_SIZE ) {
1.36 + uint8_t *oldstart = block->code;
1.37 + block = xlat_extend_block( xlat_output - oldstart + EPILOGUE_SIZE );
1.38 + xlat_output = block->code + (xlat_output - oldstart);
1.39 + }
1.40 sh4_translate_end_block(pc);
1.41 xlat_commit_block( xlat_output - block->code, pc-start );
1.42 return block->code;
.