/* Find the currently executing interrupt vector, if any. 
This function must be called with interrupts locked in interrupt context. */
__pinned_func int z_irq_controller_isr_vector_get(void)
/* Find the currently executing interrupt vector, if any. 
This function must be called with interrupts locked in interrupt context. */
__pinned_func int z_irq_controller_isr_vector_get(void)
{
	int pReg, block;
	for (block = 7; likely(block > 0); block--) {
		pReg = x86_read_loapic(LOAPIC_ISR + (block * 0x10));
		if (pReg != 0) {
			return (block * 32) + (find_msb_set(pReg) - 1);
		}
	}
	return -1;
}