/* The inverse of the above: given bspstore and the number of registers, calculate ar.bsp.  */
static unsigned long* kvm_rse_skip_regs(unsigned long *addr, long num_regs)
/* The inverse of the above: given bspstore and the number of registers, calculate ar.bsp.  */
static unsigned long* kvm_rse_skip_regs(unsigned long *addr, long num_regs)
{
	long delta = ia64_rse_slot_num(addr) + num_regs;
	int i = 0;
	if (num_regs < 0)
		delta -= 0x3e;
	if (delta < 0) {
		while (delta <= -0x3f) {
			i--;
			delta += 0x3f;
		}
	} else {
		while (delta >= 0x3f) {
			i++;
			delta -= 0x3f;
		}
	}
	return addr + num_regs + i;
}