Things to neat up that I noticed with Hazel <3

This commit is contained in:
SimoZ64
2025-07-29 22:46:34 +02:00
parent 01d05ca8fd
commit ff4cd66bdb
14 changed files with 104 additions and 72 deletions

View File

@@ -107,8 +107,26 @@ int JIT::Step() {
trace("\tMIPS code (guest PC = 0x{:016X}):", blockPC);
while (!instrEndsBlock) {
// CheckCompareInterrupt();
paddr = 0;
instruction = FetchInstruction();
if (check_address_error(0b11, u64(blockPC))) [[unlikely]] {
/*regs.cop0.HandleTLBException(blockPC);
regs.cop0.FireException(ExceptionCode::AddressErrorLoad, 0, blockPC);
return 1;*/
panic("[JIT]: Unhandled exception ADL due to unaligned PC virtual value! (0x{:016X})", blockPC);
}
if (!regs.cop0.MapVAddr(Cop0::LOAD, blockPC, paddr)) {
/*regs.cop0.HandleTLBException(blockPC);
regs.cop0.FireException(Cop0::GetTLBExceptionCode(regs.cop0.tlbError, Cop0::LOAD), 0, blockPC);
return 1;*/
panic(
"[JIT]: Unhandled exception TLB exception {} when retrieving PC physical address! (virtual: 0x{:016X})",
static_cast<int>(Cop0::GetTLBExceptionCode(regs.cop0.tlbError, Cop0::LOAD)), static_cast<u64>(blockPC));
}
instruction = mem.Read<u32>(paddr);
instructionsInBlock++;
blockOldPC = blockPC;
@@ -118,17 +136,9 @@ int JIT::Step() {
if((instrEndsBlock = InstrEndsBlock(instruction)))
continue;
/*u32 bswapped = std::byteswap(instruction);
auto count = cs_disasm(disassemblerMips, reinterpret_cast<const u8 *>(&bswapped), 4, blockPC, 0, &insn);
trace("{}", Disassembler::GetInstance().DisassembleSimple(paddr, instruction).full);
if (count > 0) {
trace("\t\t0x{:016X}:\t{}\t\t{}\n", insn->address, insn->mnemonic, insn->op_str);
cs_free(insn, count);
} else {
trace("\t\tCould not disassemble 0x{:08X} due to error {}\n", instruction, (int)cs_errno(disassemblerMips));
}
if(ShouldServiceInterrupt()) {
/*if(ShouldServiceInterrupt()) {
regs.cop0.FireException(ExceptionCode::Interrupt, 0, blockPC);
return 1;
}*/