HvFlushVirtualAddressSpace function
The HvFlushVirtualAddressSpace function invalidates all virtual TLB entries that belong to a specified address space.
Syntax
HV_STATUS HvFlushVirtualAddressSpace( _In_ HV_ADDRESS_SPACE_ID AddressSpace, _In_ HV_FLUSH_FLAGS Flags, _In_ UINT64 ProcessorMask );
Parameters
- AddressSpace [in]
-
An HV_ADDRESS_SPACE_ID value that identifies the address space to flush (that is, a CR3 value). HV_ADDRESS_SPACE_ID is defined as an unsigned 64-bit (UINT64) value.
- Flags [in]
-
A valid bitwise OR combination of HV_FLUSH_FLAGS values that specify a set of flag bits that modify the operation of the flush. HV_FLUSH_FLAGS is defined as an unsigned 32-bit (UINT32) value. For more information about flush flags, see Virtual MMU Data Types.
- ProcessorMask [in]
-
A processor mask that indicates which processors should be affected by the flush operation.
Return value
HvFlushVirtualAddressSpace returns one of the following values. In addition to these values, HvFlushVirtualAddressSpace can also return one of the values that are specified in Common Hypercall Status Codes.
Return code | Description |
---|---|
|
HvFlushVirtualAddressSpace successfully flushed the specified virtual address space. |
|
One of the following invalid parameter conditions exists:
|
Remarks
The HvFlushVirtualAddressSpace virtual TLB invalidation operation acts on one or more processors.
If the guest has information about which processors might need to be flushed, it can specify a processor mask in the ProcessorMask parameter. Each bit in the mask corresponds to a virtual processor index. For example, a mask of 0x0000000000000051 indicates that the hypervisor should flush only the TLB of virtual processors 0, 4, and 6. A virtual processor can determine its index by reading from MSR HV_X64_MSR_VP_INDEX.
The following flags can be used to modify the behavior of the flush:
-
HV_FLUSH_ALL_PROCESSORS (0x00000001) indicates that the operation should apply to all virtual processors within the partition. If this flag is set, the ProcessorMask parameter is ignored.
-
HV_FLUSH_ALL_VIRTUAL_ADDRESS_SPACES (0x00000002) indicates that the operation should apply to all virtual address spaces. If this flag is set, the AddressSpace parameter is ignored.
-
HV_FLUSH_NON_GLOBAL_MAPPINGS_ONLY (0x00000004) indicates that the hypervisor is required only to flush page mappings that were not mapped as global (that is, the x64 G bit was set in the page table entry). Global entries might be (but are not required to be) left unflushed by the hypervisor.
All other flags are reserved and must be set to zero.
HvFlushVirtualAddressSpace guarantees that by the time control returns back to the caller, the observable effects of all flushes on the specified virtual processors have occurred.
If a target virtual processor's TLB requires flushing and that virtual processor's TLB is currently locked, the caller's virtual processor is suspended and a message is sent to the parent. When the caller's virtual processor is unsuspended, the hypercall will be reissued. For more information about TLB locking, see Restrictions on TLB Flushes.
Native Interface
HvFlushVirtualAddressSpace | |
---|---|
Call Code = 0x0002 | |
Input Parameters | |
0 |
AddressSpace (8 bytes) |
8 |
Flags (8 bytes) |
16 |
ProcessorMask (8 bytes) |
Requirements
Version | HvFlushVirtualAddressSpace is available in version 1.0 and later versions of the hypervisor. |
---|---|
Header |
|
IRQL | Any level |
Send comments about this topic to Microsoft
Build date: 11/16/2013