mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-02 12:44:34 +01:00
A64: PSTATE access and tests
This commit is contained in:
parent
23f3afe0b3
commit
e8bcf72ee5
6 changed files with 86 additions and 2 deletions
|
|
@ -128,7 +128,8 @@ void A64EmitX64::EmitA64SetNZCV(A64EmitContext& ctx, IR::Inst* inst) {
|
|||
Xbyak::Reg32 to_store = ctx.reg_alloc.UseGpr(args[0]).cvt32();
|
||||
code->and_(to_store, 0b11000001'00000001);
|
||||
code->imul(to_store, to_store, 0b00010000'00100001);
|
||||
code->and_(to_store, 0xFF000000);
|
||||
code->shl(to_store, 16);
|
||||
code->and_(to_store, 0xF0000000);
|
||||
code->mov(dword[r15 + offsetof(A64JitState, CPSR_nzcv)], to_store);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,6 +125,14 @@ public:
|
|||
jit_state.SetFpcr(value);
|
||||
}
|
||||
|
||||
u32 GetPstate() const {
|
||||
return jit_state.GetPstate();
|
||||
}
|
||||
|
||||
void SetPstate(u32 value) {
|
||||
jit_state.SetPstate(value);
|
||||
}
|
||||
|
||||
bool IsExecuting() const {
|
||||
return is_executing;
|
||||
}
|
||||
|
|
@ -257,6 +265,14 @@ void Jit::SetFpcr(u32 value) {
|
|||
impl->SetFpcr(value);
|
||||
}
|
||||
|
||||
u32 Jit::GetPstate() const {
|
||||
return impl->GetPstate();
|
||||
}
|
||||
|
||||
void Jit::SetPstate(u32 value) {
|
||||
impl->SetPstate(value);
|
||||
}
|
||||
|
||||
bool Jit::IsExecuting() const {
|
||||
return impl->IsExecuting();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,12 @@ struct A64JitState {
|
|||
|
||||
u32 CPSR_nzcv = 0;
|
||||
u32 FPSCR_nzcv = 0;
|
||||
u32 GetPstate() const {
|
||||
return CPSR_nzcv;
|
||||
}
|
||||
void SetPstate(u32 new_pstate) {
|
||||
CPSR_nzcv = new_pstate & 0xF0000000;
|
||||
}
|
||||
|
||||
alignas(16) std::array<u64, 64> vec{}; // Extension registers.
|
||||
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ bool Inst::WritesToCPSR() const {
|
|||
case Opcode::A32OrQFlag:
|
||||
case Opcode::A32SetGEFlags:
|
||||
case Opcode::A32SetGEFlagsCompressed:
|
||||
case Opcode::A64SetNZCV:
|
||||
return true;
|
||||
|
||||
default:
|
||||
|
|
@ -387,7 +388,7 @@ void Inst::Use(const Value& value) {
|
|||
break;
|
||||
case Opcode::GetNZCVFromOp:
|
||||
ASSERT_MSG(!value.GetInst()->nzcv_inst, "Only one of each type of pseudo-op allowed");
|
||||
ASSERT_MSG(MayGetNZCVFromOp(), "This instruction doesn't support the GetNZCVFromOp pseduo-op");
|
||||
ASSERT_MSG(value.GetInst()->MayGetNZCVFromOp(), "This value doesn't support the GetNZCVFromOp pseduo-op");
|
||||
value.GetInst()->nzcv_inst = this;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue