diff options
author | andrew <andrew@FreeBSD.org> | 2013-02-04 09:48:50 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2013-02-04 09:48:50 +0000 |
commit | 3da6055c2c175fe1a290484838d43ab5804536ae (patch) | |
tree | 2ccb96ac98b0a6f9c4638e461f93dd61b7c5f207 | |
parent | 190be65c146319042fc604d673f0f34610a60b5b (diff) | |
download | FreeBSD-src-3da6055c2c175fe1a290484838d43ab5804536ae.zip FreeBSD-src-3da6055c2c175fe1a290484838d43ab5804536ae.tar.gz |
Use the STACKALIGN macro to alight the stack rather than with a magic mask.
Submitted by: Christoph Mallon <christoph.mallon gmx.de>
-rw-r--r-- | sys/arm/arm/vm_machdep.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/arm/arm/vm_machdep.c b/sys/arm/arm/vm_machdep.c index 22a209b..9326546 100644 --- a/sys/arm/arm/vm_machdep.c +++ b/sys/arm/arm/vm_machdep.c @@ -362,8 +362,8 @@ cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, { struct trapframe *tf = td->td_frame; - tf->tf_usr_sp = ((int)stack->ss_sp + stack->ss_size - - sizeof(struct trapframe)) & ~7; + tf->tf_usr_sp = STACKALIGN((int)stack->ss_sp + stack->ss_size + - sizeof(struct trapframe)); tf->tf_pc = (int)entry; tf->tf_r0 = (int)arg; tf->tf_spsr = PSR_USR32_MODE; @@ -396,14 +396,13 @@ cpu_thread_alloc(struct thread *td) { td->td_pcb = (struct pcb *)(td->td_kstack + td->td_kstack_pages * 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); + td->td_frame = (struct trapframe *)STACKALIGN((u_int)td->td_kstack + + USPACE_SVC_STACK_TOP - sizeof(struct pcb) - 1); #ifdef __XSCALE__ #ifndef CPU_XSCALE_CORE3 pmap_use_minicache(td->td_kstack, td->td_kstack_pages * PAGE_SIZE); |