Home /Modules/cpu/SPECIFICATION.md

SPECIFICATION.md

lib/cpu/x86/SPECIFICATION.md · 46 line(s) · markdown

x86 / x86-64 Specification

General-purpose registers

Legacy/compatibility programming exposes eight primary GPRs with multiple operand widths. In 64-bit mode the GPRs are 64-bit and R8-R15 are added. citeturn0search24turn0search28

ResourceLegacy64-bit mode
Primary GPRs816
GPR widthup to 32-bit64-bit
Instruction pointerIP/EIPRIP
FlagsFLAGS/EFLAGSRFLAGS
Segment registerspresentarchitectural but largely reduced in 64-bit code/data use

Instruction encoding

x86 instructions are variable length. Encoding may include prefixes, opcode bytes, ModR/M, SIB, displacement, and immediate fields. Intel documents instruction encoding and complete instruction references in Volume 2. citeturn0search6

SLeeLa therefore uses a variable-length decoder rather than the fixed-width decoder used by MIPS and PowerPC.

Execution

The architectural model includes:

Segmentation and paging

Legacy x86 provides segmentation. Modern 64-bit mode substantially changes segment-limit behavior, while paging supplies linear-to-physical translation. AMD documents these 64-bit segmentation changes, and Intel documents paging structures and TLB caching. citeturn0search25turn0search26

Exceptions

The system model includes faults, traps, aborts, hardware interrupts, software interrupts, descriptor-table state, privilege checks, and interrupt delivery.

MSRs / control registers

CR0-CR4, CR8 where applicable, debug registers, descriptor-table registers, MSRs, and model-specific state are represented separately from the general register file.