mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-08-06 15:39:28 +02:00
meso: properly initialize per-thread CFI-value for 11.x
This commit is contained in:
parent
3355f97275
commit
98c80d487b
@ -51,7 +51,7 @@ namespace ams::kern::arch::arm64 {
|
||||
cpu::InstructionMemoryBarrier();
|
||||
}
|
||||
|
||||
uintptr_t SetupStackForUserModeThreadStarter(KVirtualAddress pc, KVirtualAddress k_sp, KVirtualAddress u_sp, uintptr_t arg, bool is_64_bit) {
|
||||
uintptr_t SetupStackForUserModeThreadStarter(KVirtualAddress pc, KVirtualAddress k_sp, KVirtualAddress u_sp, uintptr_t arg, const bool is_64_bit) {
|
||||
/* NOTE: Stack layout on entry looks like following: */
|
||||
/* SP */
|
||||
/* | */
|
||||
@ -76,6 +76,11 @@ namespace ams::kern::arch::arm64 {
|
||||
MESOSPHERE_LOG("Creating User 32-Thread, %016lx\n", GetInteger(pc));
|
||||
}
|
||||
|
||||
/* Set CFI-value. */
|
||||
if (is_64_bit) {
|
||||
ctx->x[18] = KSystemControl::GenerateRandomU64() | 1;
|
||||
}
|
||||
|
||||
/* Set stack pointer. */
|
||||
if (is_64_bit) {
|
||||
ctx->sp = GetInteger(u_sp);
|
||||
|
Loading…
Reference in New Issue
Block a user