filename | src/xlat/xltcache.c |
changeset | 1091:186558374345 |
prev | 1003:7b2688cbbca3 |
next | 1126:1f2c7cdee73e |
author | nkeynes |
date | Tue Dec 15 08:46:37 2009 +1000 (14 years ago) |
permissions | -rw-r--r-- |
last change | Add side-by-side x86+sh4 disassembly output Print SH4 state information and disassembly of the current block when crashing. Fix delay slot instruction in conditional branch not being marked as a delay-slot instruction in the branch-not-taken path. Rename REG_* defines in cpu.h to avoid conflict with translation defs |
file | annotate | diff | log | raw |
1.1 --- a/src/xlat/xltcache.c Fri Mar 27 06:13:34 2009 +00001.2 +++ b/src/xlat/xltcache.c Tue Dec 15 08:46:37 2009 +10001.3 @@ -486,6 +486,44 @@1.4 assert( foundptr == 1 || tail == ptr );1.5 }1.7 +/**1.8 + * Sanity check that the given pointer is at least contained in one of cache1.9 + * regions, and has a sane-ish size. We don't do a full region walk atm.1.10 + */1.11 +gboolean xlat_is_code_pointer( void *p )1.12 +{1.13 + char *region;1.14 + uintptr_t region_size;1.15 +1.16 + xlat_cache_block_t block = XLAT_BLOCK_FOR_CODE(p);1.17 + if( (((char *)block) - (char *)xlat_new_cache) < XLAT_NEW_CACHE_SIZE ) {1.18 + /* Pointer is in new cache */1.19 + region = (char *)xlat_new_cache;1.20 + region_size = XLAT_NEW_CACHE_SIZE;1.21 + }1.22 +#ifdef XLAT_GENERATIONAL_CACHE1.23 + else if( (((char *)block) - (char *)xlat_temp_cache) < XLAT_TEMP_CACHE_SIZE ) {1.24 + /* Pointer is in temp cache */1.25 + region = (char *)xlat_temp_cache;1.26 + region_size = XLAT_TEMP_CACHE_SIZE;1.27 + } else if( (((char *)block) - (char *)xlat_odl_cache) < XLAT_OLD_CACHE_SIZE ) {1.28 + /* Pointer is in old cache */1.29 + region = (char *)xlat_old_cache;1.30 + region_size = XLAT_OLD_CACHE_SIZE;1.31 + }1.32 +#endif1.33 + else {1.34 + /* Not a valid cache pointer */1.35 + return FALSE;1.36 + }1.37 +1.38 + /* Make sure the whole block is in the region */1.39 + if( (((char *)p) - region) >= region_size ||1.40 + (((char *)(NEXT(block))) - region) >= region_size )1.41 + return FALSE;1.42 + return TRUE;1.43 +}1.44 +1.45 void xlat_check_integrity( )1.46 {1.47 xlat_check_cache_integrity( xlat_new_cache, xlat_new_cache_ptr, XLAT_NEW_CACHE_SIZE );
.