include vmm.inc
mov ecx, flags
VMMCall Begin_V86_Serialization
Serializes access to V86 mode among all threads in the system VM by using a mutex called the "V86 mutex". Because the mutex is taken automatically when Begin_Nest_V86_Exec is called while in the system VM context, a VxD typically does not directly call this service. A VxD might call this service when it needs to perform a nested execution operation into protected mode, and the operation will be reflected into V86 mode at the end of the protected mode chain. Using this service would prevent the VxD's thread from potentially getting blocked at the end of the protected mode chain. Uses Flags.
Block_Svc_Ints | Service events (and simulated interrupts) in the VM if the thread blocks for the critical section. |
Block_Svc_If_Ints_Locked | Service events (and simulated interrupts) in the VM if the thread blocks for the critical section and the VMStat_V86IntsLocked flag is set. |
Block_Enable_Ints | Service interrupt events in the VM even if the VM does not currently have interrupts enabled (force interrupts to be enabled). This flag is relevant only if either Block_Svc_Ints or Block_Svc_If_Ints_Locked is set. |
Block_Thread_Idle | If the thread blocks for the critical section this thread should be considered idle. |
There is a hierarchy between the V86 mutex and the critical section mutex. The V86 mutex can be taken in the system VM when the critical section is owned by another VM, but in the system VM the critical section can only be owned if the V86 mutex is already owned. Calling Begin_Critical_Section in a thread in the system VM takes both mutexes.
The critical section mutex serializes access to V86 mode for all VMs. Since the System VM contains one or more threads, the system-VM-specific V86 mutex is used to serialize access to V86 mode at the thread level. Thus, when Begin_Critical_Section is called when in the System VM, both mutexes are used to ensure that the V86 mode is serialized in the System VM both at the thread level and the VM level.
Each call to Begin_V86_Serialization should have a corresponding call to End_V86_Serialization.
Begin_Critical_Section, Begin_Nest_V86_Exec, End_V86_Serialization