carry flag (CF): set if result of unsigned arithmetic operation is too large for destination.
overthrow flag (OF): set if result of signed arithmetic operation is too large for destination.
sign flag (SF): set if arithmetic or logical operation results in a negative outcome.
zero flag (ZF): set if result of arithmetic or logical operation is zero.
auxiliary carry flag (AC)
parity flag (PF)
Direction flag
The Direction flag applies to REP-instructions such as MOVS, MOVSD, MOVSW etc.
If it is set, strings are processed from highest to lowest address (»auto decrementing«), if it is cleared, strings are processed from lowest to highest address (»auto incrementing«).
The direction flag is cleared with the CLD istruction and set with the STD instruction.
Segment registers
An instruction that refers to a memory address implicitly uses a segment register. For example, a jump instruction uses cs, a push instruction uses ss.
Most segment registers can be assigned a value with the mov instruction. However cs can only be assigned with jmp and call.
There are six segment registers: cs, ds, ss, es, fs and gs.
x86_64
The registers were extended to 64 bits: rax … rdx, rsp etc.
General purpose registers were added: r8 … r15. The lower 32/16/8 bits of these registers are referred to as rXd, rXw and rXb.
On x64, an operation that writes to a 32-bit register zero-extends the result.
Clobber registers
With respect to an API (such as the WinAPI), registers that can be overwritten in a function of this API are called clobber registers.
In the 32-bit WinAPI, the clobber registers are eax, ecx and edx. In the 64-bit WinAPI, all registers are clobber registers except rbp, rbx, rdi, rsi, r12, r13, r14 and r15.
TSC
Some Intel and AMD processors feature a 64-bit TSC register whose value monotonously increases by one, usually at the rate of the processor clock.
The rdtsc or rdtscp instructions allows to read the value of this register with low access time, typically less than hundreds or even tens of machine cycles.
The TSC register is based on a crystal oscillator whose frequency is not known in advance, hence, the frequency must be calibrated to use it for time measurement.
It should be noted that there are non-invariant TSC registers where the frequency of value increase might vary.
TODO
The CONTEXT structure (that is defined in winnt.h.
MSVC comes with intrinsics to read the fs and gs registers: __readfs* and __readgs*.