1.1 --- a/src/sh4/xltcache.c Sun Sep 16 06:59:47 2007 +0000
1.2 +++ b/src/sh4/xltcache.c Thu Sep 20 08:35:04 2007 +0000
1.5 - * $Id: xltcache.c,v 1.4 2007-09-16 06:59:47 nkeynes Exp $
1.6 + * $Id: xltcache.c,v 1.5 2007-09-20 08:35:04 nkeynes Exp $
1.8 * Translation cache management. This part is architecture independent.
1.14 +void xlat_print_free( FILE *out )
1.16 + fprintf( out, "New space: %d\nTemp space: %d\nOld space: %d\n",
1.17 + xlat_new_cache_ptr->size, xlat_temp_cache_ptr->size, xlat_old_cache_ptr->size );
1.21 * Reset the cache structure to its default state
1.23 @@ -110,10 +116,9 @@
1.27 -void xlat_flush_page( sh4addr_t address )
1.28 +static void xlat_flush_page_by_lut( void **page )
1.31 - void **page = xlat_lut[XLAT_LUT_PAGE(address)];
1.32 for( i=0; i<XLAT_LUT_PAGE_ENTRIES; i++ ) {
1.33 if( IS_ENTRY_POINT(page[i]) ) {
1.34 BLOCK_FOR_CODE(page[i])->active = 0;
1.35 @@ -122,6 +127,74 @@
1.39 +void xlat_invalidate_word( sh4addr_t addr )
1.42 + void **page = xlat_lut[XLAT_LUT_PAGE(addr)];
1.43 + if( page != NULL ) {
1.44 + int entry = XLAT_LUT_ENTRY(addr);
1.45 + if( page[entry] != NULL ) {
1.46 + xlat_flush_page_by_lut(page);
1.52 +void xlat_invalidate_long( sh4addr_t addr )
1.55 + void **page = xlat_lut[XLAT_LUT_PAGE(addr)];
1.56 + if( page != NULL ) {
1.57 + int entry = XLAT_LUT_ENTRY(addr);
1.58 + if( page[entry] != NULL || page[entry+1] != NULL ) {
1.59 + xlat_flush_page_by_lut(page);
1.65 +void xlat_invalidate_block( sh4addr_t address, size_t size )
1.68 + int entry_count = size >> 1; // words;
1.69 + uint32_t page_no = XLAT_LUT_PAGE(address);
1.70 + int entry = XLAT_LUT_ENTRY(address);
1.73 + void **page = xlat_lut[page_no];
1.74 + int page_entries = XLAT_LUT_PAGE_ENTRIES - entry;
1.75 + if( entry_count < page_entries ) {
1.76 + page_entries = entry_count;
1.78 + if( page != NULL ) {
1.79 + if( page_entries == XLAT_LUT_PAGE_ENTRIES ) {
1.80 + /* Overwriting the entire page anyway */
1.81 + xlat_flush_page_by_lut(page);
1.83 + for( i=entry; i<entry+page_entries; i++ ) {
1.84 + if( page[i] != NULL ) {
1.85 + xlat_flush_page_by_lut(page);
1.90 + entry_count -= page_entries;
1.93 + entry_count -= page_entries;
1.95 + } while( entry_count > 0 );
1.99 +void xlat_flush_page( sh4addr_t address )
1.101 + void **page = xlat_lut[XLAT_LUT_PAGE(address)];
1.102 + if( page != NULL ) {
1.103 + xlat_flush_page_by_lut(page);
1.107 void *xlat_get_code( sh4addr_t address )
1.109 void **page = xlat_lut[XLAT_LUT_PAGE(address)];