Get the App
SLTechnology News&Howtos  ›  Servers  › 

Operating system-use of local segment descriptor tables

Shulou Source: shulou.com Published: 2022-06-02 12:50:55 10月27日 Update

Q: what is LDT

a. Local segment descriptor table

1. Essentially a table of segment descriptors, used to define segment descriptors

two。 Similar to GDT, it can be thought of as an array of segment descriptors

3. Access elements in the local descriptor table by defining selector

Local segment descriptor selection

Local segment descriptor table

It is important to note that

1. The local segment descriptor table needs to be registered in the global segment descriptor table (add descriptors)

two。 Load the local segment descriptor (lldt) with the corresponding selector

3. Local segment descriptors are used from item 0

A question arises here-what exactly is LDT used for? Why do you need an "extra" paragraph descriptor at the same time?

The meaning of LDT is mainly reflected in two aspects: the meaning of the code level-segments with the same function and different meanings (multiple code segments); and the meaning of the system level-the basic elements of multitasking (each task corresponds to a series of different segments).

Definition and use of B.LDT

1. Define segments related to independent functions (code segments, data segments, stack segments)

two。 Compose the target segment descriptor into a local segment descriptor table (LDT)

3. Define selector for each segment descriptor (SA_TIL)

4. Define the LDT segment descriptor in GDT and define the selector

Definition and use of C.LDT

Code implementation-DA_LDT equ 0x82 should be defined in inc.asm or an error will occur at run time

% include "inc.asm" org 0x9000jmp ENTRY_ message [section .gdt]; GDT definition Segment boundary Segment attributes GDT_ENTRY: Descriptor 0,0, 0CODE32_DESC: Descriptor 0, Code32SegLen-1, DA_C + DA_32VIDEO_DESC: Descriptor 0xB8000, 0x07FFF, DA_DRWA + DA_32DATA32_DESC: Descriptor 0, Data32SegLen-1, DA_DR + DA_32STACK32_DESC: Descriptor 0, TopOfStack32 DA_DRW + DA_32CODE16_DESC: Descriptor 0, 0xFFFF, DA_C UPDATE_DESC: Descriptor 0, 0xFFFF, DA_DRWTASK_A_LDT_DESC: Descriptor 0, TaskALdtLen-1, DA_LDT GDT endGdtLen equ $- GDT_ENTRYGdtPtr: dw GdtLen-1 dd 0; GDT SelectorCode32Selector equ (0x0001

Tags: Local code selection result error task meaning operation difference function function mode global simultaneous base address base hierarchy attribute boundary protection Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS Shulou Technology Docker OPPO Reno