background image

Vol. 3C 33-3

HANDLING BOUNDARY CONDITIONS IN A VIRTUAL MACHINE MONITOR

33.3.1 

Virtualization of Interrupt Vector Space

The Intel 64 and IA-32 architectures use 8-bit vectors of which 224 (20H – FFH) are available for external inter-
rupts. Vectors are used to select the appropriate entry in the interrupt descriptor table (IDT). VMX operation allows 
each guest to control its own IDT. Host vectors refer to vectors delivered by the platform to the processor during 
the interrupt acknowledgement cycle. Guest vectors refer to vectors programmed by a guest to select an entry in 
its guest IDT. Depending on the I/O resource management models supported by the VMM design, the guest vector 
space may or may not overlap with the underlying host vector space. 

Interrupts from virtual devices: Guest vector numbers for virtual interrupts delivered to guests on behalf of 
emulated virtual devices have no direct relation to the host vector numbers of interrupts from physical devices 
on which they are emulated. A guest-vector assigned for a virtual device by the guest operating environment 
is saved by the VMM and utilized when injecting virtual interrupts on behalf of the virtual device.

Interrupts from assigned physical devices: Hardware support for I/O device assignment allows physical I/O 
devices in the host platform to be assigned (direct-mapped) to VMs. Guest vectors for interrupts from direct-
mapped physical devices take up equivalent space from the host vector space, and require the VMM to perform 
host-vector to guest-vector mapping for interrupts. 

Figure 33-1 illustrates the functional relationship between host external interrupts and guest virtual external inter-
rupts. Device A is owned by the host and generates external interrupts with host vector X. The host IDT is set up 
such that the interrupt service routine (ISR) for device driver A is hooked to host vector X as normal. VMM 
emulates (over device A) virtual device C in software which generates virtual interrupts to the VM with guest 
expected vector P. Device B is assigned to a VM and generates external interrupts with host vector Y. The host IDT 
is programmed to hook the VMM interrupt service routine (ISR) for assigned devices for vector Y, and the VMM 
handler injects virtual interrupt with guest vector Q to the VM. The guest operating system programs the guest to 
hook appropriate guest driver’s ISR to vectors P and Q.