Other architectures have this assignment in their setregs() implementation. I don't fully understand why though. Diff below makes arm64 consistent with the rest, but I don't think it fixes anything.
Index: arch/arm64/arm64/machdep.c =================================================================== RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v retrieving revision 1.19 diff -u -p -r1.19 machdep.c --- arch/arm64/arm64/machdep.c 9 Aug 2017 03:44:33 -0000 1.19 +++ arch/arm64/arm64/machdep.c 13 Aug 2017 16:08:27 -0000 @@ -398,6 +398,8 @@ setregs(struct proc *p, struct exec_pack tf->tf_lr = pack->ep_entry; tf->tf_elr = pack->ep_entry; /* ??? */ tf->tf_spsr = PSR_M_EL0t; + + retval[1] = 0; } void