tbegin.
Transaction Begin
Initiates a hardware transaction. If the transaction fails, execution rolls back to this point. Sets CR0 based on success/failure.
Details
Initiates a hardware transaction, setting the transaction active state and recording checkpoint information. If execution completes successfully within the transaction, tbegin. sets CR0[EQ] = 1; if the transaction is aborted, execution rolls back to this instruction and CR0[EQ] = 0, with CR0[SO] indicating the abort cause. The R field determines whether a transaction failure causes an external rollback (R=0) or an internal retry (R=1). Requires Transactional Memory (TM) facility support.
Pseudocode Operation
if transaction initiated successfully then CR0[EQ] ← 1 else CR0[EQ] ← 0; CR0[LT,GT,SO] set based on abort cause; transaction state is active
Programming Note
In synthetic TM mode, transactions initiated by tbegin will fail immediately, invoking the failure handler. Ensure that your application logic correctly handles transaction failures to maintain data integrity.
Example
// Start atomic hardware transaction.
Encoding
Operands
-
R
Rollback Handler (0=External, 1=Internal)