Author: andrew
Date: Sun Oct 18 13:23:21 2015
New Revision: 289502
URL: https://svnweb.freebsd.org/changeset/base/289502
Log:
Correctly align the stack. The early csu assumed we passed the aux vector
in through the stack pointer, however this may have been misaligned
causing some userland applications to crash. A workaround was committed in
r284707 where userland would check if the aux vector was passed using the
old or new ABI and adjust the stack if needed. As 4 months have passed it
is time to move to the new ABI, with the expectation the compat code in csu
and the runtime linker to be removed in the future.
Sponsored by: ABT Systems Ltd
Modified:
head/sys/arm64/arm64/machdep.c
Modified: head/sys/arm64/arm64/machdep.c
==============================================================================
--- head/sys/arm64/arm64/machdep.c Sun Oct 18 12:26:25 2015
(r289501)
+++ head/sys/arm64/arm64/machdep.c Sun Oct 18 13:23:21 2015
(r289502)
@@ -251,7 +251,13 @@ exec_setregs(struct thread *td, struct i
memset(tf, 0, sizeof(struct trapframe));
- tf->tf_sp = stack;
+ /*
+ * We need to set x0 for init as it doesn't call
+ * cpu_set_syscall_retval to copy the value. We also
+ * need to set td_retval for the cases where we do.
+ */
+ tf->tf_x[0] = td->td_retval[0] = stack;
+ tf->tf_sp = STACKALIGN(stack);
tf->tf_lr = imgp->entry_addr;
tf->tf_elr = imgp->entry_addr;
}
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"