revision 919:dfa21f43925b
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 919:dfa21f43925b |
parent | 918:7ab30c886553 |
child | 920:1e6a29649b56 |
author | nkeynes |
date | Thu Dec 04 09:05:56 2008 +0000 (15 years ago) |
Fixup testsh4x86 to actually work (as opposed to just barely compiling)
1.1 --- a/src/test/testsh4x86.c Sat Nov 08 00:12:14 2008 +00001.2 +++ b/src/test/testsh4x86.c Thu Dec 04 09:05:56 2008 +00001.3 @@ -50,12 +50,27 @@1.4 char *inbuf;1.6 struct x86_symbol local_symbols[] = {1.7 - { "_sh4_read_byte", sh4_read_byte },1.8 - { "_sh4_read_word", sh4_read_word },1.9 - { "_sh4_read_long", sh4_read_long },1.10 - { "_sh4_write_byte", sh4_write_byte },1.11 - { "_sh4_write_word", sh4_write_word },1.12 - { "_sh4_write_long", sh4_write_long }1.13 + { "sh4r+128", ((char *)&sh4r)+128 },1.14 + { "sh4_cpu_period", &sh4_cpu_period },1.15 + { "mmu_vma_to_phys_read", mmu_vma_to_phys_read },1.16 + { "mmu_vma_to_phys_write", mmu_vma_to_phys_write },1.17 + { "sh4_write_fpscr", sh4_write_fpscr },1.18 + { "sh4_write_sr", sh4_write_sr },1.19 + { "sh4_read_sr", sh4_read_sr },1.20 + { "sh4_sleep", sh4_sleep },1.21 + { "sh4_fsca", sh4_fsca },1.22 + { "sh4_ftrv", sh4_ftrv },1.23 + { "sh4_switch_fr_banks", sh4_switch_fr_banks },1.24 + { "sh4_execute_instruction", sh4_execute_instruction },1.25 + { "signsat48", signsat48 },1.26 + { "sh4_read_byte", sh4_read_byte },1.27 + { "sh4_read_word", sh4_read_word },1.28 + { "sh4_read_long", sh4_read_long },1.29 + { "sh4_write_byte", sh4_write_byte },1.30 + { "sh4_write_word", sh4_write_word },1.31 + { "sh4_write_long", sh4_write_long },1.32 + { "xlat_get_code_by_vma", xlat_get_code_by_vma },1.33 + { "xlat_get_code", xlat_get_code }1.34 };1.36 int32_t FASTCALL sh4_read_byte( uint32_t addr )1.37 @@ -157,6 +172,9 @@1.38 exit(1);1.39 }1.41 + mmio_region_MMU.mem = malloc(4096);1.42 + memset( mmio_region_MMU.mem, 0, 4096 );1.43 +1.44 in = fopen( input_file, "ro" );1.45 if( in == NULL ) {1.46 perror( "Unable to open input file" );1.47 @@ -165,18 +183,22 @@1.48 fstat( fileno(in), &st );1.49 inbuf = malloc( st.st_size );1.50 fread( inbuf, st.st_size, 1, in );1.51 + sh4_icache.mask = 0xFFFFF000;1.52 + sh4_icache.page_vma = start_addr & 0xFFFFF000;1.53 + sh4_icache.page = (unsigned char *)(inbuf - (sh4_icache.page_vma&0xFFF));1.54 + sh4_icache.page_ppa = start_addr & 0xFFFFF000;1.56 xlat_cache_init();1.57 uint32_t pc;1.58 uint8_t *buf = sh4_translate_basic_block( start_addr );1.59 - uint32_t buflen = xlat_get_block_size(buf);1.60 + uint32_t buflen = xlat_get_code_size(buf);1.61 x86_disasm_init( buf, 0x8c010000, buflen );1.62 - x86_set_symtab( local_symbols, 6 );1.63 + x86_set_symtab( local_symbols, sizeof(local_symbols)/sizeof(struct x86_symbol) );1.64 for( pc = 0x8c010000; pc < 0x8c010000 + buflen; ) {1.65 char buf[256];1.66 char op[256];1.67 uint32_t pc2 = x86_disasm_instruction( pc, buf, sizeof(buf), op );1.68 - fprintf( stdout, "%08X: %-20s %s\n", pc, op, buf );1.69 + fprintf( stdout, "%s\n", buf );1.70 pc = pc2;1.71 }1.72 return 0;
.