Question: What does the field mean in the segment descriptor?
Information such as linear address/offset/granularity/privilege limit for the first address of the segment.
1, quick access to segment descriptors
When the segment selector is loaded, the corresponding segment descriptor is automatically loaded into the corresponding non-programmed CPU register by memory. The GDT or LDT in main memory is no longer accessed after loading.
2, Segment selector field
Index: Specifies the entry for the corresponding segment descriptor placed in the GDT or LDT
ti:0 GDT 1 LDT
RPL: Privileged level, specifically the privilege level of the current CPU in the CS segment.
3, Segment descriptor address conversion
GDT Address: 0x00020000
Index:2
Address: 0x00020000+ (2*8)) 0x00020010
The maximum number of GDT 2 is 13 square-1. Reason: index is exactly 16-3 = 13 bits.
Fragmentation on Linux: Encourage programmers to divide programs into logically related entities, but Linux uses fragmentation very limited. Fragmentation and paging are a bit redundant, and they can all divide the physical address space of the process.
Fragmentation can assign a process to a different linear address space, and paging can map the same linear address space to a different physical address. Linux prefers paging.
Linux User cs UESR ds kernel cs Kernel ds are all 0, stating that there is no segmentation to map different linear address spaces. All programs use almost the same linear address space.
Deep understanding of the Linux kernel-chapter II Memory addressing 04