i'll have to rethink the branches and jumps

This commit is contained in:
irisz64
2025-07-06 20:31:42 +02:00
parent 451ff7c4aa
commit 46c2aa2994
3 changed files with 22 additions and 22 deletions

View File

@@ -82,7 +82,7 @@ int JIT::Step() {
code.push(code.rbp); code.push(code.rbp);
code.mov(code.rbp, reinterpret_cast<uintptr_t>(this)); // Load context pointer code.mov(code.rbp, reinterpret_cast<uintptr_t>(this)); // Load context pointer
cs_insn *insn; //cs_insn *insn;
Util::trace("\tMIPS code (guest PC = 0x{:016X}):", blockPC); Util::trace("\tMIPS code (guest PC = 0x{:016X}):", blockPC);
while (!instrInDelaySlot) { while (!instrInDelaySlot) {
// CheckCompareInterrupt(); // CheckCompareInterrupt();
@@ -106,7 +106,7 @@ int JIT::Step() {
const u32 instruction = mem.Read<u32>(regs, paddr); const u32 instruction = mem.Read<u32>(regs, paddr);
u32 bswapped = bswap(instruction); /*u32 bswapped = bswap(instruction);
auto count = cs_disasm(disassemblerMips, reinterpret_cast<const u8 *>(&bswapped), 4, blockPC, 0, &insn); auto count = cs_disasm(disassemblerMips, reinterpret_cast<const u8 *>(&bswapped), 4, blockPC, 0, &insn);
if (count > 0) { if (count > 0) {
@@ -116,7 +116,7 @@ int JIT::Step() {
Util::trace("\t\tCould not disassemble 0x{:08X} due to error {}\n", instruction, (int)cs_errno(disassemblerMips)); Util::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); regs.cop0.FireException(ExceptionCode::Interrupt, 0, blockPC);
return 1; return 1;
}*/ }*/
@@ -150,23 +150,24 @@ int JIT::Step() {
code.mov(code.rax, blockPC); code.mov(code.rax, blockPC);
code.mov(REG(qword, pc), code.rax); code.mov(REG(qword, pc), code.rax);
} }
code.mov(code.rax, instructionsInBlock); code.mov(code.rax, instructionsInBlock);
code.pop(code.rbp); code.pop(code.rbp);
code.add(code.rsp, 8); code.add(code.rsp, 8);
code.ret(); code.ret();
code.setProtectModeRE(); code.setProtectModeRE();
static auto blockInfoSize = 0; //static auto blockInfoSize = 0;
blockInfoSize = code.getSize() - blockInfoSize; //blockInfoSize = code.getSize() - blockInfoSize;
Util::trace("\tX86 code (block address = 0x{:016X}):", (uintptr_t)block); //Util::trace("\tX86 code (block address = 0x{:016X}):", (uintptr_t)block);
auto count = cs_disasm(disassemblerX86, blockInfo, blockInfoSize, (uintptr_t)block, 0, &insn); //auto count = cs_disasm(disassemblerX86, blockInfo, blockInfoSize, (uintptr_t)block, 0, &insn);
if (count > 0) { //if (count > 0) {
for (size_t j = 0; j < count; j++) { // for (size_t j = 0; j < count; j++) {
Util::trace("\t\t0x{:016X}:\t{}\t\t{}\n", insn[j].address, insn[j].mnemonic, insn[j].op_str); // Util::trace("\t\t0x{:016X}:\t{}\t\t{}\n", insn[j].address, insn[j].mnemonic, insn[j].op_str);
} // }
//
cs_free(insn, count); // cs_free(insn, count);
} //}
// const auto dump = code.getCode(); // const auto dump = code.getCode();
// Util::WriteFileBinary(dump, code.getSize(), "jit.dump"); // Util::WriteFileBinary(dump, code.getSize(), "jit.dump");
// Util::panic(""); // Util::panic("");

View File

@@ -89,24 +89,24 @@ union FloatingPointReg {
struct { struct {
s32 int32; s32 int32;
s32 int32h; s32 int32h;
} __attribute__((__packed__)); };
struct { struct {
u32 uint32; u32 uint32;
u32 uint32h; u32 uint32h;
} __attribute__((__packed__)); };
struct { struct {
s64 int64; s64 int64;
} __attribute__((__packed__)); };
struct { struct {
u64 uint64; u64 uint64;
} __attribute__((__packed__)); };
struct { struct {
float float32; float float32;
float float32h; float float32h;
} __attribute__((__packed__)); };
struct { struct {
double float64; double float64;
} __attribute__((__packed__)); };
}; };
struct Interpreter; struct Interpreter;

View File

@@ -38,8 +38,7 @@ void KaizenGui::FileDialog() {
NFD::Guard guard; NFD::Guard guard;
NFD::UniquePath path; NFD::UniquePath path;
static const std::vector<nfdfilteritem_t> filterItems = { static const std::vector<nfdfilteritem_t> filterItems = {
{"Nintendo 64 rom archive", "rar,RAR,tar,TAR,zip,ZIP,7z,7Z"}, {"Nintendo 64 rom or rom archive", "rar,RAR,tar,TAR,zip,ZIP,7z,7Z,n64,z64,v64,N64,Z64,V64"}
{"Nintendo 64 rom", "n64,z64,v64,N64,Z64,V64"}
}; };
auto result = NFD::OpenDialog(path, filterItems.data(), filterItems.size()); auto result = NFD::OpenDialog(path, filterItems.data(), filterItems.size());