rtm

package module
v0.0.0-...-f9eb594 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2017 License: MIT Imports: 0 Imported by: 2

README

Go Report Card GoDoc MIT licensed

Transactional Synchronization Extensions (TSX) is an extension to the Intel x86 ISA adding hardware transactional memory support.

Restricted Transactional Memory (RTM) uses new XBEGIN and XEND instructions to mark start and end of a critical section. The processor would treat this section as an atomic transaction.

This package exposes these primitives to the developer.

This code doesn't check if the CPU supports RTM at all, so it is necessary to do it first, e.g.:

import (
  "github.com/intel-go/cpuid"
)

func CpuHasRTM() bool {
	return cpuid.HasExtendedFeature(cpuid.RTM)
}

Caveat: Golang will not inline assembly at the moment so using this might be slower than similar GCC implementation.

Have a look at Intel's "Intrinsics for Restricted Transactional Memory Operations" for more background.

Documentation

Overview

Package rtm provides primitives for Intel's Restricted Transactional Memory Operations

Index

Constants

View Source
const (
	// TxBeginStarted is returned by TxBegin() when transaction is started
	TxBeginStarted uint32 = ^uint32(0)
	// TxAbortExplicit bit is set if abort caused by explicit abort instruction.
	TxAbortExplicit uint32 = (1 << 0)
	// TxAbortRetry bit is set if the transaction may succeed on a retry
	TxAbortRetry uint32 = (1 << 1)
	// TxAbortConflict bit is set if another logical processor triggered a
	// conflict with a memory address that was part of the transaction
	TxAbortConflict uint32 = (1 << 2)
	// TxAbortCapacity bit is set if RTM buffer overflowed
	TxAbortCapacity uint32 = (1 << 3)
	// TxAbortDebug is set if debug breakpoint triggered
	TxAbortDebug uint32 = (1 << 4)
	// TxAbortNested is set if abort occurred in a nested transaction
	TxAbortNested uint32 = (1 << 5)
)

Variables

This section is empty.

Functions

func GetImm

func GetImm(status uint32) uint8

GetImm returns uint8 value from the uint32 status returned by TxBegin

func TxAbort

func TxAbort()

TxAbort aborts transaction

func TxBegin

func TxBegin() (status uint32)

TxBegin marks the start of transaction. It will return a status code different to TxBeginStarted when the transaction fails.

func TxEnd

func TxEnd()

TxEnd marks the end of transaction

func TxTest

func TxTest() (status uint8)

TxTest returns uint8(1) if the processor is executing a transactional region.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL