Use the STACKALIGN macro to alight the stack rather than with a magic mask.
Submitted by: Christoph Mallon <christoph.mallon gmx.de>
This commit is contained in:
parent
9d9758ed46
commit
b9f7a584fd
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user