ICZelion's Win32ASM VXD compilation tutorial (2)

zhaozj2021-02-11  190

Virtual Machine Manager

Virtual Machine Manager (VMM) is an actual operating system of Windows 95 that establishes and maintains a framework for managing virtual machines while providing many important services for other VXD programs. Three important services are:

Memory management interrupt processing thread scheduling

Memory management

VMM creates a 32-bit virtual site space for the system virtual machine using the memory page capability of the Intel 80386 or the updated processor. It divides this address space into four different parts:

The V86 address is from 0h to 10ffefh, which belongs to the currently executed virtual machine. The application private area address ranges from 4MB to 2GB. This is the space running in Win32 application. Each Win32 process has its own 2GB (down 4MB). The application shared area address ranges from 2GB to 3GB. This area is shared by all applications in the virtual machine. System DLL (user32, kernel32, gid32) has settled here. All Win16 programs are also placed here because they are not standardized: they read and write other Win16 programs in memory. Only in this area, the Win16 program can see all other Win16 programs. Memory maps and memory assigned to DPMI are also stored here. The system shared area address ranges from 3GB to 4GB. Here is where VMM and VXM stored.

VMM provides three VXD services for VXD programs:

Page Memory Services This service assignment / management page size is 4KB memory. This is the lowest service providing, all other services are built on page memory services. Stack memory services manage small memory blocks. This high-level memory management service is based on page memory services. The table service management can be used to implement a fixed size memory block for the link table.

Processing interrupt

In the protection mode, the interrupt points points to the interrupt description table (IDT). VMM helps monitor the IDT of the virtual machine via VXD. Usually the VMM processes almost all interrupt portions in IDT. It performs the first level of interrupt processing: Save the state of the interrupt program, transmit control to the second stage interrupt processing, and the interrupt processing of the second level is typically processed by various VXD programs. When the second-level interrupt handler completes its work, it transfers the control to the reassence program, and the registered program will resume the status of the interrupt program and continue to be executed from the previously interrupted place.

The above description is too simple. Since the time slice of the interrupted virtual machine may have passed, the reassence may not be implemented immediately. The VXD program is installed through the VMM service such as: set_pm_int or hook_v86_int_chain to install the interrupt processing. The VXD program should not directly change the interrupt inlet in the IDT (unless you know the consequences of the occurrence).

Thread scheduling

VMM uses two scheduler components to implement multi-threaded processing between the virtual machines:

Main Scheduler Time Film Manager or Second Scheduler

The mission of the main scheduler is to select a thread with the highest priority. This option is performed when the VMM is processed (such as timing interrupt). The result of the selection determines which thread / virtual machine gets control when the VMM returns from the interrupt service. The result of the main scheduler work is determined, and a thread either controls control, or no, only one thread can be controlled. VMM and other VXDs can adjust the performance priority of the thread through the VMM service. For example, when a hard interruption occurs, the VMM increases the execution priority of the interrupt processing to make it a higher opportunity to be called as short as possible.

The sub-scremer assigns a CPU time to a thread with the highest priority through the service provided by the main scheduler. The sub-scherator gives each thread a time film. When a thread is executed to its time chip end, the sub-scherator adds the priority of the next thread so that it will be selected and executed by the main scheduler.

You can get the details about this problem from the Walter ONEY's Systems Programming for Windows 95 and Windows 95 DDK documents.

转载请注明原文地址:https://www.9cbs.com/read-3823.html

New Post(0)