summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-29 23:58:26 +0200
committerLioncash <mathew1800@gmail.com>2018-09-30 08:29:57 +0200
commit16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6 (patch)
treec22765539200de9bbc95a3a60f4b3b158311c96e /src
parentMerge pull request #1414 from lioncash/ref (diff)
downloadyuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar.gz
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar.bz2
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar.lz
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar.xz
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.tar.zst
yuzu-16145e2f21d7f7208c95d164a0fe2b1a5d8c20d6.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/arm/arm_interface.h10
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic.cpp8
-rw-r--r--src/core/gdbstub/gdbstub.cpp2
3 files changed, 15 insertions, 5 deletions
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 16d528994..59da33f30 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -22,10 +22,16 @@ public:
std::array<u64, 31> cpu_registers;
u64 sp;
u64 pc;
- u64 pstate;
+ u32 pstate;
+ std::array<u8, 4> padding;
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
virtual void Run() = 0;
diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp
index 8cad070b4..9ea87cdbe 100644
--- a/src/core/arm/dynarmic/arm_dynarmic.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic.cpp
@@ -247,15 +247,19 @@ void ARM_Dynarmic::SaveContext(ThreadContext& ctx) {
ctx.pstate = jit->GetPstate();
ctx.vector_registers = jit->GetVectors();
ctx.fpcr = jit->GetFpcr();
+ ctx.fpsr = jit->GetFpsr();
+ ctx.tpidr = cb->tpidr_el0;
}
void ARM_Dynarmic::LoadContext(const ThreadContext& ctx) {
jit->SetRegisters(ctx.cpu_registers);
jit->SetSP(ctx.sp);
jit->SetPC(ctx.pc);
- jit->SetPstate(static_cast<u32>(ctx.pstate));
+ jit->SetPstate(ctx.pstate);
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() {
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index d8c7b3492..ae88440c2 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -250,7 +250,7 @@ static void RegWrite(std::size_t id, u64 val, Kernel::Thread* thread = nullptr)
} else if (id == PC_REGISTER) {
thread->context.pc = val;
} else if (id == PSTATE_REGISTER) {
- thread->context.pstate = val;
+ thread->context.pstate = static_cast<u32>(val);
} else if (id > PSTATE_REGISTER && id < FPCR_REGISTER) {
thread->context.vector_registers[id - (PSTATE_REGISTER + 1)][0] = val;
}