PsGetExtendedContext

Returns the extended register context of the current CPU core of the debug target.

Syntax

PULSE_STATUS PsGetExtendedContext(
 [in] PPS_ENGINE pEngine,
 [out] PPS_CTX_EXT pContextExt,
 [in] uint8_t ExtRegSetIndex,
 [in, out] uint64_t *pExtRegMask
);

Parameters

PPS_ENGINE pEngine

An opaque handle to an engine created by the EngCreateEngine function.

PPS_CTX_EXT pContextExt

A pointer to the PS_CTX_EXT structure that will be populated by the function call.

uint8_t ExtRegSetIndex

This field defines a register set index that will be used to select the target extended registers. Currently, only the value "0" is used; that is, it must be zero.

uint64_t *pExtRegMask

A pointer to the uint64_t variable that specifies the extended register mask that defines which registers are requested. Only the contents of the registers specified in the mask may be populated into the pContextExt parameter. Indicates which registers were populated upon return.
Currently defined values:

DBG_CTX_EX_PART_FLAG_XCR0
(1ULL << 0)
DBG_CTX_EX_PART_FLAG_FCW
(1ULL << 1)
DBG_CTX_EX_PART_FLAG_FSW
(1ULL << 2)
DBG_CTX_EX_PART_FLAG_FTW
(1ULL << 3)
DBG_CTX_EX_PART_FLAG_FOP
(1ULL << 4)
DBG_CTX_EX_PART_FLAG_FIP
(1ULL << 5)
DBG_CTX_EX_PART_FLAG_FDP
(1ULL << 6)
DBG_CTX_EX_PART_FLAG_ST0
(1ULL << 7)
DBG_CTX_EX_PART_FLAG_ST1
(1ULL << 8)
DBG_CTX_EX_PART_FLAG_ST2
(1ULL << 9)
DBG_CTX_EX_PART_FLAG_ST3
(1ULL << 10)
DBG_CTX_EX_PART_FLAG_ST4
(1ULL << 11)
DBG_CTX_EX_PART_FLAG_ST5
(1ULL << 12)
DBG_CTX_EX_PART_FLAG_ST6
(1ULL << 13)
DBG_CTX_EX_PART_FLAG_ST7
(1ULL << 14)
DBG_CTX_EX_PART_FLAG_MM0
(1ULL << 15)
DBG_CTX_EX_PART_FLAG_MM1
(1ULL << 16)
DBG_CTX_EX_PART_FLAG_MM2
(1ULL << 17)
DBG_CTX_EX_PART_FLAG_MM3
(1ULL << 18)
DBG_CTX_EX_PART_FLAG_MM4
(1ULL << 19)
DBG_CTX_EX_PART_FLAG_MM5
(1ULL << 20)
DBG_CTX_EX_PART_FLAG_MM6
(1ULL << 21)
DBG_CTX_EX_PART_FLAG_MM7
(1ULL << 22)
DBG_CTX_EX_PART_FLAG_MXCSR
(1ULL << 23)
DBG_CTX_EX_PART_FLAG_MXCSR_MASK
(1ULL << 24)
DBG_CTX_EX_PART_FLAG_XMM0
(1ULL << 25)
DBG_CTX_EX_PART_FLAG_XMM1
(1ULL << 26)
DBG_CTX_EX_PART_FLAG_XMM2
(1ULL << 27)
DBG_CTX_EX_PART_FLAG_XMM3
(1ULL << 28)
DBG_CTX_EX_PART_FLAG_XMM4
(1ULL << 29)
DBG_CTX_EX_PART_FLAG_XMM5
(1ULL << 30)
DBG_CTX_EX_PART_FLAG_XMM6
(1ULL << 31)
DBG_CTX_EX_PART_FLAG_XMM7
(1ULL << 32)
DBG_CTX_EX_PART_FLAG_XMM8
(1ULL << 33)
DBG_CTX_EX_PART_FLAG_XMM9
(1ULL << 34)
DBG_CTX_EX_PART_FLAG_XMM10
(1ULL << 35)
DBG_CTX_EX_PART_FLAG_XMM11
(1ULL << 36)
DBG_CTX_EX_PART_FLAG_XMM12
(1ULL << 37)
DBG_CTX_EX_PART_FLAG_XMM13
(1ULL << 38)
DBG_CTX_EX_PART_FLAG_XMM14
(1ULL << 39)
DBG_CTX_EX_PART_FLAG_XMM15
(1ULL << 40)
DBG_CTX_EX_PART_FLAG_YMM0
(1ULL << 41)
DBG_CTX_EX_PART_FLAG_YMM1
(1ULL << 42)
DBG_CTX_EX_PART_FLAG_YMM2
(1ULL << 43)
DBG_CTX_EX_PART_FLAG_YMM3
(1ULL << 44)
DBG_CTX_EX_PART_FLAG_YMM4
(1ULL << 45)
DBG_CTX_EX_PART_FLAG_YMM5
(1ULL << 46)
DBG_CTX_EX_PART_FLAG_YMM6
(1ULL << 47)
DBG_CTX_EX_PART_FLAG_YMM7
(1ULL << 48)
DBG_CTX_EX_PART_FLAG_YMM8
(1ULL << 49)
DBG_CTX_EX_PART_FLAG_YMM9
(1ULL << 50)
DBG_CTX_EX_PART_FLAG_YMM10
(1ULL << 51)
DBG_CTX_EX_PART_FLAG_YMM11
(1ULL << 52)
DBG_CTX_EX_PART_FLAG_YMM12
(1ULL << 53)
DBG_CTX_EX_PART_FLAG_YMM13
(1ULL << 54)
DBG_CTX_EX_PART_FLAG_YMM14
(1ULL << 55)
DBG_CTX_EX_PART_FLAG_YMM15
(1ULL << 56)

Return value

If the function succeeds, the return value is PULSE_STATUS_SUCCESS.

If it fails, it returns one of the PULSE_STATUS values. Possible return codes include, but are not limited to, the following:

PULSE_STATUS_NOT_SUPPORTED
0xC0000001
No FXSAVE or XSAVE instructions are available.
PULSE_STATUS_INSUFFICIENT_RESOURCES
0xC0000002
One of the memory allocations failed during initialization.
PULSE_STATUS_READ_FAILED
0xC0000003
Transport communication failed during a read operation.
PULSE_STATUS_WRITE_FAILED
0xC0000004
Transport communication failed during a write operation.
PULSE_STATUS_TIMEOUT
0xC0000007
Might happen if
  • Transport I/O timed out.
  • No response was received from the debuggee within the request timeout period.
PULSE_STATUS_INVALID_PARAMETER
0xC0000010
Might happen if
  • The pEngine parameter is NULL.
  • The pContextExt parameter is NULL.
  • The pExtRegMask parameter is NULL.
  • The ExtRegSetIndex parameter is not zero.
PULSE_STATUS_INVALID_PACKET
0xC0000031
An invalid or unexpected packet was received in response.
PULSE_STATUS_DEVICE_CONNECTION_LOST
0xC0000308
The connection to the transport was lost. Try restarting the engine or the transport.

Remarks

The pExtRegMask parameter allows partial context state queries.

Some of the extended states might not be available on the target CPU core. The pExtRegMask parameter will reflect the registers the function was able to obtain if it was successful. Make sure you check the pExtRegMask value on return.

Register sets are used for defining different pExtRegMask values. For example, ZMM states are to be retrieved using a different register set index and different pExtRegMask values.