/* <0 - low prio interrupt, 0 - no interrupt, >0 - interrupt number  */
static int apic_irq_pending(APICCommonState *s)
/* <0 - low prio interrupt, 0 - no interrupt, >0 - interrupt number  */
static int apic_irq_pending(APICCommonState *s)
{
    int irrv, ppr;
    irrv = get_highest_priority_int(s->irr);
    if (irrv < 0) {
        return 0;
    }
    ppr = apic_get_ppr(s);
    if (ppr && (irrv & 0xf0) <= (ppr & 0xf0)) {
        return -1;
    }
    return irrv;
}