diff --git a/headers/private/kernel/arch/arm64/arch_thread_types.h b/headers/private/kernel/arch/arm64/arch_thread_types.h index fe1835ae2d..56df2b48e9 100644 --- a/headers/private/kernel/arch/arm64/arch_thread_types.h +++ b/headers/private/kernel/arch/arm64/arch_thread_types.h @@ -18,7 +18,7 @@ struct iframe_stack { struct arch_thread { - uint64 regs[13]; // x19-x30, sp + uint64 regs[14]; // x19-x30, sp, tpidr_el0 uint64 fp_regs[8]; // d8-d15 // used to track interrupts on this thread diff --git a/src/system/kernel/arch/arm64/arch_asm.S b/src/system/kernel/arch/arm64/arch_asm.S index 0d7acadd4e..a21ba43cd8 100644 --- a/src/system/kernel/arch/arm64/arch_asm.S +++ b/src/system/kernel/arch/arm64/arch_asm.S @@ -253,7 +253,8 @@ FUNCTION(_arch_context_swap): stp x29, x30, [x0], #16 mov x2, sp - str x2, [x0], #8 + mrs x3, TPIDR_EL0 + stp x2, x3, [x0], #16 stp d8, d9, [x0], #16 stp d10, d11, [x0], #16 @@ -268,8 +269,9 @@ FUNCTION(_arch_context_swap): ldp x27, x28, [x1], #16 ldp x29, x30, [x1], #16 - ldr x2, [x1], #8 + ldp x2, x3, [x1], #16 mov sp, x2 + msr TPIDR_EL0, x3 ldp d8, d9, [x1], #16 ldp d10, d11, [x1], #16