[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] mini-os: x86_64: make thread stacks 16-byte aligned



commit 750cdc32d73f8d5e4e1cbd1f252dd145e8e8c962
Author:     Thomas Leonard <talex5@xxxxxxxxx>
AuthorDate: Wed Jul 16 12:07:41 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Fri Jul 18 13:38:08 2014 +0100

    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@xxxxxxxxx>
    Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/arch/x86/sched.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/extras/mini-os/arch/x86/sched.c b/extras/mini-os/arch/x86/sched.c
index 8a05b58..e4a3dc2 100644
--- a/extras/mini-os/arch/x86/sched.c
+++ b/extras/mini-os/arch/x86/sched.c
@@ -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);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.