Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

irq_create (nr 504)

Create a file descriptor for receiving hardware interrupts.

Signature

irq_create(gsi: u32) → fd or -errno

Arguments

ArgRegisterDescription
gsirdiGlobal System Interrupt number

Return value

On success, returns a file descriptor for the IRQ object.

Errors

ErrorCondition
ENOMEMNo free dynamic interrupt vectors available
EINVALFailed to program the IO APIC for the given GSI
EMFILEProcess fd table is full

Description

Allocates a dynamic interrupt vector, programs the IO APIC to route the specified GSI to that vector (edge-triggered, active-high, initially masked), and returns an fd referring to the IRQ object.

The IRQ fd is used with io_submit OP_IRQ_WAIT to asynchronously wait for interrupts via a completion port. When an interrupt fires, the registered completion port receives a completion with the user_data from the submission. The GSI is then re-masked until the next OP_IRQ_WAIT is submitted.

When the fd is closed, the original IO APIC redirection entry is restored and the dynamic vector is freed.

Implementation

osl/src/irq.rssys_irq_create

See also