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:
Thomas Leonard authored and Ian Campbell committed 2014-07-18 13:38:08 +01:00
1 parent 78bf682c36
commit 750cdc32d7
1 file changed
+3
+3
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.