guest_intr_notify()

Handle an interrupt event that has occurred on an interrupt line that PIC is aware of

Synopsis:

#include <qvm/guest.h>
void guest_intr_notify(const vdev_t *vdp,
                       unsigned param,
                       enum guest_intr_notifications gin)

Arguments:

vdp
A pointer to the PIC virtual device.
param
The interrupt line on the PIC device that has become unmasked.
gin
The notification type.

Library:

Provided by qvm; no external library is required.

Description:

If the state of the interrupt pass-through is IPS_DISABLED, ignore the event. Otherwise, check if the interrupt is accepted and deassert the interrupt request to the guest CPU if it is. If the interrupt has not been accepted, the interrupt pass-through is set to the IPS_WAITING state, and is handled based on the state it was in when guest_intr_notify() was called. If the interrupt pass-through was not initialized when guest_intr_notify() was invoked, a pulse is created and the interrupt is initialized.

If this operation succeeds, the ID of the interrupt is assigned to the interrupt pass-through. If it fails, an error message is printed and interrupts are disabled. If the interrupt pass-through is in the IPS_INPROGRESS state, the interrupt is unmasked. If this operation fails, an error message is printed, interrupts are disabled, and InterruptDetach() is invoked on the interrupt. If the interrupt pass-through is in the IPS_WAITING state as it enters guest_intr_notify(), it is ignored because the masking and unmasking task the guest has performed is empty.