kern SvcGetDebugThreadContext, SvcSetDebugThreadContext

This commit is contained in:
Michael Scire
2020-07-31 02:49:43 -07:00
committed by SciresM
parent 3afd723b92
commit 5c4fbf5c67
10 changed files with 363 additions and 4 deletions

View File

@@ -189,6 +189,18 @@ namespace ams::kern::arch::arm64 {
this->SetFpsr(psr);
}
void KThreadContext::SetFpuRegisters(const u128 *v, bool is_64_bit) {
if (is_64_bit) {
for (size_t i = 0; i < KThreadContext::NumFpuRegisters; ++i) {
this->fpu_registers[i] = v[i];
}
} else {
for (size_t i = 0; i < KThreadContext::NumFpuRegisters / 2; ++i) {
this->fpu_registers[i] = v[i];
}
}
}
void GetUserContext(ams::svc::ThreadContext *out, const KThread *thread) {
MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread());
MESOSPHERE_ASSERT(thread->IsSuspended());
@@ -256,6 +268,9 @@ namespace ams::kern::arch::arm64 {
for (size_t i = 0; i < KThreadContext::NumFpuRegisters / 2; ++i) {
out->v[i] = f[i];
}
for (size_t i = KThreadContext::NumFpuRegisters / 2; i < KThreadContext::NumFpuRegisters; ++i) {
out->v[i] = 0;
}
}
/* Copy fpcr/fpsr. */