revision 1214:49152b3d8b75
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1214:49152b3d8b75 |
parent | 1213:d5ea3e98557b |
child | 1215:b697c55a37ad |
author | nkeynes |
date | Mon Feb 13 12:27:09 2012 +1000 (10 years ago) |
Setup the unlink_blocks function via a callback, rather than calling
directly into sh4/x86 code from xltcache
directly into sh4/x86 code from xltcache
![]() | src/sh4/sh4x86.in | view | annotate | diff | log | |
![]() | src/xlat/xltcache.c | view | annotate | diff | log | |
![]() | src/xlat/xltcache.h | view | annotate | diff | log |
1.1 --- a/src/sh4/sh4x86.in Mon Feb 13 12:26:01 2012 +10001.2 +++ b/src/sh4/sh4x86.in Mon Feb 13 12:27:09 2012 +10001.3 @@ -122,6 +122,7 @@1.4 static uint32_t trunc_fcw = 0x0F7F; /* fcw value for truncation mode */1.6 static void FASTCALL sh4_translate_get_code_and_backpatch( uint32_t pc );1.7 +static void sh4_x86_translate_unlink_block( void *use_list );1.9 static struct x86_symbol x86_symbol_table[] = {1.10 { "sh4r+128", ((char *)&sh4r)+128 },1.11 @@ -144,6 +145,10 @@1.12 { "xlat_get_code", xlat_get_code }1.13 };1.15 +static struct xlat_target_fns x86_target_fns = {1.16 + sh4_x86_translate_unlink_block1.17 +};1.18 +1.20 gboolean is_sse3_supported()1.21 {1.22 @@ -175,6 +180,7 @@1.23 sh4_x86.sse3_enabled = is_sse3_supported();1.24 x86_disasm_init();1.25 x86_set_symtab( x86_symbol_table, sizeof(x86_symbol_table)/sizeof(struct x86_symbol) );1.26 + xlat_set_target_fns(x86_target_fns);1.27 }1.29 void sh4_translate_set_callbacks( xlat_block_begin_callback_t begin, xlat_block_end_callback_t end )1.30 @@ -652,7 +658,7 @@1.32 }1.34 -void sh4_translate_unlink_block( void *use_list )1.35 +static void sh4_x86_translate_unlink_block( void *use_list )1.36 {1.37 uint8_t *tmp = xlat_output; /* In case something is active, which should never happen */1.38 void *next = use_list;
2.1 --- a/src/xlat/xltcache.c Mon Feb 13 12:26:01 2012 +10002.2 +++ b/src/xlat/xltcache.c Mon Feb 13 12:27:09 2012 +10002.3 @@ -69,6 +69,7 @@2.5 static void **xlat_lut[XLAT_LUT_PAGES];2.6 static gboolean xlat_initialized = FALSE;2.7 +static xlat_target_fns_t xlat_target = NULL;2.9 void xlat_cache_init(void)2.10 {2.11 @@ -93,6 +94,11 @@2.12 xlat_flush_cache();2.13 }2.15 +void xlat_set_target_fns( xlat_target_fns_t target )2.16 +{2.17 + xlat_target = target;2.18 +}2.19 +2.20 /**2.21 * Reset the cache structure to its default state2.22 */2.23 @@ -131,7 +137,8 @@2.24 {2.25 block->active = 0;2.26 *block->lut_entry = block->chain;2.27 - sh4_translate_unlink_block( block->use_list );2.28 + if( block->use_list != NULL )2.29 + xlat_target->unlink_block(block->use_list);2.30 }2.32 static void xlat_flush_page_by_lut( void **page )
3.1 --- a/src/xlat/xltcache.h Mon Feb 13 12:26:01 2012 +10003.2 +++ b/src/xlat/xltcache.h Mon Feb 13 12:27:09 2012 +10003.3 @@ -49,6 +49,10 @@3.4 unsigned char code[0];3.5 } __attribute__((packed));3.7 +typedef struct xlat_target_fns {3.8 + void (*unlink_block)(void *use_list);3.9 +} *xlat_target_fns_t;3.10 +3.11 typedef struct xlat_cache_block *xlat_cache_block_t;3.13 #define XLAT_BLOCK_FOR_CODE(code) (((xlat_cache_block_t)code)-1)3.14 @@ -63,6 +67,11 @@3.15 void xlat_cache_init(void);3.17 /**3.18 + * Setup target support.3.19 + */3.20 +void xlat_set_target_fns( xlat_target_fns_t target_fns );3.21 +3.22 +/**3.23 * Returns the next block in the new cache list that can be written to by the3.24 * translator.3.25 */
.