filename | src/sh4/xltcache.c |
changeset | 586:2a3ba82cf243 |
prev | 527:14c9489f647e |
next | 592:4343cbfdd21b |
author | nkeynes |
date | Thu Jan 17 10:11:37 2008 +0000 (16 years ago) |
permissions | -rw-r--r-- |
last change | Add flag to skip breakpoints when it's the very first instruction of a run (ie, so executing dreamcast_run() when the current pc is a breakpoint doesn't just return immediately) |
file | annotate | diff | log | raw |
1.1 --- a/src/sh4/xltcache.c Sun Nov 18 11:12:44 2007 +00001.2 +++ b/src/sh4/xltcache.c Thu Jan 17 10:11:37 2008 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: xltcache.c,v 1.11 2007-11-08 11:54:16 nkeynes Exp $1.6 + * $Id$1.7 *1.8 * Translation cache management. This part is architecture independent.1.9 *1.10 @@ -21,6 +21,7 @@1.11 #include <assert.h>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.19 return result;1.20 }1.22 +xlat_recovery_record_t xlat_get_recovery( void *code, void *native_pc, gboolean recover_after )1.23 +{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.28 + uint32_t posn;1.29 + if( recover_after ) {1.30 + if( records[count-1].xlat_pc <= (uintptr_t)native_pc ) {1.31 + return NULL;1.32 + }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.36 + }1.37 + }1.38 + return &records[0]; // shouldn't happen1.39 + } else {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.43 + }1.44 + }1.45 + return &records[count-1];1.46 + }1.47 + }1.48 + return NULL;1.49 +}1.50 +1.51 void **xlat_get_lut_entry( sh4addr_t address )1.52 {1.53 void **page = xlat_lut[XLAT_LUT_PAGE(address)];1.54 @@ -230,6 +260,16 @@1.55 return xlt->size;1.56 }1.58 +uint32_t xlat_get_code_size( void *block )1.59 +{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.62 + return xlt->size;1.63 + } else {1.64 + return ((uint8_t *)xlt->recover_table) - ((uint8_t *)block);1.65 + }1.66 +}1.67 +1.68 /**1.69 * Cut the specified block so that it has the given size, with the remaining data1.70 * forming a new free block. If the free block would be less than the minimum size,
.