fix for tests?!?!?

This commit is contained in:
lizzie 2026-08-13 00:01:15 +00:00
parent d58ab98794
commit e52e920b14
2 changed files with 12 additions and 8 deletions

View file

@ -78,9 +78,13 @@ struct A64AddressSpace final {
struct A64Core final { struct A64Core final {
using CodeFn = HaltReason (*)(A64AddressSpace*, A64JitState*, volatile u32*, void *fn); using CodeFn = HaltReason (*)(A64AddressSpace*, A64JitState*, volatile u32*, void *fn);
static HaltReason Run(A64AddressSpace& process, A64JitState& thread_ctx, volatile u32* halt_reason) { static HaltReason Run(A64AddressSpace& process, A64JitState& thread_ctx, volatile u32* halt_reason) {
const auto loc = thread_ctx.GetLocationDescriptor(); HaltReason hr{};
const auto entry = process.GetOrEmit(loc); do {
return (CodeFn(entry))(&process, &thread_ctx, halt_reason, (void*)&A64Core::Run); const auto loc = thread_ctx.GetLocationDescriptor();
const auto entry = process.GetOrEmit(loc);
hr = (CodeFn(entry))(&process, &thread_ctx, halt_reason, (void*)&A64Core::Run);
} while (hr == HaltReason(0));
return hr;
} }
}; };

View file

@ -161,8 +161,6 @@ void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlock te
auto const tmp = ctx.reg_alloc.ScratchGpr(); auto const tmp = ctx.reg_alloc.ScratchGpr();
code.LI(tmp, terminal.next.Value()); code.LI(tmp, terminal.next.Value());
code.STD(tmp, PPC64::RJIT, offsetof(A64JitState, pc)); code.STD(tmp, PPC64::RJIT, offsetof(A64JitState, pc));
// code.MTCTR(powah::R6);
// code.BCTR();
code.B(ctx.l_return); code.B(ctx.l_return);
} else { } else {
auto const tmp = ctx.reg_alloc.ScratchGpr(); auto const tmp = ctx.reg_alloc.ScratchGpr();
@ -173,7 +171,7 @@ void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlock te
} }
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location, bool is_single_step) { void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
EmitTerminal(code, ctx, terminal, IR::Term::LinkBlock{terminal.next}, is_single_step); EmitTerminal(code, ctx, IR::Term::LinkBlock{terminal.next}, initial_location, is_single_step);
} }
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::PopRSBHint, IR::LocationDescriptor, bool) { void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::PopRSBHint, IR::LocationDescriptor, bool) {
@ -238,8 +236,7 @@ void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::Terminal con
EmittedBlockInfo EmitPPC64(powah::Context& code, IR::Block block, const EmitConfig& emit_conf) { EmittedBlockInfo EmitPPC64(powah::Context& code, IR::Block block, const EmitConfig& emit_conf) {
EmittedBlockInfo ebi; EmittedBlockInfo ebi;
RegAlloc reg_alloc{code}; RegAlloc reg_alloc{code};
EmitContext ctx{block, reg_alloc, emit_conf, ebi}; EmitContext ctx{block, reg_alloc, emit_conf, ebi, code.DefineLabel()};
size_t const stack_size = 112 + ABI_CALLEE_SAVED.size() * 8; size_t const stack_size = 112 + ABI_CALLEE_SAVED.size() * 8;
auto const start_offset = code.offset; auto const start_offset = code.offset;
ebi.entry_point = &code.base[start_offset]; ebi.entry_point = &code.base[start_offset];
@ -285,8 +282,11 @@ EmittedBlockInfo EmitPPC64(powah::Context& code, IR::Block block, const EmitConf
code.LD(gp_regs[i], powah::R1, -int32_t(gp_regs.size() - i) * 8); code.LD(gp_regs[i], powah::R1, -int32_t(gp_regs.size() - i) * 8);
code.LD(powah::R0, powah::R1, 16); code.LD(powah::R0, powah::R1, 16);
code.MTLR(powah::R0); code.MTLR(powah::R0);
code.LI(powah::R3, 0);
} else { } else {
EmitTerminal(code, ctx, ctx.block.GetTerminal(), ctx.block.Location(), false); EmitTerminal(code, ctx, ctx.block.GetTerminal(), ctx.block.Location(), false);
code.LABEL(ctx.l_return);
code.LI(powah::R3, 67); //non-zero ret
} }
code.BLR(); code.BLR();
code.ApplyRelocs(); code.ApplyRelocs();