fix stuff
This commit is contained in:
@@ -146,7 +146,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;
|
||||||
info("\tMIPS code (guest PC = 0x{:016X}):", blockPC);
|
info("\tMIPS code (guest PC = 0x{:016X}):", blockPC);
|
||||||
while (!instrEndsBlock) {
|
while (!instrEndsBlock) {
|
||||||
// CheckCompareInterrupt();
|
// CheckCompareInterrupt();
|
||||||
@@ -224,20 +224,18 @@ int JIT::Step() {
|
|||||||
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;
|
||||||
|
|
||||||
//trace("\tX86 code (block address = 0x{:016X}):", (uintptr_t)block);
|
info("\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++) {
|
||||||
// trace("\t\t0x{:016X}:\t{}\t\t{}\n", insn[j].address, insn[j].mnemonic, insn[j].op_str);
|
info("\t\t0x{:016X}:\t{}\t\t{}", insn[j].address, insn[j].mnemonic, insn[j].op_str);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// cs_free(insn, count);
|
cs_free(insn, count);
|
||||||
//}
|
}
|
||||||
// const auto dump = code.getCode();
|
|
||||||
// Util::WriteFileBinary(dump, code.getSize(), "jit.dump");
|
|
||||||
// panic("");
|
// panic("");
|
||||||
return block();
|
return block();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ static constexpr u32 kUpperSize = kAddressSpaceSize >> kUpperShift; // 0x800000
|
|||||||
static constexpr u32 kLowerSize = 0x100; // 0x80
|
static constexpr u32 kLowerSize = 0x100; // 0x80
|
||||||
static constexpr u32 kCodeCacheSize = 32_mb;
|
static constexpr u32 kCodeCacheSize = 32_mb;
|
||||||
static constexpr u32 kCodeCacheAllocSize = kCodeCacheSize + 4_kb;
|
static constexpr u32 kCodeCacheAllocSize = kCodeCacheSize + 4_kb;
|
||||||
#define REG(acc, x) code.acc[code.rbp + (reinterpret_cast<uintptr_t>(®s.x) - (uintptr_t)this)]
|
#define REG(acc, x) code.acc[reinterpret_cast<uintptr_t>(®s.x)]
|
||||||
|
|
||||||
#ifdef __aarch64__
|
#ifdef __aarch64__
|
||||||
struct JIT : BaseCPU {};
|
struct JIT : BaseCPU {};
|
||||||
@@ -51,13 +51,13 @@ private:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
Xbyak::Address GPR(const size_t index) const {
|
Xbyak::Address GPR(const size_t index) const {
|
||||||
if constexpr (sizeof(T) == 1) {
|
if constexpr (sizeof(T) == 1) {
|
||||||
return code.byte[code.rbp + (reinterpret_cast<uintptr_t>(®s.gpr[index]) - reinterpret_cast<uintptr_t>(this))];
|
return code.byte[reinterpret_cast<uintptr_t>(®s.gpr[index])];
|
||||||
} else if constexpr (sizeof(T) == 2) {
|
} else if constexpr (sizeof(T) == 2) {
|
||||||
return code.word[code.rbp + (reinterpret_cast<uintptr_t>(®s.gpr[index]) - reinterpret_cast<uintptr_t>(this))];
|
return code.word[reinterpret_cast<uintptr_t>(®s.gpr[index])];
|
||||||
} else if constexpr (sizeof(T) == 4) {
|
} else if constexpr (sizeof(T) == 4) {
|
||||||
return code.dword[code.rbp + (reinterpret_cast<uintptr_t>(®s.gpr[index]) - reinterpret_cast<uintptr_t>(this))];
|
return code.dword[reinterpret_cast<uintptr_t>(®s.gpr[index])];
|
||||||
} else if constexpr (sizeof(T) == 8) {
|
} else if constexpr (sizeof(T) == 8) {
|
||||||
return code.qword[code.rbp + (reinterpret_cast<uintptr_t>(®s.gpr[index]) - reinterpret_cast<uintptr_t>(this))];
|
return code.qword[reinterpret_cast<uintptr_t>(®s.gpr[index])];
|
||||||
}
|
}
|
||||||
|
|
||||||
Util::Error::GetInstance().Throw(
|
Util::Error::GetInstance().Throw(
|
||||||
|
|||||||
Reference in New Issue
Block a user