Begin_Critical_Section


include vmm.inc

mov     ecx, Flags
VMMcall Begin_Critical_Section

Claims a critical section for the current virtual machine. Only one virtual machine at a time can enter a critical section. If a virtual device calls this service after another virtual machine has entered a critical section, the system blocks the calling virtual machine until the critical section is released. Uses Flags.

Flags

Action to take when interrupts occur while the virtual machine is blocked waiting for the critical section. This parameter can be a combination of the following values:

Block_Enable_Ints

Service interrupts in the virtual machine even if the virtual machine does not currently have interrupts enabled. This forces interrupts to be enabled. This value is only relevant if either Block_Svc_Ints or Block_Svc_If_Ints_Locked is set.

Block_Svc_If_Ints_Locked

Service events and simulated interrupts in the virtual machine if the thread blocks for the critical section and the VMStat_V86IntsLocked flag is set.

Block_Svc_Ints

Service events and simulated interrupts in the virtual machine if the thread blocks for the critical section.

Block_Thread_Idle

Consider the thread to be idle if it blocks for the critical section.


The Block_Poll value is reserved and must not be used with this service.

The system maintains a count of claims for critical sections and releases the critical section only when an equal number of Begin_Critical_Section and End_Critical_Section services have been called. Calling Begin_Critical_Section before the critical section is released does not increment the claim count.

When the critical section is first claimed, the system boosts the execution priority of the current virtual machine by the Critical_Section_Boost value (as described for the Adjust_Exec_Priority service). While a virtual machine is in a critical section, the system will switch to another task only if the virtual machine blocks on a semaphore or the other task has a time-critical operation, such as simulating hardware interrupts.

See also Adjust_Exec_Priority, End_Critical_Section