mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
mini-os: x86_64: make thread stacks 16-byte aligned
Otherwise, passing doubles to varargs functions causes a crash. Signed-off-by: Thomas Leonard <talex5@gmail.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
This commit is contained in:
1 parent
78bf682c36
commit
750cdc32d7
1 file changed
+3
@@ -107,6 +107,9 @@ struct thread* arch_create_thread(char *name, void (*function)(void *),
|
||||
thread->sp = (unsigned long)thread->stack + STACK_SIZE;
|
||||
/* Save pointer to the thread on the stack, used by current macro */
|
||||
*((unsigned long *)thread->stack) = (unsigned long)thread;
|
||||
|
||||
/* Must ensure that (%rsp + 8) is 16-byte aligned at the start of thread_starter. */
|
||||
thread->sp -= sizeof(unsigned long);
|
||||
|
||||
stack_push(thread, (unsigned long) function);
|
||||
stack_push(thread, (unsigned long) data);
|
||||
|
||||