Browse Source

A64checkbit

Signed-off-by: lizzie <lizzie@eden-emu.dev>
dynarmic-ppc64
lizzie 2 months ago
parent
commit
12e0ecb440
No known key found for this signature in database GPG Key ID: 287378CADCAB13
  1. 1
      src/dynarmic/src/dynarmic/backend/ppc64/a32_core.h
  2. 1
      src/dynarmic/src/dynarmic/backend/ppc64/a64_core.h
  3. 26
      src/dynarmic/src/dynarmic/backend/ppc64/emit_ppc64.cpp
  4. 3
      src/dynarmic/src/dynarmic/backend/ppc64/emit_ppc64_a64.cpp

1
src/dynarmic/src/dynarmic/backend/ppc64/a32_core.h

@ -22,6 +22,7 @@ struct A32JitState {
u32 exclusive_state = 0;
u32 cpsr_nzcv = 0;
u32 fpscr = 0;
u8 check_bit = 0;
IR::LocationDescriptor GetLocationDescriptor() const {
return IR::LocationDescriptor{regs[15] | (u64(upper_location_descriptor) << 32)};
}

1
src/dynarmic/src/dynarmic/backend/ppc64/a64_core.h

@ -28,6 +28,7 @@ struct A64JitState {
u32 fpcr = 0;
u32 fpsr = 0;
volatile u32 halt_reason = 0;
u8 check_bit = 0;
IR::LocationDescriptor GetLocationDescriptor() const {
return IR::LocationDescriptor{regs[15] | (u64(upper_location_descriptor) << 32)};
}

26
src/dynarmic/src/dynarmic/backend/ppc64/emit_ppc64.cpp

@ -9,6 +9,8 @@
#include <fmt/ostream.h>
#include <mcl/bit/bit_field.hpp>
#include "a32_core.h"
#include "a64_core.h"
#include "abi.h"
#include "dynarmic/backend/ppc64/a32_core.h"
#include "dynarmic/backend/ppc64/a64_core.h"
@ -141,6 +143,8 @@ void EmitIR<IR::Opcode::NZCVFromPackedFlags>(powah::Context&, EmitContext&, IR::
}
namespace {
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::Terminal terminal, IR::LocationDescriptor initial_location, bool is_single_step);
void EmitTerminal(powah::Context&, EmitContext&, IR::Term::Interpret, IR::LocationDescriptor, bool) {
ASSERT(false && "unimp");
}
@ -151,13 +155,11 @@ void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::ReturnToDisp
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlock terminal, IR::LocationDescriptor initial_location, bool) {
auto const tmp = ctx.reg_alloc.ScratchGpr();
if (ctx.emit_conf.a64_variant) {
code.LI(tmp, terminal.next.Value());
code.LI(tmp, terminal.next.Value());
if (ctx.emit_conf.a64_variant)
code.STD(tmp, PPC64::RJIT, offsetof(A64JitState, pc));
} else {
code.LI(tmp, terminal.next.Value());
else
code.STW(tmp, PPC64::RJIT, offsetof(A32JitState, regs) + sizeof(u32) * 15);
}
}
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location, bool) {
@ -177,7 +179,19 @@ void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::If terminal,
}
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::CheckBit terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
ASSERT(false && "unimp");
powah::Label const l_else = code.DefineLabel();
powah::Label const l_end = code.DefineLabel();
auto const tmp = ctx.reg_alloc.ScratchGpr();
code.LBZ(tmp, PPC64::RJIT, ctx.emit_conf.a64_variant ? offsetof(A64JitState, check_bit) : offsetof(A32JitState, check_bit));
code.CMPLWI(tmp, 0);
code.BEQ(powah::CR0, l_else);
// CheckBit == 1
EmitTerminal(code, ctx, terminal.then_, initial_location, is_single_step);
code.B(l_end);
// CheckBit == 0
code.LABEL(l_else);
EmitTerminal(code, ctx, terminal.else_, initial_location, is_single_step);
code.LABEL(l_end);
}
void EmitTerminal(powah::Context& code, EmitContext& ctx, IR::Term::CheckHalt terminal, IR::LocationDescriptor initial_location, bool is_single_step) {

3
src/dynarmic/src/dynarmic/backend/ppc64/emit_ppc64_a64.cpp

@ -18,7 +18,8 @@ namespace Dynarmic::Backend::PPC64 {
template<>
void EmitIR<IR::Opcode::A64SetCheckBit>(powah::Context& code, EmitContext& ctx, IR::Inst* inst) {
ASSERT(false && "unimp");
auto const value = ctx.reg_alloc.UseGpr(inst->GetArg(0));
code.STB(value, PPC64::RJIT, offsetof(A64JitState, check_bit));
}
template<>

Loading…
Cancel
Save