Segment Registers Selector Offset Virtual Address Descripter Table
Segment Registers 사용자가 지정한 주소 Selector 가상 메모리 -> 물리 메모리 Offset Virtual Address (가상 메모리) Descripter Table Segmetatation Segment Descriptor Linear Address (선형 메모리) + DIR Page Offset Paging CR 3 Page Directory Page Table Page 실제 메모리 Page 최종적인 물리 주소 physical Address (물리 메모리)
Protected Mode Segmentation - GDTR Index : Offset TI : LDT(1) or GDT(0) 결 정 RPL : 특별권한 레벨 (CS는 CPL, 메모리 Code의 실행 권한) 47(79) GDTR Segment Registers Index 0 RPL Register 16 15 Base Address Size Global Descripter Table ……. Segment Descriptor DS Descriptor CS Descriptor System Register 용도 GDTR 커널의 Descriptor Table의 Base 주소와 Limit를 저장 IDTR 인터럽트를 위한 Descriptor Table의 Base 주소와 Limit 저장 LDTR 현재 실행 중인 Task의 Desciptor Table을 가리킴 TR 현재 실행 중인 Task의 상태를 저장하는 TSS를 가리킴 + Linear Address
Protected Mode Segmentation - LDTR Register Segment Registers Index GDTR 47(79 ) 1 RPL ……. 16 15 Base Address Descriptor Size 15 LDTR LDT GDT 0 Selector Task Descriptor LDT Descriptor DS Descriptor CS Descriptor + CS Decriptor Linear Address
Protected Mode Segmentation - TSS Task Register GDTR 47(79 ) 15 0 Selector 16 15 Base Address Size 15 LDTR GDT 0 Selector Task Descriptor LDT Descriptor DS Descriptor CS Decriptor TSS의 LDTR과 이 LDTR은 같아야 함 I/O Map Base Reserved Reserved LDTR GS FS DS SS CS ES EDI ESI EBP ESP EBX EDX ECX EAX EFlags EIP CR 3(PDBR) Reserved SS(2~0) ESP(2~0) Reserved Prev TSS T
Base G D X U Limit P DPL Segment Desciptor S Type Code/ Data 비트 A Base Conforming Limit Read 설명 A(Accessed) 메모리 액세스시 프로세서에 의해 자동 세팅 Type (Segment Type) Code(1)/Data(0), Data : expand, write, accessd Code : conforming, read, accessed S(System) System 세그먼트(0), Code, Data, Stack(1) DPL (Descriptor Privilege Level) 메모리에 액세스되는 특권레벨(0은 커널, 1과 2는 디바이스, 3은 어플레케이션) P(Present) 디스크립터가 유효한지를 나타내는 비트, 0일시 메모리 엑세스 수행 X U(User) 프로그래머에 의해 사용 X(Intel 예약) 확장을 위한 예약 D(Default Size) 0이면 오퍼랜드에 대해 16비트 사이즈, 1이면 32비트 사이즈 G(Granularity) 0일 경우 Limit의 사이즈는 1 Byte, 1일 경우 4 KB
Gate Descriptor
Protected Mode Segmentation – IDTR(GDT) IDTR 47(79 ) 16 15 Base Address Size Interrupt Handler Interrupt Descripter Table ……. Interrupt Vertor + Interrupt Gate Task Gate Trap Gate 외부 인터럽트는 GDT를 참조 트랩은 LDT를 참조 GDTR 47(79 ) GDT 16 15 Base Address Size Task Descriptor LDT Descriptor DS Descriptor CS Decriptor
Protected Mode Segmentation – IDTR(GDT) IDTR 47(79 ) 16 15 Base Address Size Interrupt Descripter Table ……. Interrupt Vertor TSS Interrupt Gate Task Gate Trap Gate 외부 인터럽트는 GDT를 참조 트랩은 LDT를 참조 GDTR 47(79 ) GDT 16 15 Base Address Size Task Descriptor LDT Descriptor DS Descriptor CS Decriptor
Protected Mode Segmentation – IDTR(LDT) IDTR 47(79 ) 16 15 Base Address Size Exception Handler Interrupt Descripter Table …… Interrupt Vertor + Interrupt Gate Task Gate Trap Gate GDTR 47(79 ) 16 15 Base Address Size 15 LDTR GDT LDT Task Descriptor …… LDT Descriptor DS Descriptor CS Decriptor CS Descriptor 0 Selector
Protected Mode Segmentation – Call Gate Procedure Entry Point + Call Gate GDTR 47(79 ) 16 15 Base Address Size 15 LDTR Selector RPL GDT LDT Task Descriptor …… LDT Descriptor Call Gate Des. DS Descriptor CS Decriptor CS Descriptor 0 Selector
Paging DIR Page Directory Page Offset Page Table 실제 메모리 CR 3 Page 최종적인 물리 주소
Paging Descriptor
- Slides: 16