Intel / AMD CPU Internals
These notes are taken from Intel SDM. You can consider them as a short/resumed version of some parts of the manuals that I found worth looking at when learning about system programming, OS internals or virtualization.
Protected mode:
real-mode 8086 software in protected, multi-tasking env.Real-address mode:
System Management Mode (SMM):
Intel 64 architecture adds the IA-32e mode. IA-32e mode has two sub-modes:
flat, segmented, or real address mode.Code, data, and stacks are all contained in this address space (from 0 to 2^32 - 1 in non x64 mode).Physical Address Extensions (PAE) to address physical address space greater than 4 GB.Page Size Extensions (PSE) to map linear address to physical address in 4-MB pages.The segment registers (CS, DS, SS, ES, FS, and GS) hold 16-bit segment selectors.
A segment selector is a special pointer that identifies a segment in memory.
To access a particular segment in memory, the segment selector for that segment must be present in the appropriate segment register.
When using the flat (unsegmented) memory model, segment registers are loaded with segment selectors that point to overlapping segments, each of which begins at address 0 of the linear address space. These overlapping segments then comprise the linear address space for the program.
Typically, two overlapping segments are defined: one for code and another for data and stacks.
The CS segment register points to the code segment and all the other segment registers point to the data and stack segment.
When using the segmented memory model, each segment register is ordinarily loaded with a different segment selector so that each segment register points to a different segment within the linear address space.
At any time, a program can thus access up to six segments in the linear address space. To access a segment not pointed to by one of the segment registers, a program must first load the segment selector for the segment to be accessed into a segment register.
Each of the segment registers is associated with one of three types of storage: code, data, or stack.
The CS register contains the segment selector for the code segment where the instructions being executed are located.
EXCEPTION_ILLEGAL_INSTRUCTION.The DS, ES, FS, and GS registers point to four data segments.
The availability of four data segments permits efficient and secure access to different types of data structures.
The SS register contains the segment selector for the stack segment.
If you dont precise the segment, the compiler will use explicitely:
No open issues yet, or sync has not completed.