1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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
This commit is contained in:
Andrew Turner 2015-10-18 13:23:21 +00:00
parent 26a6057525
commit 22c6adff09
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=289502

View File

@ -251,7 +251,13 @@ exec_setregs(struct thread *td, struct image_params *imgp, u_long stack)
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;
}