Search
lxdream.org :: lxdream/src/sh4/sh4dasm.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/sh4/sh4dasm.c
changeset 597:87cbdf62aa35
prev595:02d86b836ef0
next669:ab344e42bca9
author nkeynes
date Tue Jan 22 09:45:21 2008 +0000 (12 years ago)
permissions -rw-r--r--
last change Initial VMA support for the SH4 disassembly
file annotate diff log raw
1.1 --- a/src/sh4/sh4dasm.c Mon Jan 21 11:54:47 2008 +0000
1.2 +++ b/src/sh4/sh4dasm.c Tue Jan 22 09:45:21 2008 +0000
1.3 @@ -43,14 +43,15 @@
1.4
1.5
1.6 const struct cpu_desc_struct sh4_cpu_desc =
1.7 - { "SH4", sh4_disasm_instruction, sh4_execute_instruction, mem_has_page,
1.8 + { "SH4", sh4_disasm_instruction, sh4_execute_instruction, sh4_has_page,
1.9 sh4_set_breakpoint, sh4_clear_breakpoint, sh4_get_breakpoint, 2,
1.10 (char *)&sh4r, sizeof(sh4r), sh4_reg_map,
1.11 &sh4r.pc };
1.12
1.13 -uint32_t sh4_disasm_instruction( uint32_t pc, char *buf, int len, char *opcode )
1.14 +uint32_t sh4_disasm_instruction( sh4vma_t pc, char *buf, int len, char *opcode )
1.15 {
1.16 - uint16_t ir = sh4_read_word(pc);
1.17 + sh4addr_t addr = mmu_vma_to_phys_disasm(pc);
1.18 + uint16_t ir = sh4_read_word(addr);
1.19
1.20 #define UNDEF(ir) snprintf( buf, len, "???? " );
1.21 #define RN(ir) ((ir&0x0F00)>>8)
1.22 @@ -1199,7 +1200,7 @@
1.23 case 0x9:
1.24 { /* MOV.W @(disp, PC), Rn */
1.25 uint32_t Rn = ((ir>>8)&0xF); uint32_t disp = (ir&0xFF)<<1;
1.26 - snprintf( buf, len, "MOV.W @($%xh), R%d ; <- #%08x", disp + pc + 4, Rn, sh4_read_word(disp+pc+4) );
1.27 + snprintf( buf, len, "MOV.W @($%xh), R%d ; <- #%08x", disp + pc + 4, Rn, sh4_read_word(disp+addr+4) );
1.28 }
1.29 break;
1.30 case 0xA:
1.31 @@ -1317,7 +1318,7 @@
1.32 case 0xD:
1.33 { /* MOV.L @(disp, PC), Rn */
1.34 uint32_t Rn = ((ir>>8)&0xF); uint32_t disp = (ir&0xFF)<<2;
1.35 - snprintf( buf, len, "MOV.L @($%xh), R%d ; <- #%08x", disp + (pc & 0xFFFFFFFC) + 4, Rn, sh4_read_long(disp+(pc&0xFFFFFFFC)+4) );
1.36 + snprintf( buf, len, "MOV.L @($%xh), R%d ; <- #%08x", disp + (pc & 0xFFFFFFFC) + 4, Rn, sh4_read_long(disp+(addr&0xFFFFFFFC)+4) );
1.37 }
1.38 break;
1.39 case 0xE:
.