Search
lxdream.org :: lxdream/src/sh4/xltcache.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/xltcache.c
changeset 376:8c7587af5a5d
prev366:6fb0d05152d7
next383:f597b73474cb
author nkeynes
date Wed Sep 12 09:16:47 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Add disassembly dump function to xltcache
file annotate diff log raw
1.1 --- a/src/sh4/xltcache.c Tue Sep 04 08:32:44 2007 +0000
1.2 +++ b/src/sh4/xltcache.c Wed Sep 12 09:16:47 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: xltcache.c,v 1.2 2007-09-04 08:32:44 nkeynes Exp $
1.6 + * $Id: xltcache.c,v 1.3 2007-09-12 09:16:47 nkeynes Exp $
1.7 *
1.8 * Translation cache management. This part is architecture independent.
1.9 *
1.10 @@ -54,24 +54,27 @@
1.11 xlat_cache_block_t xlat_old_cache_ptr;
1.12 static void ***xlat_lut;
1.13 static void **xlat_lut2; /* second-tier page info */
1.14 +static gboolean xlat_initialized = FALSE;
1.15
1.16 void xlat_cache_init()
1.17 {
1.18 - xlat_new_cache = mmap( NULL, XLAT_NEW_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.19 - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.20 - xlat_temp_cache = mmap( NULL, XLAT_TEMP_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.21 - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.22 - xlat_old_cache = mmap( NULL, XLAT_OLD_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.23 - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.24 - xlat_new_cache_ptr = xlat_new_cache;
1.25 - xlat_temp_cache_ptr = xlat_temp_cache;
1.26 - xlat_old_cache_ptr = xlat_old_cache;
1.27 - xlat_new_create_ptr = xlat_new_cache;
1.28 -
1.29 - xlat_lut = mmap( NULL, XLAT_LUT_PAGES*sizeof(void *), PROT_READ|PROT_WRITE,
1.30 - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
1.31 - memset( xlat_lut, 0, XLAT_LUT_PAGES*sizeof(void *) );
1.32 -
1.33 + if( !xlat_initialized ) {
1.34 + xlat_initialized = TRUE;
1.35 + xlat_new_cache = mmap( NULL, XLAT_NEW_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.36 + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.37 + xlat_temp_cache = mmap( NULL, XLAT_TEMP_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.38 + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.39 + xlat_old_cache = mmap( NULL, XLAT_OLD_CACHE_SIZE, PROT_EXEC|PROT_READ|PROT_WRITE,
1.40 + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0 );
1.41 + xlat_new_cache_ptr = xlat_new_cache;
1.42 + xlat_temp_cache_ptr = xlat_temp_cache;
1.43 + xlat_old_cache_ptr = xlat_old_cache;
1.44 + xlat_new_create_ptr = xlat_new_cache;
1.45 +
1.46 + xlat_lut = mmap( NULL, XLAT_LUT_PAGES*sizeof(void *), PROT_READ|PROT_WRITE,
1.47 + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
1.48 + memset( xlat_lut, 0, XLAT_LUT_PAGES*sizeof(void *) );
1.49 + }
1.50 xlat_flush_cache();
1.51 }
1.52
1.53 @@ -351,3 +354,11 @@
1.54 xlat_check_cache_integrity( xlat_temp_cache, xlat_temp_cache_ptr, XLAT_TEMP_CACHE_SIZE );
1.55 xlat_check_cache_integrity( xlat_old_cache, xlat_old_cache_ptr, XLAT_OLD_CACHE_SIZE );
1.56 }
1.57 +
1.58 +
1.59 +void xlat_disasm_block( FILE *out, void *block )
1.60 +{
1.61 + uint32_t buflen = xlat_get_block_size(block);
1.62 + x86_set_symtab( NULL, 0 );
1.63 + x86_disasm_block( out, block, buflen );
1.64 +}
.