Introduction to Virtual Device Drivers


Interrupt and Fault Handling



Download 274.5 Kb.
Page9/80
Date19.01.2022
Size274.5 Kb.
#58083
1   ...   5   6   7   8   9   10   11   12   ...   80
VXDS

Interrupt and Fault Handling


The VMM manages all interrupt and protection fault processing for the virtual devices. A VMM fault handler receives control whenever an interrupt or protection fault occurs, such as when an application executes a software interrupt, attempts to access a protected I/O port, or attempts to access a protected or unavailable segment or page of memory. The VMM fault handler calls the callback procedures installed by the virtual devices, allowing the callbacks the opportunity to process the interrupt or fault.

A VMM fault handler usually processes an interrupt and protection fault as follows:



  1. The application in the virtual machine executes a software interrupt, or performs an operation that generates a fault.

  2. The CPU transitions to ring 0 and calls the corresponding VMM fault handler as specified by the IDT. Virtual devices must never replace the VMM fault handler descriptors in the IDT.

  3. The VMM fault handler dispatches the interrupt to any installed callback procedure(s) using a call instruction.

  4. A callback procedure can either process or ignore the interrupt or fault, but must always return to the VMM fault handler by using the ret instruction. In most cases, a virtual device uses the Schedule_Global_Event or Schedule_VM_Event service to schedule an event, and specify the event callback procedure that processes the current fault.

  5. When control returns to the VMM fault handler, it checks for scheduled global or virtual machine events. If any events are outstanding, the VMM calls the corresponding event callback procedures.

  6. If no callback procedure has processed the interrupt or fault, the VMM fault handler reflects the interrupt or fault back into the virtual machine allowing the V86-mode interrupt handler to process it.

  7. The VMM executes an iret instruction to transition back to the virtual machine's privilege level, and return execution control to the application in the virtual machine.



Download 274.5 Kb.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   ...   80




The database is protected by copyright ©ininet.org 2024
send message

    Main page