/* return the pic wanted interrupt. return -1 if none  */
static int pic_get_irq(struct kvm_kpic_state *s)
/* return the pic wanted interrupt. return -1 if none  */
static int pic_get_irq(struct kvm_kpic_state *s)
{
	int mask, cur_priority, priority;
	mask = s->irr & ~s->imr;
	priority = get_priority(s, mask);
	if (priority == 8)
		return -1;
	mask = s->isr;
	if (s->special_fully_nested_mode && s == &s->pics_state->pics[0])
		mask &= ~(1 << 2);
	cur_priority = get_priority(s, mask);
	if (priority < cur_priority)
		return (priority + s->priority_add) & 7;
	else
		return -1;
}