From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Leonard Subject: [PATCH ARM v6 01/14] mini-os: x86_64: make thread stacks 16-byte aligned Date: Wed, 16 Jul 2014 12:07:41 +0100 Message-ID: <1405508874-3921-2-git-send-email-talex5@gmail.com> References: <1405508874-3921-1-git-send-email-talex5@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X7N3r-00039f-Nd for xen-devel@lists.xenproject.org; Wed, 16 Jul 2014 11:07:47 +0000 Received: by mail-we0-f174.google.com with SMTP id x48so740051wes.5 for ; Wed, 16 Jul 2014 04:07:46 -0700 (PDT) In-Reply-To: <1405508874-3921-1-git-send-email-talex5@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Thomas Leonard , Dave.Scott@eu.citrix.com, anil@recoil.org, stefano.stabellini@eu.citrix.com, samuel.thibault@ens-lyon.org List-Id: xen-devel@lists.xenproject.org Otherwise, passing doubles to varargs functions causes a crash. Signed-off-by: Thomas Leonard --- extras/mini-os/arch/x86/sched.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- 2.0.1