1.1 --- a/src/sh4/xltcache.c Sun Nov 18 11:12:44 2007 +0000
1.2 +++ b/src/sh4/xltcache.c Tue Jan 15 20:50:23 2008 +0000
1.5 - * $Id: xltcache.c,v 1.11 2007-11-08 11:54:16 nkeynes Exp $
1.8 * Translation cache management. This part is architecture independent.
1.13 #include "dreamcast.h"
1.14 +#include "sh4/sh4core.h"
1.15 #include "sh4/xltcache.h"
1.16 #include "x86dasm/x86dasm.h"
1.18 @@ -207,6 +208,35 @@
1.22 +xlat_recovery_record_t xlat_get_recovery( void *code, void *native_pc, gboolean recover_after )
1.24 + if( code != NULL ) {
1.25 + xlat_cache_block_t block = BLOCK_FOR_CODE(code);
1.26 + uint32_t count = block->recover_table_size;
1.27 + xlat_recovery_record_t records = block->recover_table;
1.29 + if( recover_after ) {
1.30 + if( records[count-1].xlat_pc <= (uintptr_t)native_pc ) {
1.33 + for( posn=count-1; posn > 0; posn-- ) {
1.34 + if( records[posn-1].xlat_pc < (uintptr_t)native_pc ) {
1.35 + return &records[posn];
1.38 + return &records[0]; // shouldn't happen
1.40 + for( posn = 1; posn < count; posn++ ) {
1.41 + if( records[posn].xlat_pc >= (uintptr_t)native_pc ) {
1.42 + return &records[posn-1];
1.45 + return &records[count-1];
1.51 void **xlat_get_lut_entry( sh4addr_t address )
1.53 void **page = xlat_lut[XLAT_LUT_PAGE(address)];
1.54 @@ -230,6 +260,16 @@
1.58 +uint32_t xlat_get_code_size( void *block )
1.60 + xlat_cache_block_t xlt = (xlat_cache_block_t)(((char *)block)-sizeof(struct xlat_cache_block));
1.61 + if( xlt->recover_table == NULL ) {
1.64 + return ((uint8_t *)xlt->recover_table) - ((uint8_t *)block);
1.69 * Cut the specified block so that it has the given size, with the remaining data
1.70 * forming a new free block. If the free block would be less than the minimum size,