xend
Transaction End
XEND
Specifies end of RTM region.
Details
Marks the end of a Restricted Transactional Memory (RTM) region and commits all buffered memory writes if the transaction succeeds. If the transaction has been aborted prior, XEND is a no-op; no flags are modified. Requires RTM extension and must be paired with XBEGIN.
Pseudocode Operation
if (RTM_TransactionActive) {
if (RTMAborted) {
// No-op; abort already occurred
} else {
// Commit buffered writes atomically
CommitBufferedWrites();
RTM_TransactionActive ← 0;
}
// No flags modified
}
Example
XEND
Encoding
Binary Layout
0F
+0
01
+1
D5
+2
Operands
Reference (Intel® SDM)
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| NP 0F 01 D5 | XEND | A | V/V | RTM | Specifies the end of an RTM code region. |
Instruction Operand Encoding
| Op/En | Operand 1 | Operand 2 | Operand 3 | Operand 4 |
|---|---|---|---|---|
| A | N/A | N/A | N/A | N/A |
Description
The instruction marks the end of an RTM code region. If this corresponds to the outermost scope (that is, including this XEND instruction, the number of XBEGIN instructions is the same as number of XEND instructions), the logical processor will attempt to commit the logical processor state atomically. If the commit fails, the logical processor will rollback all architectural register and memory updates performed during the RTM execution. The logical processor will resume execution at the fallback address computed from the outermost XBEGIN instruction. The EAX register is updated to reflect RTM abort information.
Execution of XEND outside a transactional region causes a general-protection exception (#GP). Execution of XEND while in a suspend read address tracking region causes a transactional abort.
Operation
XEND IF (RTM_ACTIVE = 0) THEN SIGNAL #GP ELSE IF SUSLDTRK_ACTIVE = 1 THEN GOTO RTM_ABORT_PROCESSING; FI; RTM_NEST_COUNT-- IF (RTM_NEST_COUNT = 0) THEN Try to commit transaction IF fail to commit transactional execution THEN GOTO RTM_ABORT_PROCESSING; ELSE (* commit success *) RTM_ACTIVE := 0 FI; FI; FI; (* For any RTM abort condition encountered during RTM execution *) RTM_ABORT_PROCESSING: Restore architectural register state Discard memory updates performed in transaction Update EAX with status RTM_NEST_COUNT := 0 RTM_ACTIVE := 0 SUSLDTRK_ACTIVE := 0 IF 64-bit Mode THEN XEND—Transactional End Vol. 2D 6-33 RIP := fallbackRIP ELSE EIP := fallbackEIP FI; END
Intel C/C++ Compiler Intrinsic Equivalent
XEND void _xend( void );
Flags Affected
None.
Exceptions
SIMD Floating-Point Exceptions
None.
Other Exceptions
#UDCPUID.07H.00H:EBX.RTM[11] = 0.
If LOCK prefix is used.
#GP(0) If RTM_ACTIVE = 0.
XEND—Transactional End Vol. 2D 6-34