asdjkfhaskdjdf

This commit is contained in:
2026-05-25 17:14:11 +02:00
parent 3b7bdceabd
commit 670cc6cacd
8 changed files with 31 additions and 53 deletions
+20 -16
View File
@@ -52,18 +52,6 @@ bool Interpreter::MaybeAdvance() {
return false;
}
regs.push_to_stack_trace(regs.pc);
if ((u32)regs.pc == 0x4) {
auto &regs = Core::GetRegs();
std::sort(regs.stack_trace.begin(), regs.stack_trace.end());
std::println("Stack trace:");
for (int i = 0; i < regs.stack_trace.size(); i++) {
std::println(" [{:016X}]", regs.stack_trace[i]);
}
exit(1);
}
regs.oldPC = regs.pc;
regs.pc = regs.nextPC;
regs.nextPC += 4;
@@ -105,6 +93,14 @@ u32 Interpreter::Step() {
DecodeExecute(instr);
if (!mem.mmio.rsp.spStatus.halt) {
rspSyncCount++;
if (rspSyncCount >= 3)
Scheduler::GetInstance().EnqueueRelative(0, RSP_STEP);
}
Scheduler::GetInstance().HandleEvents();
return 1;
}
@@ -142,7 +138,7 @@ void CachedState::EvictLine(u64 addr) {
u32 Interpreter::ExecuteCached() {
auto addr = regs.pc;
auto block_addr = addr;
auto blockAddr = addr;
auto line = cachedState.GetLine(addr);
if (line) {
@@ -153,8 +149,7 @@ u32 Interpreter::ExecuteCached() {
Instruction instr = line->code[i];
DecodeExecute(instr);
Core::GetInstance().StepRSP(1);
Scheduler::GetInstance().HandleEvents();
// Branch likely with false condition, it wasn't taken so don't execute the delay slot
if (IsBranchLikely(instr) && !regs.delaySlot)
break;
@@ -192,7 +187,16 @@ u32 Interpreter::ExecuteCached() {
}
}
cachedState.InsertLine(block_addr, std::make_shared<CachedLine>(code, i, i));
if (!mem.mmio.rsp.spStatus.halt) {
for (int j = 1; j <= (int)std::floor((double)i / 3); j++) {
Scheduler::GetInstance().EnqueueRelative(j * 3, RSP_STEP);
}
} else {
regs.steps = 0;
mem.mmio.rsp.steps = 0;
}
cachedState.InsertLine(blockAddr, std::make_shared<CachedLine>(code, i, i));
return ExecuteCached();
}