/* Set up a signal frame. Determine which stack to use..  */
static void __user* get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
/* Set up a signal frame. Determine which stack to use..  */
static void __user* get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
{
	unsigned long sp;
	sp = (unsigned long) A(regs->gprs[15]);
	if (on_sig_stack(sp) && !on_sig_stack((sp - frame_size) & -8UL))
		return (void __user *) -1UL;
	if (ka->sa.sa_flags & SA_ONSTACK) {
		if (! sas_ss_flags(sp))
			sp = current->sas_ss_sp + current->sas_ss_size;
	}
	else if (!user_mode(regs) &&
		 !(ka->sa.sa_flags & SA_RESTORER) &&
		 ka->sa.sa_restorer) {
		sp = (unsigned long) ka->sa.sa_restorer;
	}
	return (void __user *)((sp - frame_size) & -8ul);
}