发信人: ikoo()
整理人: simonshium(1999-06-30 20:19:01), 站内信件
|
WRITING A VIRTUAL DEVICE
Many virtual devies are written to replace one of the standard virtual devices, that is, one of the virtual devices provided with the Microsoft Windows 95 operating system However, most virtual devices are written to support new hardware devices or software In such cases, it is often easier to write a virtual device from scratch than to modify and existing virtual device, because so much of a virtual device is device-specific. Nevertheiess, the sources for existing virtual devices should be carefully examinged whenever possible because they can reveal the general format and structure of virtual devices, as well as illustrate how to use VMM and virtual device services to carry out useful tasks.
Use the following guidlines when writing a virtual device:
1: Start with a skeletal virtual device containing the virtual device segments, a virtual device declaration, a device control procedure, stubs for the procedures that process the system comtrol messages, and stubs for the API procedures.
2: Add a real-mode initialization procedure(optional).
3: Fill out the procedures that process the initialization messages. These procedures should initializa the control block, allocate global memory, and install callback procedures for interrupts, I/O traps, and page faults.
4: Fill out the callback procedures that handle the various interrupts and faults.
5: Add a service table declaration and definitions for the services (optional)
6: Fill out the API procedures(optional).
7: Fill out the procedures that process system control messages for creating and destroying virtual machines.
At each stage in writeing a virtual device, you can install the virtual device and run under the control of debugger. etting breakpoints in your virtual device and monitoring the various interrupts managed by your virtual device can help you determine whether your virtual device is operating correctly.
-- ※ 来源:.广州网易 BBS bbs.nease.net.[FROM: 202.96.133.170]
|
|