x86 中所稱的 byte,word 和 double word 分別為 8、16 和 32 位。
x86_64 地址線只有 48 bit 而非 64 bit。x86-64
MMIO 需要做位址轉換。
A20 地址線只要是為了向後相容,將存取到 1MB 以上的位址改以從 0 開始。
實模式: 不做任何位址轉換,不開分段也不開分頁。识别 processor 是否处于 real mode 的唯一途径就是判断 CR0.PE 标志位。
非實模式: 開機即處於非實模式。之後依序切入實模式、保護模式,再切回實模式。在此過程中,於保護模式將段限長設成 4GB,再切回實模式。但因為此時段限長已為 4GB,並不符實模式的嚴格定義。非實模式是實模式的變種,並非另一種模式,其目的是用來存取實模式存取不到的位址 (1MB)。
保護模式: 開啟分段。
虛擬 (邏輯) 地址 (virtual/logical address) → 線性地址 (linear address) → 物理地址 (physical address)
段描述符表分為全局描述符表 (global descriptor table) 和局部描述符表 (local descriptor table)。分別簡稱為 GDT 和 LDT。存放 GDT 和 LDT 位址的暫存器分別稱為 GDTR 和 LDTR。描述符的內容會被隱式的快取在段暫存器中不可見的部分。所有任務共享一份 GDT,另外保有自己一份 LDT。LDT 本身為一個段,因此在 GDT 中有相對應的描述符指到該 LDT。
Segmentation provides a mechanism of isolating individual code, data, and stack modules so that multiple programs (or tasks) can run on the same processor without interfering with one another. Paging provides a mechanism for implementing a conventional demand-paged, virtual-memory system where sections of a program’s execution environment are mapped into physical memory as needed. Paging can also be used to provide isolation between multiple tasks. When operating in protected mode, some form of segmentation must be used. There is no mode bit to disable segmentation. The use of paging, however, is optional.
邏輯地址 (logical address) 分為兩部分: 16 位的段選擇符 (segement selector) 和 32 位的偏移 (offset)。
段暫存器: CS、DS、ES、FS、GS、SS。
頁表項有底下幾項控制位:
Software enables paging by using the MOV to CR0 instruction to set CR0.PG. Before doing so, software should ensure that control register CR3 contains the physical address of the first paging structure that the processor will use for linear-address translation (see Section 4.2) and that structure is initialized as desired.
The first paging structure used for any translation is located at the physical address in CR3.
MMX → SSE → AVX
EDI. The contents of memory are found at the address provided by the effective address computation. Doubleword registers R8D - R15D are available when using REX.R in 64-bit mode
$ gcc -O2 -ftree-vectorize -msse2 -ftree-vectorizer-verbose=5
$ gcc -mfpu=neon -mfloat-abi=softfp or -mfloat-abi=hard