Control registers in x86 series[edit]

CR0[edit]

The CR0 register is 32 bits long on the 386 and higher processors. On x86-64 processors in long mode, it (and the other control registers) is 64 bits long. CR0 has various control flags that modify the basic operation of the processor.

BitNameFull NameDescription
31PGPagingIf 1, enable paging and use the CR3 register, else disable paging
30CDCache disableGlobally enables/disable the memory cache
29NWNot-write throughGlobally enables/disable write-through caching
18AMAlignment maskAlignment check enabled if AM set, AC flag (in EFLAGS register) set, and privilege level is 3
16WPWrite protectWhen set, the CPU can't write to read-only pages when privilege level is 0
5NENumeric errorEnable internal x87 floating point error reporting when set, else enables PC style x87 error detection
4ETExtension typeOn the 386, it allowed to specify whether the external math coprocessor was an 80287 or 80387
3TSTask switchedAllows saving x87 task context upon a task switch only after x87 instruction used
2EMEmulationIf set, no x87 floating point unit present, if clear, x87 FPU present
1MPMonitor co-processorControls interaction of WAIT/FWAIT instructions with TS flag in CR0
0PEProtected Mode EnableIf 1, system is in protected mode, else system is in real mode

CR1[edit]

Reserved

CR2[edit]

Contains a value called Page Fault Linear Address (PFLA). When a page fault occurs, the address the program attempted to access is stored in the CR2 register.

CR3[edit]

Typical use of CR3 in address translation with 4 KiB pages.

Used when virtual addressing is enabled, hence when the PG bit is set in CR0. CR3 enables the processor to translate linear addresses into physical addresses by locating the page directory and page tables for the current task. Typically, the upper 20 bits of CR3 become the page directory base register (PDBR), which stores the physical address of the first page directory entry.

CR4[edit]

Used in protected mode to control operations such as virtual-8086 support, enabling I/O breakpoints, page size extension and machine check exceptions.

BitNameFull NameDescription
22PKEProtection Key EnableSee Intel® 64 and IA-32 Architectures Software Developer’s Manual
21SMAPSupervisor Mode Access Protection EnableIf set, access of data in a higher ring generates a fault[1]
20SMEPSupervisor Mode Execution Protection EnableIf set, execution of code in a higher ring generates a fault
18OSXSAVEXSAVE and Processor Extended States Enable
17PCIDEPCID EnableIf set, enables process-context identifiers (PCIDs).
16FSGSBASEEnables the instructions RDFSBASE, RDGSBASE, WRFSBASE, and WRGSBASE.
14SMXESafer Mode Extensions Enablesee Trusted Execution Technology (TXT)
13VMXEVirtual Machine Extensions Enablesee Intel VT-x
10OSXMMEXCPTOperating System Support for Unmasked SIMD Floating-Point ExceptionsIf set, enables unmasked SSE exceptions.
9OSFXSROperating system support for FXSAVE and FXRSTOR instructionsIf set, enables SSE instructions and fast FPU save & restore
8PCEPerformance-Monitoring Counter enableIf set, RDPMC can be executed at any privilege level, else RDPMC can only be used in ring 0.
7PGEPage Global EnabledIf set, address translations (PDE or PTE records) may be shared between address spaces.
6MCEMachine Check ExceptionIf set, enables machine check interrupts to occur.
5PAEPhysical Address ExtensionIf set, changes page table layout to translate 32-bit virtual addresses into extended 36-bit physical addresses.
4PSEPage Size ExtensionIf unset, page size is 4 KiB, else page size is increased to 4 MiB (or 2 MiB with PAE set).
3DEDebugging ExtensionsIf set, enables debug register based breaks on I/O space access
2TSDTime Stamp DisableIf set, RDTSC instruction can only be executed when in ring 0, otherwise RDTSC can be used at any privilege level.
1PVIProtected-mode Virtual InterruptsIf set, enables support for the virtual interrupt flag (VIF) in protected mode.
0VMEVirtual 8086 Mode ExtensionsIf set, enables support for the virtual interrupt flag (VIF) in virtual-8086 mode.

Additional Control registers in x86-64 series[edit]

EFER[edit]

Extended Feature Enable Register (EFER) is a model-specific register added in the AMD K6 processor, to allow enabling the SYSCALL/SYSRET instruction, and later for entering and exiting long mode. This register becomes architectural in AMD64 and has been adopted by Intel. Its MSR number is 0xC0000080.

BitPurpose
63:16Reserved
15TCE (Translation Cache Extension)
14FFXSR (Fast FXSAVE/FXRSTOR)
13LMSLE (Long Mode Segment Limit Enable)
12SVME (Secure Virtual Machine Enable)
11NXE (No-Execute Enable)
10LMA (Long Mode Active)
9Reserved
8LME (Long Mode Enable)
7:1Reserved
0SCE (System Call Extensions)

CR8[edit]

CR8 is a new register accessible in 64-bit mode using the REX prefix. CR8 is used to prioritize external interrupts and is referred to as the task-priority register (TPR).[2]

The AMD64 architecture allows software to define up to 15 external interrupt-priority classes. Priority classes are numbered from 1 to 15, with priority-class 1 being the lowest and priority-class 15 the highest. CR8 uses the four low-order bits for specifying a task priority and the remaining 60 bits are reserved and must be written with zeros.

System software can use the TPR register to temporarily block low-priority interrupts from interrupting a high-priority task. This is accomplished by loading TPR with a value corresponding to the highest-priority interrupt that is to be blocked. For example, loading TPR with a value of 9 (1001b) blocks all interrupts with a priority class of 9 or less, while allowing all interrupts with a priority class of 10 or more to be recognized. Loading TPR with 0 enables all external interrupts. Loading TPR with 15 (1111b) disables all external interrupts.

The TPR is cleared to 0 on reset.


https://en.wikipedia.org/wiki/Control_register

'O / S > Window' 카테고리의 다른 글

Windows USB Autorn 설정  (0) 2016.01.04
Windows 10 _HANDLES_TABLE, _HADNLES_TABLE_ENTRY  (0) 2015.11.09
_TEB, _PEB Windows 10  (0) 2015.11.05
_EPROCESS, _KPOCESS Windows 10  (0) 2015.11.05
System Overview  (0) 2015.10.28