mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-07 23:39:07 +01:00
arm_interface: Add missing fpsr/tpidr members to the ThreadContext struct
Internally within the kernel, it also includes a member variable for the floating-point status register, and TPIDR, so we should do the same here to match it. While we're at it, also fix up the size of the struct and add a static assertion to ensure it always stays the correct size.
This commit is contained in:
parent
334090fe6f
commit
16145e2f21
3 changed files with 15 additions and 5 deletions
|
@ -22,10 +22,16 @@ public:
|
||||||
std::array<u64, 31> cpu_registers;
|
std::array<u64, 31> cpu_registers;
|
||||||
u64 sp;
|
u64 sp;
|
||||||
u64 pc;
|
u64 pc;
|
||||||
u64 pstate;
|
u32 pstate;
|
||||||
|
std::array<u8, 4> padding;
|
||||||
std::array<u128, 32> vector_registers;
|
std::array<u128, 32> vector_registers;
|
||||||
u64 fpcr;
|
u32 fpcr;
|
||||||
|
u32 fpsr;
|
||||||
|
u64 tpidr;
|
||||||
};
|
};
|
||||||
|
// Internally within the kernel, it expects the AArch64 version of the
|
||||||
|
// thread context to be 800 bytes in size.
|
||||||
|
static_assert(sizeof(ThreadContext) == 0x320);
|
||||||
|
|
||||||
/// Runs the CPU until an event happens
|
/// Runs the CPU until an event happens
|
||||||
virtual void Run() = 0;
|
virtual void Run() = 0;
|
||||||
|
|
|
@ -247,15 +247,19 @@ void ARM_Dynarmic::SaveContext(ThreadContext& ctx) {
|
||||||
ctx.pstate = jit->GetPstate();
|
ctx.pstate = jit->GetPstate();
|
||||||
ctx.vector_registers = jit->GetVectors();
|
ctx.vector_registers = jit->GetVectors();
|
||||||
ctx.fpcr = jit->GetFpcr();
|
ctx.fpcr = jit->GetFpcr();
|
||||||
|
ctx.fpsr = jit->GetFpsr();
|
||||||
|
ctx.tpidr = cb->tpidr_el0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARM_Dynarmic::LoadContext(const ThreadContext& ctx) {
|
void ARM_Dynarmic::LoadContext(const ThreadContext& ctx) {
|
||||||
jit->SetRegisters(ctx.cpu_registers);
|
jit->SetRegisters(ctx.cpu_registers);
|
||||||
jit->SetSP(ctx.sp);
|
jit->SetSP(ctx.sp);
|
||||||
jit->SetPC(ctx.pc);
|
jit->SetPC(ctx.pc);
|
||||||
jit->SetPstate(static_cast<u32>(ctx.pstate));
|
jit->SetPstate(ctx.pstate);
|
||||||
jit->SetVectors(ctx.vector_registers);
|
jit->SetVectors(ctx.vector_registers);
|
||||||
jit->SetFpcr(static_cast<u32>(ctx.fpcr));
|
jit->SetFpcr(ctx.fpcr);
|
||||||
|
jit->SetFpsr(ctx.fpsr);
|
||||||
|
SetTPIDR_EL0(ctx.tpidr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ARM_Dynarmic::PrepareReschedule() {
|
void ARM_Dynarmic::PrepareReschedule() {
|
||||||
|
|
|
@ -250,7 +250,7 @@ static void RegWrite(std::size_t id, u64 val, Kernel::Thread* thread = nullptr)
|
||||||
} else if (id == PC_REGISTER) {
|
} else if (id == PC_REGISTER) {
|
||||||
thread->context.pc = val;
|
thread->context.pc = val;
|
||||||
} else if (id == PSTATE_REGISTER) {
|
} else if (id == PSTATE_REGISTER) {
|
||||||
thread->context.pstate = val;
|
thread->context.pstate = static_cast<u32>(val);
|
||||||
} else if (id > PSTATE_REGISTER && id < FPCR_REGISTER) {
|
} else if (id > PSTATE_REGISTER && id < FPCR_REGISTER) {
|
||||||
thread->context.vector_registers[id - (PSTATE_REGISTER + 1)][0] = val;
|
thread->context.vector_registers[id - (PSTATE_REGISTER + 1)][0] = val;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue