mirror of https://github.com/xemu-project/xemu.git
mcpx/dsp: Migrate some DPRINTFs to trace events
This commit is contained in:
parent
31d8237ee3
commit
4b81c28901
|
@ -29,6 +29,7 @@
|
|||
#include "dsp_state.h"
|
||||
#include "dsp.h"
|
||||
#include "debug.h"
|
||||
#include "trace.h"
|
||||
|
||||
/* Defines */
|
||||
#define BITMASK(x) ((1<<(x))-1)
|
||||
|
@ -76,8 +77,6 @@ void dsp_destroy(DSPState* dsp)
|
|||
static uint32_t read_peripheral(dsp_core_t* core, uint32_t address) {
|
||||
DSPState* dsp = container_of(core, DSPState, core);
|
||||
|
||||
DPRINTF("read_peripheral 0x%06x", address);
|
||||
|
||||
uint32_t v = 0xababa;
|
||||
switch(address) {
|
||||
case 0xFFFFB3:
|
||||
|
@ -103,15 +102,13 @@ static uint32_t read_peripheral(dsp_core_t* core, uint32_t address) {
|
|||
break;
|
||||
}
|
||||
|
||||
DPRINTF(" -> 0x%06x\n", v);
|
||||
trace_dsp_read_peripheral(address, v);
|
||||
return v;
|
||||
}
|
||||
|
||||
static void write_peripheral(dsp_core_t* core, uint32_t address, uint32_t value) {
|
||||
DSPState* dsp = container_of(core, DSPState, core);
|
||||
|
||||
DPRINTF("write_peripheral [0x%06x] = 0x%06x\n", address, value);
|
||||
|
||||
switch(address) {
|
||||
case 0xFFFFC4:
|
||||
if (value & 1) {
|
||||
|
@ -137,6 +134,8 @@ static void write_peripheral(dsp_core_t* core, uint32_t address, uint32_t value)
|
|||
dsp_dma_write(&dsp->dma, DMA_CONFIGURATION, value);
|
||||
break;
|
||||
}
|
||||
|
||||
trace_dsp_write_peripheral(address, value);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "qemu/bswap.h"
|
||||
#include "dsp_cpu.h"
|
||||
#include "debug.h"
|
||||
#include "trace.h"
|
||||
|
||||
#define BITMASK(x) ((1<<(x))-1)
|
||||
|
||||
|
@ -583,21 +584,21 @@ static void disasm_reg_compare(dsp_core_t* dsp)
|
|||
|
||||
static const char* disasm_get_instruction_text(dsp_core_t* dsp)
|
||||
{
|
||||
const int len = sizeof(dsp->disasm_str_instr);
|
||||
|
||||
if (dsp->disasm_is_looping) {
|
||||
dsp->disasm_str_instr2[0] = 0;
|
||||
}
|
||||
if (dsp->disasm_cur_inst_len == 1) {
|
||||
snprintf(dsp->disasm_str_instr2, sizeof(dsp->disasm_str_instr2), "p:%04x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
snprintf(dsp->disasm_str_instr2, sizeof(dsp->disasm_str_instr2), "p:%04x %06x (%02d cyc) %s", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, dsp->instr_cycle, dsp->disasm_str_instr);
|
||||
} else {
|
||||
snprintf(dsp->disasm_str_instr2, sizeof(dsp->disasm_str_instr2), "p:%04x %06x %06x (%02d cyc) %-*s\n", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, read_memory_p(dsp, dsp->disasm_prev_inst_pc + 1), dsp->instr_cycle, len, dsp->disasm_str_instr);
|
||||
snprintf(dsp->disasm_str_instr2, sizeof(dsp->disasm_str_instr2), "p:%04x %06x %06x (%02d cyc) %s", dsp->disasm_prev_inst_pc, dsp->disasm_cur_inst, read_memory_p(dsp, dsp->disasm_prev_inst_pc + 1), dsp->instr_cycle, dsp->disasm_str_instr);
|
||||
}
|
||||
return dsp->disasm_str_instr2;
|
||||
}
|
||||
|
||||
void dsp56k_execute_instruction(dsp_core_t* dsp)
|
||||
{
|
||||
trace_dsp56k_execute_instruction(dsp->is_gp, dsp->pc);
|
||||
|
||||
uint32_t disasm_return = 0;
|
||||
dsp->disasm_memory_ptr = 0;
|
||||
|
||||
|
@ -608,11 +609,17 @@ void dsp56k_execute_instruction(dsp_core_t* dsp)
|
|||
dsp->cur_inst_len = 1;
|
||||
dsp->instr_cycle = 2;
|
||||
|
||||
bool tracing = TRACE_DSP_DISASM || trace_event_get_state(TRACE_DSP56K_EXECUTE_INSTRUCTION_DISASM);
|
||||
|
||||
/* Disasm current instruction ? (trace mode only) */
|
||||
if (TRACE_DSP_DISASM) {
|
||||
if (tracing) {
|
||||
disasm_return = disasm_instruction(dsp, DSP_TRACE_MODE);
|
||||
if (disasm_return) {
|
||||
DPRINTF("%s", disasm_get_instruction_text(dsp));
|
||||
const char *text = disasm_get_instruction_text(dsp);
|
||||
trace_dsp56k_execute_instruction_disasm(text);
|
||||
if (TRACE_DSP_DISASM) {
|
||||
DPRINTF("%s\n", text);
|
||||
}
|
||||
if (TRACE_DSP_DISASM_REG) {
|
||||
disasm_reg_save(dsp);
|
||||
}
|
||||
|
@ -637,7 +644,7 @@ void dsp56k_execute_instruction(dsp_core_t* dsp)
|
|||
}
|
||||
|
||||
/* Disasm current instruction ? (trace mode only) */
|
||||
if (TRACE_DSP_DISASM && disasm_return) {
|
||||
if (tracing && disasm_return) {
|
||||
if (TRACE_DSP_DISASM_REG) {
|
||||
disasm_reg_compare(dsp);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# See docs/devel/tracing.rst for syntax documentation.
|
||||
|
||||
# dsp.c
|
||||
dsp_read_peripheral(uint32_t addr, uint32_t val) "addr 0x%"PRIx32" val 0x%"PRIx32
|
||||
dsp_write_peripheral(uint32_t addr, uint32_t val) "addr 0x%"PRIx32" val 0x%"PRIx32
|
||||
|
||||
# dsp_cpu.c
|
||||
dsp56k_execute_instruction(uint32_t id, uint32_t pc) "[gp=%d]: pc=0x%"PRIx32
|
||||
dsp56k_execute_instruction_disasm(const char *disasm) "%s"
|
|
@ -0,0 +1 @@
|
|||
#include "trace/trace-hw_xbox_mcpx_dsp.h"
|
|
@ -3772,6 +3772,7 @@ if have_system
|
|||
'hw/remote',
|
||||
'hw/xbox/nv2a',
|
||||
'hw/xbox/mcpx',
|
||||
'hw/xbox/mcpx/dsp',
|
||||
'hw/xbox',
|
||||
]
|
||||
endif
|
||||
|
|
Loading…
Reference in New Issue