diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 981dfebeb738..3175e879114d 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -129,6 +129,12 @@ END(cpu_throw) * x3 to x7, x16 and x17 are caller saved */ ENTRY(cpu_switch) + /* Store the new curthread */ + str x1, [x18, #PC_CURTHREAD] + /* And the new pcb */ + ldr x4, [x1, #TD_PCB] + str x4, [x18, #PC_CURPCB] + /* * Save the old context. */ @@ -168,15 +174,10 @@ ENTRY(cpu_switch) mov x0, x19 #endif - /* Store the new curthread */ - str x1, [x18, #PC_CURTHREAD] - /* - * Restore the saved context and save it as the curpcb. + * Restore the saved context. */ ldr x4, [x1, #TD_PCB] - str x4, [x18, #PC_CURPCB] - /* * TODO: We may need to flush the cache here if switching