Introduction to Virtual Device Drivers


Enable/Disable Virtual 8086 Mode CallBack Function



Download 274.5 Kb.
Page63/80
Date19.01.2022
Size274.5 Kb.
#58083
1   ...   59   60   61   62   63   64   65   66   ...   80
VXDS
Enable/Disable Virtual 8086 Mode CallBack Function

Some device drivers and TSRs, such as expanded memory emulators, switch the processor to virtual 8086 mode. Because Windows cannot start successfully while the processor is in this mode, any device driver or TSR that switches to virtual 8086 mode must either switch back to real mode or supply the address of a callback function that can switch between real and virtual 8086 modes.

Windows uses the callback function to disable virtual 8086 mode before Windows itself enters protected mode. Windows calls the callback function again to enable virtual 8086 mode after Windows exits protected mode. Windows calls the callback function using a far call instruction, and it specifies which action to take by setting the AX register to 0 or 1.

To disable virtual 8086 mode, Windows sets the AX register to 0, disables interrupts, and calls the callback function. The function should switch the processor to real mode, clear the carry flag to indicate success, and return. If an error occurs, the function sets the carry flag and returns. Windows checks the carry flag and terminates if it is set.

To enable virtual 8086 mode, Windows set the AX register to 1, disables interrupts, and calls the callback function. The function should switch the processor to virtual 8086 mode, clear the carry flag, and return. If an error occurs, the function sets the carry flag and returns. However, Windows ignores the carry flag, so if an error occurs no action is taken and the processor is left in real mode.

Whether an error occurs when enabling or disabling virtual 8086 mode, it is up to the callback function to display any error message to the user. Also, the callback function must not enable interrupts unless an error occurs, and the function sets the carry flag.

A device driver or TSR supplies a callback function by copying the address of the function to the DS:SI register pair when it processes the Windows Initialization Notification (Interrupt 2Fh Function 1605h). Windows permits only one callback function, so the device driver or TSR should first check to make sure that the DS and SI registers are both zero. If they are nonzero, the device driver or TSR should set the CX register to a nonzero value and return, directing Windows to terminate without starting.


Download 274.5 Kb.

Share with your friends:
1   ...   59   60   61   62   63   64   65   66   ...   80




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

    Main page