From 494459b56be2ca4146f3bc35e7c14e16fdc72086 Mon Sep 17 00:00:00 2001 From: Andrew Turner Date: Sat, 26 Jan 2013 08:55:04 +0000 Subject: [PATCH] Align td_frame as it will be placed into the sp register which must be 8 byte aligned on ARM EABI. --- sys/arm/arm/vm_machdep.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index cc87bbe3113e..22a209b4faad 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -398,6 +398,12 @@ cpu_thread_alloc(struct thread *td) PAGE_SIZE) - 1; td->td_frame = (struct trapframe *) ((u_int)td->td_kstack + USPACE_SVC_STACK_TOP - sizeof(struct pcb)) - 1; + /* + * Ensure td_frame is aligned to an 8 byte boundary as it will be + * placed into the stack pointer which must be 8 byte aligned in + * the ARM EABI. + */ + td->td_frame = (struct trapframe *)((u_int)td->td_frame & ~7); #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE);