1. Logical address = segment Identifier (16bits) + offset (32bits)
Segment selector is actually the index of the GDT or LDT, where the TI field is used to determine whether to select GDT or IDT
2, segment identifier is called segment selector, and in order to retrieve it quickly, the process provides segmentation R Egisters whose only purpose are to the hold segment Selectors,like CS, SS, DS, ES, FS and GS.
3. The CS register has another import Function:it includes a 2-bit field This specifies the current Privilege level (CPL) of the CPU.
4. Each segment are represented by a 8-byte segment descriptor that describes the segment characteristics.
Global Descriptor Table (GDT) or Local descriptor Table (LDT) is used to store them.
5. There is several types of segments and thus several types of Segment descriptors:
Code Segment Descriptor, Data Segment descriptor, Task State Segment Descriptor (TSSD), Local descriptor Table Descriptor (L DTD)
6, TSSD is a segment used to save contents of the processor registers, it can appear only in the GDT
7. The first entry of the GDT is always 0. This ensures the logical addresses with a null segment selector would be considered invalid, thus causing a processor exce Ption.
8, whenever the CPL is changed, some segmentation registers must was correspondingly updated. For instance, when the CPL was equal to 3 (user Mode), the DS register must contain the segment selector of the user data SE Gment, but when the CPL was equal to 0, the DS register must contain the segment selector of the kernel data segment
9, in uniprocessor systems there are only one GDT, while in multiprocessor systems there are one GDT for every CPUs in the Sys Tem. All GDTs is stored in the cpu_gdt_table array, while the addresses and sizes of the GDTs is stored in the CPU_GDT_DESCR
10, A Task State Segment (TSS), different for each processor in the system. The linear address space corresponding to a TSS are a small subset of the linear address space corresponding to the kernel Data segment.
Process in user mode is not allowed to access TSS segments.
11. When a processor starts executing a process has a custom LDT, the LDT entry in the cpu-specified copy of the GDT is Changed accordingly.
In-depth understanding of the Linux kernel reading notes---Chapter 2 Memory addressing