mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-09 21:31:24 +00:00
debugger: Use a named constant when we don't have a current instruction
This commit is contained in:
parent
7e93d2d169
commit
bf92b04d6c
@ -400,6 +400,9 @@ typedef enum {
|
|||||||
IS601,
|
IS601,
|
||||||
} field_601;
|
} field_601;
|
||||||
|
|
||||||
|
// Placeholder value for cases where we don't have a currently-executing instruction.
|
||||||
|
constexpr uint32_t NO_OPCODE = 0;
|
||||||
|
|
||||||
// Function prototypes
|
// Function prototypes
|
||||||
extern void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool include_601, uint64_t tb_freq);
|
extern void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, bool include_601, uint64_t tb_freq);
|
||||||
extern void ppc_mmu_init();
|
extern void ppc_mmu_init();
|
||||||
|
@ -1425,7 +1425,7 @@ public:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint64_t mem_read_dbg(uint32_t opcode, uint32_t virt_addr, uint32_t size) {
|
uint64_t mem_read_dbg(uint32_t virt_addr, uint32_t size) {
|
||||||
uint32_t save_dsisr, save_dar;
|
uint32_t save_dsisr, save_dar;
|
||||||
uint64_t ret_val;
|
uint64_t ret_val;
|
||||||
|
|
||||||
@ -1437,19 +1437,19 @@ uint64_t mem_read_dbg(uint32_t opcode, uint32_t virt_addr, uint32_t size) {
|
|||||||
try {
|
try {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 1:
|
case 1:
|
||||||
ret_val = mmu_read_vmem<uint8_t>(opcode, virt_addr);
|
ret_val = mmu_read_vmem<uint8_t>(NO_OPCODE, virt_addr);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ret_val = mmu_read_vmem<uint16_t>(opcode, virt_addr);
|
ret_val = mmu_read_vmem<uint16_t>(NO_OPCODE, virt_addr);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
ret_val = mmu_read_vmem<uint32_t>(opcode, virt_addr);
|
ret_val = mmu_read_vmem<uint32_t>(NO_OPCODE, virt_addr);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
ret_val = mmu_read_vmem<uint64_t>(opcode, virt_addr);
|
ret_val = mmu_read_vmem<uint64_t>(NO_OPCODE, virt_addr);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret_val = mmu_read_vmem<uint8_t>(opcode, virt_addr);
|
ret_val = mmu_read_vmem<uint8_t>(NO_OPCODE, virt_addr);
|
||||||
}
|
}
|
||||||
} catch (std::invalid_argument& exc) {
|
} catch (std::invalid_argument& exc) {
|
||||||
/* restore MMU-related CPU state */
|
/* restore MMU-related CPU state */
|
||||||
|
@ -125,7 +125,7 @@ extern void mmu_change_mode(void);
|
|||||||
extern void mmu_pat_ctx_changed();
|
extern void mmu_pat_ctx_changed();
|
||||||
extern void tlb_flush_entry(uint32_t ea);
|
extern void tlb_flush_entry(uint32_t ea);
|
||||||
|
|
||||||
extern uint64_t mem_read_dbg(uint32_t opcode, uint32_t virt_addr, uint32_t size);
|
extern uint64_t mem_read_dbg(uint32_t virt_addr, uint32_t size);
|
||||||
uint8_t *mmu_translate_imem(uint32_t vaddr, uint32_t *paddr = nullptr);
|
uint8_t *mmu_translate_imem(uint32_t vaddr, uint32_t *paddr = nullptr);
|
||||||
bool mmu_translate_dbg(uint32_t guest_va, uint32_t &guest_pa);
|
bool mmu_translate_dbg(uint32_t guest_va, uint32_t &guest_pa);
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ static uint32_t disasm_68k(uint32_t count, uint32_t address) {
|
|||||||
for (; power_on && count > 0; count--) {
|
for (; power_on && count > 0; count--) {
|
||||||
/* prefetch opcode bytes (a 68k instruction can occupy 2...10 bytes) */
|
/* prefetch opcode bytes (a 68k instruction can occupy 2...10 bytes) */
|
||||||
for (int i = 0; i < sizeof(code); i++) {
|
for (int i = 0; i < sizeof(code); i++) {
|
||||||
code[i] = mem_read_dbg(0, address + i, 1);
|
code[i] = mem_read_dbg(address + i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t *code_ptr = code;
|
const uint8_t *code_ptr = code;
|
||||||
@ -174,7 +174,7 @@ void exec_single_68k()
|
|||||||
|
|
||||||
/* calculate address of the current opcode table entry as follows:
|
/* calculate address of the current opcode table entry as follows:
|
||||||
get_word(68k_PC) * entry_size + table_base */
|
get_word(68k_PC) * entry_size + table_base */
|
||||||
cur_instr_tab_entry = mmu_read_vmem<uint16_t>(0, cur_68k_pc) * 8 + emu_table_virt;
|
cur_instr_tab_entry = mmu_read_vmem<uint16_t>(NO_OPCODE, cur_68k_pc) * 8 + emu_table_virt;
|
||||||
|
|
||||||
/* grab the PPC PC too */
|
/* grab the PPC PC too */
|
||||||
ppc_pc = get_reg(string("PC"));
|
ppc_pc = get_reg(string("PC"));
|
||||||
@ -314,7 +314,7 @@ static void dump_mem(string& params) {
|
|||||||
cout << endl;
|
cout << endl;
|
||||||
chars_per_line = 0;
|
chars_per_line = 0;
|
||||||
}
|
}
|
||||||
val = mem_read_dbg(0, addr, cell_size);
|
val = mem_read_dbg(addr, cell_size);
|
||||||
if (is_char) {
|
if (is_char) {
|
||||||
cout << (char)val;
|
cout << (char)val;
|
||||||
chars_per_line += cell_size;
|
chars_per_line += cell_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user