Linux Assemblycollection of fast libraries

Central Processing Unit (CPU) instructions set

The general-purpose instructions perform basic data movement, arithmetic, logic, program flow, and string operations which programmers commonly use to write application and system software to run on Intel 64 and IA-32 processors. They operate on data contained in memory, in the general-purpose registers (EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP) and in the EFLAGS register. They also operate on address information contained in memory, the general-purpose registers, and the segment registers (CS, DS, SS, ES, FS, and GS).

Contents

Tip: For detailed information about each instruction please read: Intel Architectures Software Developer’s Manual Volume 2: Instruction Set Reference, A-Z

Data Transfer Instructions

InstructionMeaning
BSWAPByte swap
MOVBEMove data after swapping data bytes
MOVMove data between general-purpose registers, segment registers, memory, and from immediate to general-purpose registers
MOVZXMove and zero extend
MOVSXMove and sign extend
MOVSXDMove and sign extend
CMOVEConditional move if equal
CMOVAConditional move if above
CMOVAEConditional move if above or equal
CMOVBConditional move if below
CMOVBEConditional move if below or equal
CMOVGConditional move if greater
CMOVGEConditional move if greater or equal
CMOVLConditional move if less
CMOVLEConditional move if less or equal
CMOVZConditional move if zero
CMOVCConditional move if carry
CMOVOConditional move if overflow
CMOVSConditional move if sign (negative)
CMOVPConditional move if parity
CMOVNEConditional move if not equal
CMOVNAConditional move if not above
CMOVNAEConditional move if not above or equal
CMOVNBConditional move if not below
CMOVNBEConditional move if not below or equal
CMOVNGConditional move if not greater
CMOVNGEConditional move if not greater or equal
CMOVNLConditional move if not less
CMOVNLEConditional move if not less or equal
CMOVNZConditional move if not zero
CMOVNCConditional move if not carry
CMOVNOConditional move if not overflow
CMOVNSConditional move if not sign (non-negative)
CMOVNPConditional move if not parity
CMOVPEConditional move if parity even
CMOVPOConditional move if parity odd
CBWConvert byte to word (sign-extend of AL to AX)
CWDConvert word to double word (sign-extend of AX to DX:AX)
CDQConvert double word to quad word (sign-extend of EAX to EDX:EAX)
CQOConvert quad word to octal word (sign-extend of RAX to RDX:RAX)
CWDEConvert word to double word (sign-extend of AX to EAX)
CDQEConvert double word to quad word (sign-extend of EAX to RAX)
PUSHPush onto stack
PUSHAPush general-purpose registers: AX, CX, DX, BX, SP, BP, SI, DI onto stack
PUSHADPush general-purpose registers: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI onto stack
POPPop off of stack
POPAPop general-purpose registers: DI, SI, BP, BX, DX, CX, AX from stack
POPADPop general-purpose registers: EDI, ESI, EBP, EBX, EDX, ECX, EAX from stack
XLATBTable lookup translation
XCHGExchange
XADDExchange and add
CMPXCHGCompare and exchange
CMPXCHG8BCompare and exchange 8 bytes
CMPXCHG16BCompare and exchange 16 bytes

Binary Arithmetic Instructions

InstructionMeaning
ADCXUnsigned integer add with carry
ADOXUnsigned integer add with overflow
INCIncrement
ADDAdd
ADCAdd with carry
DECDecrement
SUBSubtract
SBBSubtract with borrow
MULUnsigned multiply
IMULSigned multiply
DIVUnsigned divide
IDIVSigned divide
NEGNegate
CMPCompare

Decimal Arithmetic Instructions

InstructionMeaning
DAADecimal adjust after addition
DASDecimal adjust after subtraction
AAAASCII adjust after addition
AASASCII adjust after subtraction
AAMASCII adjust after multiplication
AADASCII adjust before division

Logical Instructions

InstructionMeaning
ANDPerform bitwise logical AND
ORPerform bitwise logical OR
XORPerform bitwise logical exclusive OR
NOTPerform bitwise logical NOT

Shift and Rotate Instructions

InstructionMeaning
SHLShift logical left
SHLDShift left double
SHRShift logical right
SHRDShift right double
SALShift arithmetic left
SARShift arithmetic right
ROLRotate left
RORRotate right
RCLRotate through carry left
RCRRotate through carry right

Bit and Byte Instructions

InstructionMeaning
POPCNTCompute number of bits set to 1
TESTLogical compare
BTBit test
BTSBit test and set
BTRBit test and reset
BTCBit test and complement
BSFBit scan forward
BSRBit scan reverse
SETESet byte if equal
SETASet byte if above
SETAESet byte if above or equal
SETBSet byte if below
SETBESet byte if below or equal
SETGSet byte if greater
SETGESet byte if greater or equal
SETLSet byte if less
SETLESet byte if less or equal
SETZSet byte if zero
SETCSet byte if carry
SETOSet byte if overflow
SETSSet byte if sign (negative)
SETPSet byte if parity
SETNESet byte if not equal
SETNASet byte if not above
SETNAESet byte if not above or equal
SETNBSet byte if not below
SETNBESet byte if not below or equal
SETNGSet byte if not greater
SETNGESet byte if not greater or equal
SETNLSet byte if not less
SETNLESet byte if not less or equal
SETNZSet byte if not zero
SETNCSet byte if not carry
SETNOSet byte if not overflow
SETNSSet byte if not sign (non-negative)
SETNPSet byte if not parity
SETPESet byte if parity even
SETPOSet byte if parity odd

I/O and String Instructions

InstructionMeaning
INRead from a port
OUTWrite to a port
INSBInput byte string from port
INSWInput word string from port
INSDInput double word string from port
OUTSBOutput byte string to port
OUTSWOutput word string to port
OUTSDOutput double word string to port
LODSBLoad byte string
LODSWLoad word string
LODSDLoad double word string
LODSQLoad quad word string
STOSBStore byte string
STOSWStore word string
STOSDStore double word string
STOSQStore quad word string
MOVSBMove byte string
MOVSWMove word string
MOVSDMove double word string
MOVSQMove quad word string
CMPSBCompare byte string
CMPSWCompare word string
CMPSDCompare double word string
CMPSQCompare quad word string
SCASBScan byte string
SCASWScan word string
SCASDScan double word string
SCASQScan quad word string
REPRepeat while ECX not zero
REPERepeat while equal
REPZRepeat while zero
REPNERepeat while not equal
REPNZRepeat while not zero

Control Transfer Instructions

InstructionMeaning
JMPJump
JEJump if equal
JAJump if above
JAEJump if above or equal
JBJump if below
JBEJump if below or equal
JGJump if greater
JGEJump if greater or equal
JLJump if less
JLEJump if less or equal
JZJump if zero
JCJump if carry
JOJump if overflow
JSJump if sign (negative)
JPJump if parity
JNEJump if not equal
JNAJump if not above
JNAEJump if not above or equal
JNBJump if not below
JNBEJump if not below or equal
JNGJump if not greater
JNGEJump if not greater or equal
JNLJump if not less
JNLEJump if not less or equal
JNZJump if not zero
JNCJump if not carry
JNOJump if not overflow
JNSJump if not sign (non-negative)
JNPJump if not parity
JPEJump if parity even
JPOJump if parity odd
JCXZJump register CX zero
JECXZJump register ECX zero
LOOPLoop with ECX counter
LOOPELoop with ECX and equal
LOOPZLoop with ECX and zero
LOOPNELoop with ECX and not equal
LOOPNZLoop with ECX and not zero
CALLCall procedure
RETReturn
IRETReturn from interrupt
INTSoftware interrupt
INTOInterrupt on overflow
BOUNDDetect value out of range

High Level Procedure Instructions

InstructionMeaning
ENTERHigh-level procedure entry
LEAVEHigh-level procedure exit

Flag Control Instructions

InstructionMeaning
STISet interrupt flag
STDSet direction flag
STCSet carry flag
CLIClear the interrupt flag
CLDClear the direction flag
CLCClear the carry flag
CMCComplement the carry flag
STACSet AC flag in EFLAGS register
CLACClear AC flag in EFLAGS register
LAHFLoad flags into AH register
SAHFStore AH register into flags
PUSHFPush lower 16 bits of EFLAGS onto stack
PUSHFDPush EFLAGS onto stack
PUSHFQPush RFLAGS onto stack
POPFPush lower 16 bits of EFLAGS from stack
POPFDPop EFLAGS from stack
POPFQPop RFLAGS from stack

Miscellaneous Instructions

InstructionMeaning
LEALoad effective address
NOPNo operation
UD2Undefined instruction
RDPIDRead processor ID
CPUIDProcessor identification
CRC32Provides hardware acceleration to calculate cyclic redundancy checks for fast and efficient implementation of data integrity protocols

Random Number Generator Instructions

InstructionMeaning
RDRANDRetrieves a random number generated from hardware
RDSEEDRetrieves a random number generated from hardware

Bit manipulation instructions

InstructionMeaning
BEXTRContiguous bitwise extract
BLSIExtract lowest set bit
BLSRReset lowest set bit
BLSMSKSet all lower bits below first set bit to 1
BZHIZero high bits starting from specified bit position
PEXTParallel extraction of bits using a mask
PDEPParallel deposit of bits using a mask
TZCNTCount the number trailing zero bits
LZCNTCount the number leading zero bits
ANDNBitwise AND of first source with inverted 2nd source operands
MULXUnsigned multiply without affecting flags
SHLXShift logic left without affecting flags
SHRXShift logic right without affecting flags
SARXShift arithmetic right without affecting flags
RORXRotate right without affecting flags

Segment Register Instructions

InstructionMeaning
LDSLoad far pointer using DS
LESLoad far pointer using ES
LFSLoad far pointer using FS
LGSLoad far pointer using GS
LSSLoad far pointer using SS

System Instructions

InstructionMeaning
LLDTLoad local descriptor table (LDT) register
SLDTStore local descriptor table (LDT) register
LGDTLoad global descriptor table (GDT) register
SGDTStore global descriptor table (GDT) register
LIDTLoad interrupt descriptor table (IDT) register
SIDTStore interrupt descriptor table (IDT) register
LMSWLoad machine status word
SMSWStore machine status word
LTRLoad task register
STRStore task register
XSAVESave processor extended states to memory
XSAVESSave processor extended states supervisor
XSAVECSave processor extended states with compaction
XSAVEOPTSave processor extended states to memory, optimized
XRSTORRestore processor extended states from memory
XRSTORSRestore processor extended states supervisor
RDMSRRead model-specific register
WRMSRWrite model-specific register
XGETBVReads the state of an extended control register
XSETBVWrites the state of an extended control register
RDFSBASEReads from FS base address at any privilege level
WRFSBASEWrites to FS base address at any privilege level
RDGSBASEReads from GS base address at any privilege level
WRGSBASEWrites to GS base address at any privilege level
VERRVerify segment for reading
VERWVerify segment for writing
MOVLoad and store control registers
MOVLoad and store debug registers
LARLoad access rights
LSLLoad segment limit
RDPMCRead performance monitoring counter
RDTSCRead time stamp counter
RDTSCPRead time stamp counter and processor ID
CLTSClear the task-switched flag
ARPLAdjust requested privilege level
INVDInvalidate cache, no write back
WBINVDInvalidate cache, with write back
INVLPGInvalidate TLB entry
INVPCIDInvalidate process-context identifier
LOCKLock bus (prefix)
HLTHalt processor
SYSENTERFast system call, transfers to a flat protected mode kernel at CPL = 0
SYSEXITFast system call, transfers to a flat protected mode kernel at CPL = 3
SYSCALLFast call to privilege level 0 system procedures
SYSRETReturn from fast system call
RSMReturn from system management mode (SMM)
SWAPGSExchanges current GS base register value with value in MSR address 0xC0000102
RDPKRURead protection key rights for user pages
WRPKRUWrite data to user page key register
Copyright 2012-2018 Jack Black. All rights reserved.