The information in this article applies to:
SUMMARY
VFINTD.exe is a sample application that is used later in this article to
demonstrate how to virtualize a particular IRQ. There are two pieces of
code to the VFINTD sample: the VxD and a sample MS-DOS application. All the
files that are named VFINTD are part of the VxD. The MS-DOS application is
called TSTFINT. The only purpose of the MS-DOS application is to capture
floppy disk interrupts. The sample application does not release the focus
capture, but the VxD provides this functionality.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: Vfintd.exeFor more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center. BackgroundStandard hardware for an MS-DOS compatible computer includes a programmable interrupt controller (PIC). One register in the PIC is the interrupt mask register (IMR), which defines which hardware interrupts are currently enabled and which are disabled (or masked). The MS-DOS utility DEBUG can display the contents of the IMR. To demonstrate this, run DEBUG from the MS-DOS prompt. Then enter the following command to display the value of port 21 on your machine:i21Port 21 is the IMR for the hardware interrupts IRQ0 through IRQ7. The format of the IMR is that each bit (0-7) that is set corresponds to a disabled interrupt request (IRQ). Therefore, a typical IMR value might be 98h, which indicates that IRQ3, IRQ4, and IRQ7 are all masked, and that those interrupts are disabled:
NOTE: A PC/AT compatible system has two hardware PICs, and thus, two
IMRs, that correspond to the fifteen possible IRQs. (The second PIC is
cascaded to IRQ2, which consumes one IRQ.) While this point is
included here for completeness, is not necessary to understand the
overall picture.
When an MS-DOS device driver or terminate-and-stay-resident program (TSR) installs an interrupt handler for a particular IRQ, the device driver or TSR hooks the interrupt vector and unmasks the corresponding bit in the IMR. When Windows is running, MS-DOS drivers and TSRs are normally shared by all virtual machines. Thus, if an interrupt occurs while an arbitrary VM is running, Windows is not required to perform a virtual machine task switch to access the interrupt handler, because the interrupt handler resides in the address space of each virtual machine. Alternatively, if an interrupt handler for a previously masked IRQ is installed within a virtual machine, and an interrupt occurs while another virtual machine is executing, Windows must make a task switch so that the local interrupt handler is accessible and executable. Windows Default BehaviorThe VPICD VxD virtualizes the PICs when Windows is running in 386 enhanced mode. When hardware is virtualized, each virtual machine has access to its own "virtual" PIC. This allows transparently sharing hardware among all virtual machines.Unless some other mechanism processes an IRQ, the VPICD handles interrupts according to the following default behavior: When Windows boots into 386 enhanced mode, VPICD examines the value of the IMRs in the system to determine which interrupts are masked. If an interrupt is not masked (is enabled), Windows must assume that a valid interrupt handler is already installed for this IRQ. These IRQs are then flagged as "global," so that Windows can avoid the overhead of a task switch to service them. The remaining IRQs, which are masked (disabled), are flagged as "local" or "owned." An interrupt for one of these IRQs will be reflected only into each virtual machine that unmasks the IRQ. Changing the Default BehaviorIt is possible to change the default behavior of interrupt handling (described above) by installing a VxD that virtualizes an IRQ with the VxD call VPICD_Virtualize_IRQ. This call replaces the VPICD default callback routines with routines supplied in the VxD. For example, the virtual communication device (VCD) virtualizes the communication interrupt so that it can control interrupts from communication devices regardless of the state of the IMR at Windows load time.The VFINTD sample VxD also uses VPICD_Virtualize_IRQ to allow an application to "capture" the interrupts on IRQ6 (the floppy disk device), which is normally global. For example, a hard disk backup program that directly accesses the floppy disk controller hardware to improve performance would "lose" interrupts to other virtual machines unless it changed the global nature of IRQ6. VFINTD can be used in this case to capture the "focus" of the floppy disk device and the interrupts it generates. Using VFINTDThere are two pieces of code to the VFINTD.exe sample: the VxD and a sample MS-DOS application. All the files that are named VFINTD.exe are part of the VxD. The MS-DOS application is called TSTFINT. The only purpose of the MS-DOS application is to capture floppy disk interrupts. The sample application does not release the focus capture, but the VxD provides this functionality.To install the VxD in your machine, perform the following steps:
This sample has been provided to demonstrate how to virtualize a particular IRQ. It is a good place to start when developing another VxD to perform a similar function. Additional query words:
Keywords : kbfile kbsample kb16bitonly kbDDK kbWinOS3 |
Last Reviewed: December 14, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |