Search
lxdream.org :: lxdream/src/xlat/xltcache.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/xlat/xltcache.c
changeset 1149:da6124fceec6
prev1126:1f2c7cdee73e
next1175:712c418cad83
author nkeynes
date Wed Nov 10 08:37:42 2010 +1000 (9 years ago)
permissions -rw-r--r--
last change Add chain pointer to the xlat cache, so that we can maintain multiple blocks
for the same address. This prevents thrashing in cases where we would other
keep retranslating the same blocks over and over again due to varying
xlat_sh4_mode values
file annotate diff log raw
1.1 --- a/src/xlat/xltcache.c Mon Sep 13 19:01:15 2010 +1000
1.2 +++ b/src/xlat/xltcache.c Wed Nov 10 08:37:42 2010 +1000
1.3 @@ -124,7 +124,12 @@
1.4 int i;
1.5 for( i=0; i<XLAT_LUT_PAGE_ENTRIES; i++ ) {
1.6 if( IS_ENTRY_POINT(page[i]) ) {
1.7 - XLAT_BLOCK_FOR_CODE(page[i])->active = 0;
1.8 + void *p = page[i];
1.9 + do {
1.10 + xlat_cache_block_t block = XLAT_BLOCK_FOR_CODE(p);
1.11 + block->active = 0;
1.12 + p = block->chain;
1.13 + } while( p != NULL );
1.14 }
1.15 page[i] = NULL;
1.16 }
1.17 @@ -306,6 +311,7 @@
1.18 start_block->active = 1;
1.19 start_block->size = allocation;
1.20 start_block->lut_entry = block->lut_entry;
1.21 + start_block->chain = block->chain;
1.22 start_block->fpscr_mask = block->fpscr_mask;
1.23 start_block->fpscr = block->fpscr;
1.24 start_block->recover_table_offset = block->recover_table_offset;
1.25 @@ -353,6 +359,7 @@
1.26 start_block->active = 1;
1.27 start_block->size = allocation;
1.28 start_block->lut_entry = block->lut_entry;
1.29 + start_block->chain = block->chain;
1.30 start_block->fpscr_mask = block->fpscr_mask;
1.31 start_block->fpscr = block->fpscr;
1.32 start_block->recover_table_offset = block->recover_table_offset;
1.33 @@ -398,8 +405,12 @@
1.34 }
1.35
1.36 if( IS_ENTRY_POINT(xlat_lut[XLAT_LUT_PAGE(address)][XLAT_LUT_ENTRY(address)]) ) {
1.37 - xlat_cache_block_t oldblock = XLAT_BLOCK_FOR_CODE(xlat_lut[XLAT_LUT_PAGE(address)][XLAT_LUT_ENTRY(address)]);
1.38 - oldblock->active = 0;
1.39 + void *p = xlat_lut[XLAT_LUT_PAGE(address)][XLAT_LUT_ENTRY(address)];
1.40 + xlat_cache_block_t oldblock = XLAT_BLOCK_FOR_CODE(p);
1.41 + assert( oldblock->active );
1.42 + xlat_new_create_ptr->chain = p;
1.43 + } else {
1.44 + xlat_new_create_ptr->chain = NULL;
1.45 }
1.46
1.47 xlat_lut[XLAT_LUT_PAGE(address)][XLAT_LUT_ENTRY(address)] =
1.48 @@ -419,6 +430,7 @@
1.49 int oldsize = xlat_new_create_ptr->size;
1.50 int size = oldsize + MIN_BLOCK_SIZE; /* minimum expansion */
1.51 void **lut_entry = xlat_new_create_ptr->lut_entry;
1.52 + void *chain = xlat_new_create_ptr->chain;
1.53 int allocation = (int)-sizeof(struct xlat_cache_block);
1.54 xlat_new_cache_ptr = xlat_new_cache;
1.55 do {
1.56 @@ -432,6 +444,7 @@
1.57 xlat_new_create_ptr->active = 1;
1.58 xlat_new_create_ptr->size = allocation;
1.59 xlat_new_create_ptr->lut_entry = lut_entry;
1.60 + xlat_new_create_ptr->chain = chain;
1.61 *lut_entry = &xlat_new_create_ptr->code;
1.62 memmove( xlat_new_create_ptr->code, olddata, oldsize );
1.63 } else {
.