revision 809:8bdbf4d95da4
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 809:8bdbf4d95da4 |
parent | 808:da414654f3fa |
child | 810:833cc4960556 |
author | nkeynes |
date | Sat Aug 09 10:48:03 2008 +0000 (15 years ago) |
Fix core-exit-on-flush in a delay branch slot. Bit of a hack really
![]() | src/sh4/sh4trans.c | view | annotate | diff | log | |
![]() | src/sh4/xltcache.c | view | annotate | diff | log | |
![]() | src/sh4/xltcache.h | view | annotate | diff | log |
1.1 --- a/src/sh4/sh4trans.c Sat Aug 09 09:13:29 2008 +00001.2 +++ b/src/sh4/sh4trans.c Sat Aug 09 10:48:03 2008 +00001.3 @@ -160,7 +160,7 @@1.4 if( pc != NULL ) {1.5 // could be null if we're not actually running inside the translator1.6 void *code = xlat_get_code( sh4r.pc );1.7 - xlat_recovery_record_t recover = xlat_get_recovery(code, pc, TRUE);1.8 + xlat_recovery_record_t recover = xlat_get_post_recovery(code, pc, TRUE);1.9 if( recover != NULL ) {1.10 // Can be null if there is no recovery necessary1.11 sh4_translate_run_recovery(recover);1.12 @@ -193,7 +193,7 @@1.13 assert( pc != NULL );1.15 void *code = xlat_get_code( sh4r.pc );1.16 - xlat_recovery_record_t recover = xlat_get_recovery(code, pc, TRUE);1.17 + xlat_recovery_record_t recover = xlat_get_post_recovery(code, pc, FALSE);1.18 if( recover != NULL ) {1.19 // Can be null if there is no recovery necessary1.20 sh4_translate_run_recovery(recover);
2.1 --- a/src/sh4/xltcache.c Sat Aug 09 09:13:29 2008 +00002.2 +++ b/src/sh4/xltcache.c Sat Aug 09 10:48:03 2008 +00002.3 @@ -208,7 +208,7 @@2.4 return result;2.5 }2.7 -xlat_recovery_record_t xlat_get_recovery( void *code, void *native_pc, gboolean recover_after )2.8 +xlat_recovery_record_t xlat_get_post_recovery( void *code, void *native_pc, gboolean with_terminal )2.9 {2.10 if( code != NULL ) {2.11 uintptr_t pc_offset = ((uint8_t *)native_pc) - ((uint8_t *)code);2.12 @@ -216,28 +216,39 @@2.13 uint32_t count = block->recover_table_size;2.14 xlat_recovery_record_t records = (xlat_recovery_record_t)(&block->code[block->recover_table_offset]);2.15 uint32_t posn;2.16 - if( recover_after ) {2.17 - if( records[count-1].xlat_offset < pc_offset ) {2.18 - return NULL;2.19 - }2.20 - for( posn=count-1; posn > 0; posn-- ) {2.21 - if( records[posn-1].xlat_offset < pc_offset ) {2.22 - return &records[posn];2.23 - }2.24 - }2.25 - return &records[0]; // shouldn't happen2.26 - } else {2.27 - for( posn = 1; posn < count; posn++ ) {2.28 - if( records[posn].xlat_offset >= pc_offset ) {2.29 - return &records[posn-1];2.30 - }2.31 - }2.32 - return &records[count-1];2.33 + if( count > 0 && !with_terminal )2.34 + count--;2.35 + if( records[count-1].xlat_offset < pc_offset ) {2.36 + return NULL;2.37 }2.38 + for( posn=count-1; posn > 0; posn-- ) {2.39 + if( records[posn-1].xlat_offset < pc_offset ) {2.40 + return &records[posn];2.41 + }2.42 + }2.43 + return &records[0]; // shouldn't happen2.44 }2.45 return NULL;2.46 }2.48 +xlat_recovery_record_t xlat_get_pre_recovery( void *code, void *native_pc )2.49 +{2.50 + if( code != NULL ) {2.51 + uintptr_t pc_offset = ((uint8_t *)native_pc) - ((uint8_t *)code);2.52 + xlat_cache_block_t block = BLOCK_FOR_CODE(code);2.53 + uint32_t count = block->recover_table_size;2.54 + xlat_recovery_record_t records = (xlat_recovery_record_t)(&block->code[block->recover_table_offset]);2.55 + uint32_t posn;2.56 + for( posn = 1; posn < count; posn++ ) {2.57 + if( records[posn].xlat_offset >= pc_offset ) {2.58 + return &records[posn-1];2.59 + }2.60 + }2.61 + return &records[count-1];2.62 + }2.63 + return NULL;2.64 +}2.65 +2.66 void **xlat_get_lut_entry( sh4addr_t address )2.67 {2.68 void **page = xlat_lut[XLAT_LUT_PAGE(address)];
3.1 --- a/src/sh4/xltcache.h Sat Aug 09 09:13:29 2008 +00003.2 +++ b/src/sh4/xltcache.h Sat Aug 09 10:48:03 2008 +00003.3 @@ -96,15 +96,27 @@3.4 void *xlat_get_code( sh4addr_t address );3.6 /**3.7 - * Retrieve the recovery record corresponding to the given3.8 + * Retrieve the post-instruction recovery record corresponding to the given3.9 * native address, or NULL if there is no recovery code for the address.3.10 * @param code The code block containing the recovery table.3.11 * @param native_pc A pointer that must be within the currently executing3.12 - * @param recover_after If TRUE, return the first record after the given pc, otherwise3.13 + * @param with_terminal If false, return NULL instead of the final block record.3.14 * return the first record before or equal to the given pc.3.15 * translation block.3.16 */3.17 -struct xlat_recovery_record *xlat_get_recovery( void *code, void *native_pc, gboolean recover_after );3.18 +struct xlat_recovery_record *xlat_get_post_recovery( void *code, void *native_pc, gboolean with_terminal );3.19 +3.20 +/**3.21 + * Retrieve the pre-instruction recovery record corresponding to the given3.22 + * native address, or NULL if there is no recovery code for the address.3.23 + * @param code The code block containing the recovery table.3.24 + * @param native_pc A pointer that must be within the currently executing3.25 + * @param with_terminal If false, return NULL instead of the final block record.3.26 + * return the first record before or equal to the given pc.3.27 + * translation block.3.28 + */3.29 +struct xlat_recovery_record *xlat_get_pre_recovery( void *code, void *native_pc );3.30 +3.32 /**3.33 * Retrieve the entry point for the translated code corresponding to the given
.