Developer Guide and Reference

Contents

_xbegin

Specifies the start of a restricted transactional memory (RTM) code region and returns a value indicating status. The corresponding Intel® AVX2 instruction is
XBEGIN
.

Syntax

unsigned int _xbegin(void);
Arguments
None.
Description
Starts a RTM code region and returns a value indicating transaction successfully started or status from a transaction abort.
If the logical processor was not already in transactional execution, then the
xbegin
instruction causes the logical processor to start transactional execution. The
xbegin
instruction that transitions the logical processor into transactional execution is referred to as the outermost
xbegin
instruction.
The
xbegin
instruction specifies a relative offset to the fallback code path executed following a transactional abort. To promote proper program structure, this is not exposed in C++ code and the intrinsic function operates as if it invoked the following model code:
__inline unsigned int _xbegin() { unsigned status; __asm { move eax, 0xFFFFFFFF xbegin _txnL1 _txnL1: move status, eax } return status; }
When a transaction is successfully created the function will return
0xFFFFFFFF
, which is never a valid status code for an aborted transaction. If the transaction aborts for any reason, the logical processor discards all architectural register and memory updates performed during the transaction execution and restores the architectural state to that corresponding to the outermost
xbegin
instruction. The EAX register is then updated with the status code of the aborted transaction, which can be used to transfer control to a fallback handler.
The instruction also specifies a relative offset to compute the address of the fallback code path following a transactional abort. On an RTM abort, the logical processor discards all architectural register and memory updates performed during the RTM execution and restores architectural state to that corresponding to the outermost
xbegin
instruction. The abort destination operand of the
xbegin
instruction is targeted to the following instruction so that there is no change i