mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-19 23:38:55 +02:00
fix %rbp
This commit is contained in:
parent
c0d75a5906
commit
0700a602e4
3 changed files with 13 additions and 18 deletions
|
|
@ -117,6 +117,8 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
|
||||||
// Start emitting.
|
// Start emitting.
|
||||||
code.align();
|
code.align();
|
||||||
const u8* const entrypoint = code.getCurr();
|
const u8* const entrypoint = code.getCurr();
|
||||||
|
code.mov(code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)], rbp);
|
||||||
|
code.lea(rbp, code.ptr[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer) - 8]);
|
||||||
|
|
||||||
EmitCondPrelude(ctx);
|
EmitCondPrelude(ctx);
|
||||||
|
|
||||||
|
|
@ -149,15 +151,14 @@ A32EmitX64::BlockDescriptor A32EmitX64::Emit(IR::Block& block) {
|
||||||
|
|
||||||
reg_alloc.AssertNoMoreUses();
|
reg_alloc.AssertNoMoreUses();
|
||||||
|
|
||||||
if (conf.enable_cycle_counting) {
|
if (conf.enable_cycle_counting)
|
||||||
EmitAddCycles(block.CycleCount());
|
EmitAddCycles(block.CycleCount());
|
||||||
}
|
code.mov(rbp, code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)]);
|
||||||
EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep());
|
EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep());
|
||||||
code.int3();
|
code.int3();
|
||||||
|
|
||||||
for (auto& deferred_emit : ctx.deferred_emits) {
|
for (auto& deferred_emit : ctx.deferred_emits)
|
||||||
deferred_emit();
|
deferred_emit();
|
||||||
}
|
|
||||||
code.int3();
|
code.int3();
|
||||||
|
|
||||||
const size_t size = size_t(code.getCurr() - entrypoint);
|
const size_t size = size_t(code.getCurr() - entrypoint);
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,8 @@ A64EmitX64::BlockDescriptor A64EmitX64::Emit(IR::Block& block) noexcept {
|
||||||
// Start emitting.
|
// Start emitting.
|
||||||
code.align();
|
code.align();
|
||||||
const auto* const entrypoint = code.getCurr();
|
const auto* const entrypoint = code.getCurr();
|
||||||
|
code.mov(code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)], rbp);
|
||||||
// code.mov(code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)], rbp);
|
code.lea(rbp, code.ptr[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer) - 8]);
|
||||||
// code.lea(rbp, code.ptr[rsp + ABI_SHADOW_SPACE - 8]);
|
|
||||||
|
|
||||||
DEBUG_ASSERT(block.GetCondition() == IR::Cond::AL);
|
DEBUG_ASSERT(block.GetCondition() == IR::Cond::AL);
|
||||||
typedef void (EmitX64::*EmitHandlerFn)(EmitContext& context, IR::Inst* inst);
|
typedef void (EmitX64::*EmitHandlerFn)(EmitContext& context, IR::Inst* inst);
|
||||||
|
|
@ -145,19 +144,13 @@ finish_this_inst:
|
||||||
}
|
}
|
||||||
|
|
||||||
reg_alloc.AssertNoMoreUses();
|
reg_alloc.AssertNoMoreUses();
|
||||||
|
if (conf.enable_cycle_counting)
|
||||||
if (conf.enable_cycle_counting) {
|
|
||||||
EmitAddCycles(block.CycleCount());
|
EmitAddCycles(block.CycleCount());
|
||||||
}
|
code.mov(rbp, code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)]);
|
||||||
|
|
||||||
//code.mov(rbp, code.qword[rsp + ABI_SHADOW_SPACE + offsetof(StackLayout, abi_base_pointer)]);
|
|
||||||
|
|
||||||
EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep());
|
EmitTerminal(block.GetTerminal(), ctx.Location().SetSingleStepping(false), ctx.IsSingleStep());
|
||||||
code.int3();
|
code.int3();
|
||||||
|
for (auto& deferred_emit : ctx.deferred_emits)
|
||||||
for (auto& deferred_emit : ctx.deferred_emits) {
|
|
||||||
deferred_emit();
|
deferred_emit();
|
||||||
}
|
|
||||||
code.int3();
|
code.int3();
|
||||||
|
|
||||||
const size_t size = size_t(code.getCurr() - entrypoint);
|
const size_t size = size_t(code.getCurr() - entrypoint);
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,13 @@ constexpr size_t SpillCount = 64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct alignas(16) StackLayout {
|
struct alignas(16) StackLayout {
|
||||||
u64 abi_base_pointer;
|
// Needs alignment for VMOV and XMM spills
|
||||||
|
alignas(16) std::array<std::array<u64, 2>, SpillCount> spill;
|
||||||
s64 cycles_remaining;
|
s64 cycles_remaining;
|
||||||
s64 cycles_to_run;
|
s64 cycles_to_run;
|
||||||
std::array<std::array<u64, 2>, SpillCount> spill;
|
|
||||||
u32 save_host_MXCSR;
|
u32 save_host_MXCSR;
|
||||||
bool check_bit;
|
bool check_bit;
|
||||||
|
u64 abi_base_pointer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue