Index: sys/mips/mips/pm_machdep.c =================================================================== --- sys/mips/mips/pm_machdep.c +++ sys/mips/mips/pm_machdep.c @@ -74,6 +74,12 @@ #define UCONTEXT_MAGIC 0xACEDBADE +#if defined(__mips_n32) || defined(__mips_n64) +#define STACK_ALIGN 16 +#else +#define STACK_ALIGN 8 +#endif + /* * Send an interrupt to process. * @@ -132,10 +138,10 @@ SIGISMEMBER(psp->ps_sigonstack, sig)) { sfp = (struct sigframe *)(((uintptr_t)td->td_sigstk.ss_sp + td->td_sigstk.ss_size - sizeof(struct sigframe)) - & ~(sizeof(__int64_t) - 1)); + & ~(STACK_ALIGN - 1)); } else sfp = (struct sigframe *)((vm_offset_t)(regs->sp - - sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1)); + sizeof(struct sigframe)) & ~(STACK_ALIGN - 1)); /* Build the argument list for the signal handler. */ regs->a0 = sig; @@ -408,12 +414,7 @@ bzero((caddr_t)td->td_frame, sizeof(struct trapframe)); - /* - * The stack pointer has to be aligned to accommodate the largest - * datatype at minimum. This probably means it should be 16-byte - * aligned, but for now we're 8-byte aligning it. - */ - td->td_frame->sp = ((register_t) stack) & ~(sizeof(__int64_t) - 1); + td->td_frame->sp = ((register_t)stack) & ~(STACK_ALIGN - 1); /* * If we're running o32 or n32 programs but have 64-bit registers,