diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -359,11 +359,14 @@ { int i; - for (i = 0; i < nitems(pcb->pcb_x); i++) - pcb->pcb_x[i] = tf->tf_x[i + PCB_X_START]; - /* NB: pcb_x[PCB_LR] is the PC, see PC_REGS() in db_machdep.h */ - pcb->pcb_x[PCB_LR] = tf->tf_elr; + for (i = 0; i < nitems(pcb->pcb_x); i++) { + if (i == PCB_LR) + pcb->pcb_x[i] = tf->tf_elr; + else + pcb->pcb_x[i] = tf->tf_x[i + PCB_X_START]; + } + pcb->pcb_sp = tf->tf_sp; }