verbose debugging: Ensure host fp state is preserved
This commit is contained in:
parent
fdd5192ab3
commit
890f01f036
4 changed files with 13 additions and 3 deletions
|
@ -17,6 +17,8 @@ using namespace oaknut::util;
|
||||||
|
|
||||||
void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx) {
|
void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx) {
|
||||||
code.SUB(SP, SP, sizeof(RegisterData));
|
code.SUB(SP, SP, sizeof(RegisterData));
|
||||||
|
code.MRS(X0, oaknut::SystemReg::FPSR);
|
||||||
|
code.STR(X0, SP, offsetof(RegisterData, fpsr));
|
||||||
for (int i = 0; i < 30; i++) {
|
for (int i = 0; i < 30; i++) {
|
||||||
if (i == 18) {
|
if (i == 18) {
|
||||||
continue; // Platform register
|
continue; // Platform register
|
||||||
|
@ -44,6 +46,8 @@ void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx) {
|
||||||
}
|
}
|
||||||
code.LDR(oaknut::XReg{i}, SP, offsetof(RegisterData, x) + i * sizeof(u64));
|
code.LDR(oaknut::XReg{i}, SP, offsetof(RegisterData, x) + i * sizeof(u64));
|
||||||
}
|
}
|
||||||
|
code.LDR(X0, SP, offsetof(RegisterData, fpsr));
|
||||||
|
code.MSR(oaknut::SystemReg::FPSR, X0);
|
||||||
code.ADD(SP, SP, sizeof(RegisterData));
|
code.ADD(SP, SP, sizeof(RegisterData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,4 +105,4 @@ void PrintVerboseDebuggingOutputLine(RegisterData& reg_data, HostLocType reg_typ
|
||||||
fmt::print("\n");
|
fmt::print("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::Arm64
|
} // namespace Dynarmic::Backend::Arm64
|
||||||
|
|
|
@ -46,6 +46,7 @@ struct alignas(16) RegisterData {
|
||||||
std::array<Vector, 32> q;
|
std::array<Vector, 32> q;
|
||||||
u32 nzcv;
|
u32 nzcv;
|
||||||
decltype(StackLayout::spill)* spill;
|
decltype(StackLayout::spill)* spill;
|
||||||
|
u32 fpsr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -55,4 +56,4 @@ struct alignas(16) RegisterData {
|
||||||
void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx);
|
void EmitVerboseDebuggingOutput(oaknut::CodeGenerator& code, EmitContext& ctx);
|
||||||
void PrintVerboseDebuggingOutputLine(RegisterData& reg_data, HostLocType reg_type, size_t reg_index, size_t inst_index, IR::Type inst_type);
|
void PrintVerboseDebuggingOutputLine(RegisterData& reg_data, HostLocType reg_type, size_t reg_index, size_t inst_index, IR::Type inst_type);
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::Arm64
|
} // namespace Dynarmic::Backend::Arm64
|
||||||
|
|
|
@ -105,6 +105,7 @@ void EmitX64::PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, I
|
||||||
|
|
||||||
void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& block) {
|
void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& block) {
|
||||||
code.sub(rsp, sizeof(RegisterData));
|
code.sub(rsp, sizeof(RegisterData));
|
||||||
|
code.stmxcsr(dword[rsp + offsetof(RegisterData, mxcsr)]);
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
if (rsp.getIdx() == i) {
|
if (rsp.getIdx() == i) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -128,6 +129,7 @@ void EmitX64::EmitVerboseDebuggingOutput(RegAlloc& reg_alloc, const IR::Block& b
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
code.movaps(Xbyak::Xmm{i}, xword[rsp + offsetof(RegisterData, xmms) + 2 * sizeof(u64) * i]);
|
code.movaps(Xbyak::Xmm{i}, xword[rsp + offsetof(RegisterData, xmms) + 2 * sizeof(u64) * i]);
|
||||||
}
|
}
|
||||||
|
code.ldmxcsr(dword[rsp + offsetof(RegisterData, mxcsr)]);
|
||||||
code.add(rsp, sizeof(RegisterData));
|
code.add(rsp, sizeof(RegisterData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,7 +400,9 @@ void EmitX64::ClearCache() {
|
||||||
|
|
||||||
void EmitX64::InvalidateBasicBlocks(const tsl::robin_set<IR::LocationDescriptor>& locations) {
|
void EmitX64::InvalidateBasicBlocks(const tsl::robin_set<IR::LocationDescriptor>& locations) {
|
||||||
code.EnableWriting();
|
code.EnableWriting();
|
||||||
SCOPE_EXIT { code.DisableWriting(); };
|
SCOPE_EXIT {
|
||||||
|
code.DisableWriting();
|
||||||
|
};
|
||||||
|
|
||||||
for (const auto& descriptor : locations) {
|
for (const auto& descriptor : locations) {
|
||||||
const auto it = block_descriptors.find(descriptor);
|
const auto it = block_descriptors.find(descriptor);
|
||||||
|
|
|
@ -25,6 +25,7 @@ struct alignas(16) RegisterData {
|
||||||
std::array<u64, 16> gprs;
|
std::array<u64, 16> gprs;
|
||||||
std::array<Vector, 16> xmms;
|
std::array<Vector, 16> xmms;
|
||||||
decltype(StackLayout::spill)* spill;
|
decltype(StackLayout::spill)* spill;
|
||||||
|
u32 mxcsr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
Loading…
Reference in a new issue