Descriptors The object to which the segment selector
Descriptors • The object to which the segment selector points to is called a descriptor. • Descriptors are 8 byte quantities which contain 32 bit base address, 20 -bit limit and attributes (12 bits) about a given segment.
General Format of a Descriptor UQ: Write short note on structure of segment descriptor field
General Format of a Descriptor • All segments have 3 attribute fields in common: the P-bit, the DPL bit and the S-bit. • P-bit : P=1 segment is loaded in physical memory. If P=0, then exception 11
General Format of a Descriptor • DPL-bit: 2 -bit field which specifies the protection level 0 -3 associated with a segment. • There are two main categories of segments: system segments and non-system segments( for code and data) • S-bit: S=1 non-system segment. S=0 system segment
Non-system segment descriptor • G-bit (Granularity Bit): It specifies if a segment length is byte granular or page granular. • G = 0 byte granular (max 1 MB) segment size may be 1, 2, . . . , 220 bytes G = 1 page granular (max 4 GB) segment size may be 1 × 212, 2 × 212, . . . , 220 × 212 bytes
Non-system segment descriptor • D-bit : It indicates default length for operands and effective addresses. • D = 1 32 -bit operands and 32 -bit addressing modes D = 0 16 -bit operands and 16 -bit addressing modes
Non-system segment descriptor • B-bit : It indicates size of stack pointer • B = 1 32 -bit ESP register B = 0 16 -bit SP register
Non-system segment descriptor • AVL-bit (Available field) : It indicates whether it is for user or OS.
Access Right Byte Bit Position Name Function 7 Present(P) P = 1 Segment is mapped into physical memory. P = 0 No mapping to physical memory exits. 6 -5 Descriptor Privilege Level(DPL) Segment Privilege attributes 4 Segment Descriptor(S) S =1 Code or Data segment descriptor S =0 System Segment Descriptor or Gate Descriptor 3 Executable(E) E = 0 Descriptor type is data segment E = 1 Descriptor type is code segment 2 Expansion Direction(ED) for data ED =0 Expand up(data) segment, offsets must be ≤ limit. ED =1 Expand down(stack) segment, offsets must be > limit. Confirming(C) when E=1 for code Code segment may only be executed when CPL ≥DPL and CPL remains unchanged. 1 0 Writeable (W) for data W = 0 Data segment are read only W = 1 Data segment may be written into. Readable (R) for code R = 0 Code segment may not be read(execute only) R = 0 Code segment may be read(execute/read) Access Bit (A) A = 0 Segment has not been accessed A = 1 Segment has been accessed
System Segment Descriptor
Paging
Paging • Paging is used for virtual memory multitasking operating system. • Pages are fixed size portions of the program module or data • The complete task need not be in physical memory at any time and only a few pages are required. Hence the remaining space can be allocated for other tasks and thus multitasking can be achieved
Paging Organization
Page Mechanism • Intel 386 DX uses a two level table mechanism to convert linear address to physical address. • There are 3 components in paging mechanism: 1. Page Directory 2. Page Table 3. Page Frame (page itself) • Page size of Intel 386 DX is 4 KB
Paging Mechanism
- Slides: 15