/* Calculate the address of the end of the user-level register backing store. This is the address that would have been stored in ar.bsp if the user had executed a "cover" instruction right before entering the kernel. If CFMP is not NULL, it is used to return the "current frame mask" that was active at the time the kernel was entered.  */
unsigned long ia64_get_user_rbs_end(struct task_struct *child, struct pt_regs *pt, unsigned long *cfmp)
/* Calculate the address of the end of the user-level register backing store. This is the address that would have been stored in ar.bsp if the user had executed a "cover" instruction right before entering the kernel. If CFMP is not NULL, it is used to return the "current frame mask" that was active at the time the kernel was entered.  */
unsigned long ia64_get_user_rbs_end(struct task_struct *child, struct pt_regs *pt, unsigned long *cfmp)
{
	unsigned long *krbs, *bspstore, cfm = pt->cr_ifs;
	long ndirty;
	krbs = (unsigned long *) child + IA64_RBS_OFFSET/8;
	bspstore = (unsigned long *) pt->ar_bspstore;
	ndirty = ia64_rse_num_regs(krbs, krbs + (pt->loadrs >> 19));
	if (in_syscall(pt))
		ndirty += (cfm & 0x7f);
	else
		cfm &= ~(1UL << 63);
	if (cfmp)
		*cfmp = cfm;
	return (unsigned long) ia64_rse_skip_regs(bspstore, ndirty);
}