mirror of
https://github.com/gopher64/gopher64.git
synced 2026-11-16 10:53:34 +01:00
emulate RSP SSTEP (#1350)
This commit is contained in:
1 parent
bc17f40213
commit
b4c19450b5
3 files changed
+14
-3
No files matched your search
@@ -166,7 +166,6 @@ pub fn reset_event(device: &mut device::Device) {
|
||||
device.cpu.cop0.regs[device::cop0::COP0_ERROREPC_REG] = device.cpu.pc;
|
||||
device.cpu.pc = 0xBFC00000;
|
||||
device.cpu.branch_state.state = device::cpu::State::Step;
|
||||
device.rsp.regs2[device::rsp_interface::SP_PC_REG] = 0;
|
||||
|
||||
device::pif::reset_pif(device, true);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ pub fn run(device: &mut device::Device) -> u64 {
|
||||
device.rsp.cpu.broken = false;
|
||||
device.rsp.cpu.cycle_counter = 0;
|
||||
device.rsp.cpu.running = true;
|
||||
while !device.rsp.cpu.sync_point {
|
||||
loop {
|
||||
device.rsp.cpu.instruction_type = InstructionType::Su;
|
||||
device.rsp.cpu.gpr[0] = 0; // gpr 0 is read only
|
||||
|
||||
@@ -188,6 +188,10 @@ pub fn run(device: &mut device::Device) -> u64 {
|
||||
device.rsp.cpu.pipeline_full = true;
|
||||
}
|
||||
}
|
||||
|
||||
if device.rsp.cpu.sync_point {
|
||||
break;
|
||||
}
|
||||
}
|
||||
device.rsp.cpu.running = false;
|
||||
elapsed_cpu_cycles(device)
|
||||
|
||||
@@ -363,6 +363,8 @@ pub fn write_regs2(device: &mut device::Device, address: u64, value: u32, mask:
|
||||
value & 0xFFC,
|
||||
mask,
|
||||
);
|
||||
// writing SP_PC resets the pipeline, discarding any pending branch
|
||||
device.rsp.cpu.branch_state.state = device::cpu::State::Step;
|
||||
}
|
||||
_ => device::memory::masked_write_32(&mut device.rsp.regs2[reg as usize], value, mask),
|
||||
}
|
||||
@@ -481,7 +483,8 @@ fn update_sp_status(device: &mut device::Device, w: u32) {
|
||||
}
|
||||
|
||||
fn do_task(device: &mut device::Device) {
|
||||
device.rsp.cpu.sync_point = false;
|
||||
// single-step mode: the burst ends after one instruction
|
||||
device.rsp.cpu.sync_point = device.rsp.regs[SP_STATUS_REG] & SP_STATUS_SSTEP != 0;
|
||||
device.rsp.last_status_value = 0;
|
||||
device.rdp.last_status_value = 0;
|
||||
if device.rsp.regs[SP_DMA_BUSY_REG] == 1 {
|
||||
@@ -513,6 +516,11 @@ pub fn rsp_event(device: &mut device::Device) {
|
||||
if device.rsp.regs[SP_STATUS_REG] & SP_STATUS_HALT != 0 {
|
||||
return;
|
||||
}
|
||||
// single-step mode: the RSP halts itself after each instruction
|
||||
if device.rsp.regs[SP_STATUS_REG] & SP_STATUS_SSTEP != 0 {
|
||||
device.rsp.regs[SP_STATUS_REG] |= SP_STATUS_HALT;
|
||||
return;
|
||||
}
|
||||
do_task(device)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user