xen: correctly check for pending events when restoring irq flags