HvCreatePort function
The HvCreatePort function allocates a port object and a set of sixteen message buffers to store queued pending messages.
Syntax
HV_STATUS HvCreatePort( _In_ HV_PARTITION_ID PortPartition, _In_ HV_PORT_ID PortId, _In_ HV_PARTITION_ID ConnectionPartition, _In_ PCHV_PORT_INFO PortInfo );
Parameters
- PortPartition [in]
-
An HV_PARTITION_ID value that identifies the partition that is to receive messages or events through the port that HvCreatePort creates. HV_PARTITION_ID is defined as an unsigned 64-bit (UINT64) value.
- PortId [in]
-
An HV_PORT_ID value that identifies the port to create. The port identifier must be unique among all port identifiers for the partition that PortPartition specifies. The port identifier is used to refer to the port. The port identifier is also used to identify the source of a message when it arrives.
- ConnectionPartition [in]
-
An HV_PARTITION_ID value that identifies the partition that is allowed to send messages or events through the port that PortId identifies.
- PortInfo [in]
-
A pointer to a HV_PORT_INFO structure that describes the port to create.
If the PortType member of HV_PORT_INFO is set to HvPortTypeMessage, the following table shows other members of HV_PORT_INFO for the native interface.
1st 8-byte
TargetSint (4 bytes)
TargetVp (4 bytes)
2nd 8-byte
PortType (4 bytes) = HvPortTypeMessage
Padding (4 bytes)
3rd 8-byte
RsvdZ (8 bytes)
If the PortType member of HV_PORT_INFO is set to HvPortTypeEvent, the following table shows other members of HV_PORT_INFO for the native interface.
1st 8-byte
TargetSint (4 bytes)
TargetVp (4 bytes)
2nd 8-byte
PortType (4 bytes) = HvPortTypeEvent
Padding (4 bytes)
3rd 8-byte
- BaseFlagNumber
- (2 bytes)
- FlagCount
- (2 bytes)
RsvdZ (4 bytes)
Return value
HvCreatePort returns one of the following values. In addition to these values, HvCreatePort can also return one of the values that are specified in Common Hypercall Status Codes.
Return code | Description |
---|---|
|
HvCreatePort successfully created a port. |
|
Neither of the following is true:
|
|
One of the following invalid partition conditions exists:
|
|
One of the following invalid port conditions exists:
|
|
The specified virtual processor index does not reference a valid VP and is not HV_ANY_VP. |
|
One of the following invalid parameter conditions exists:
|
|
The specified port or connection partition is not in the active state. |
|
The number of pages in the memory pool of the caller is insufficient to perform the operation. |
|
A required system resource is unavailable or an implementation limit has been reached. |
Remarks
HvCreatePort allocates the memory for the port object and the message buffers from the memory pool of the partition that the PortPartition parameter identifies.
The port identifier that the PortId parameter specifies must be unique among all ports that are associated with the receive partition (that is, the partition that the PortPartition parameter specifies).
The caller must specify a partition in the ConnectionPartition parameter to prevent other partitions from maliciously connecting to the newly-created port. Only connections from the specified partition will be allowed.
HvCreatePort has the following restrictions:
-
The caller must possess the CreatePort privilege.
-
The partitions that are specified by PortPartition and ConnectionPartition must be in the active state.
-
The caller must be the parent of the partition that is specified by PortPartition, or the caller must possess the CreatePort privilege and specify its own partition identifier.
Native Interface
HvCreatePort | |
---|---|
Call Code = 0x0057 | |
Input Parameters | |
0 |
PortPartition (8 bytes) |
8 |
PortId (4 bytes) Padding (4 bytes) |
16 |
ConnectionPartition (8 bytes) |
24 |
PortTypeInfo (24 bytes) |
32 | |
40 |
Requirements
Version | HvCreatePort is available in version 1.0 and later versions of the hypervisor. |
---|---|
Header |
|
IRQL | Callers of HvCreatePort can be running at any IRQL. |
See also
Send comments about this topic to Microsoft
Build date: 11/16/2013