Overview

An x86-64 CPU contains a set of 16 general-purpose registers storing 64-bit values. They are used to store integers and pointers.

1 Byte2 Bytes4 Bytes8 BytesPurpose
%al%ax%eax%raxReturn value
%bl%bx%ebx%rbxCallee saved
%cl%cx%ecx%rcx4th argument
%dl%dx%edx%rdx3rd argument
%sil%si%esi%rsi2nd argument
%dil%di%edi%rdi1st argument
%bpl%bp%ebp%rbpCallee saved
%spl%sp%esp%rspStack pointer
%r8b%r8w%r8d%r85th argument
%r9b%r9w%r9d%r96th argument
%r10b%r10w%r10d%r10Caller saved
%r11b%r11w%r11d%r11Caller saved
%r12b%r12w%r12d%r12Callee saved
%r13b%r13w%r13d%r13Callee saved
%r14b%r14w%r14d%r14Callee saved
%r15b%r15w%r15d%r15Callee saved

Condition Codes

The CPU also maintains a set of single-bit condition code registers describing attributes of the most recent arithmetic or logical operation.

CodeNameDescription
CFCarry flagThe most recent operation generated a carry out of the most significant bit.
ZFZero flagThe most recent operation yielded zero.
SFSign flagThe most recent operation yielded a negative value.
OFOverflow flagThe most recent operation caused a two’s-complement overflow.

Bibliography

  • Bryant, Randal E., and David O’Hallaron. Computer Systems: A Programmer’s Perspective. Third edition, Global edition. Always Learning. Pearson, 2016.