From 4192873744c539ea2deafa4c3a03f391ee6bdd97 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 5 Apr 2023 15:08:31 +0100 Subject: [PATCH] Fix TLS writes from X2/3 These mistakenly used the wrong source register. --- app/src/main/cpp/skyline/nce.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/nce.cpp b/app/src/main/cpp/skyline/nce.cpp index 695339eb..fe3c1151 100644 --- a/app/src/main/cpp/skyline/nce.cpp +++ b/app/src/main/cpp/skyline/nce.cpp @@ -510,7 +510,7 @@ namespace skyline::nce { /* Store new TLS value into ThreadContext */ *patch++ = x0x1 ? 0xD53BD040 : 0xD53BD042; // MRS X(0/2), TPIDR_EL0 *patch++ = instructions::Mov(x0x1 ? registers::X1 : registers::X3, registers::X(msr.srcReg)).raw; - *patch++ = x0x1 ? 0xF9015C01 : 0xF9015C03; // STR X(1/3), [X0, #0x4B8] (ThreadContext::tpidrEl0) + *patch++ = x0x1 ? 0xF9015C01 : 0xF9015C43; // STR X(1/3), [X(0/2), #0x4B8] (ThreadContext::tpidrEl0) /* Restore Scratch Registers and Return */ *patch++ = x0x1 ? 0xA8C107E0 : 0xA8C10FE2; // LDP X(0/2), X(1/3), [SP], #16