0
24kviews
Draw a segment descriptor format and explain different fields.
1 Answer
0
631views
  1. In protected mode, memory management unit (MMU) uses the segment selector to access a descriptor for the desired segment in a table of descriptors in memory.
  2. Segment descriptor is a special structure which describes the segment. Exactly one segment descriptor must be defined for each segment of the memory.
  3. Descriptors are eight type quantities which contain attributes about a given region of linear address space (i.e. a segment).
  4. These attributes include the 32-bit base linear address of the segment, the 20-bit length and granularity of the segment, the protection level, read, write or execute privileges, the default size of the operands (16-bit or 32-bit), and the type of segment.
  5. Fig. below shows the general format of a descriptor. As shown in Fig. segment descriptor has following fields.
  6. Base: It contains the 32-bit base address for a segment. Thus defines the location of the segment within the 4 gigabyte linear address space. The 80386 concatenates the three fragments of the base address to form a single 32-bit address.
  7. Limit: It defines the size of the segment. The 80386 concatenates the two fragments of the limit field to form a 20 bit value. The 80386 interprets this 20-bit value in two ways, depending on the setting of the granularity bit (G) :
    • If G bit 0: In units of one byte, to define a limit of up to 1 M byte (220)
      • If G bit 1: In units of 4 kilobytes, to define a limit of up to 4 gigabytes.
  8. Granularity Bit: It specifies the units with which the limit field is interpreted. When bit is 0, the limit is interpreted in units of one byte; otherwise limit is interpreted in units of 4 Kbytes.
  9. D (Default size): When this bit is cleared, operands contained within this segment are assured to be 16 bits in size. When it is set, operands are assumed to be 32-bits.

enter image description here

BASE $\hspace{1cm}$ Base Address of the segment

LIMIT $\hspace{1cm}$ The length of the segment

P $\hspace{1.7cm}$ Present Bill: 1= Present 0= Not present

DPL $\hspace{1.2cm}$ Descriptor privilege Level 0 – 3

S $\hspace{1.7cm}$ Segment Descriptor : 0 = System Descriptor 1 = Code or Data Segment Descriptor

TYPE $\hspace{1cm}$ Type of segment

A $\hspace{1.7cm}$ Accessed Bit

G $\hspace{1.7cm}$ Granulaty Bit: 1= Segment length is page granular 0 = Segment length is byte granular

D $\hspace{1.7cm}$ Default Operation Size (recognized in code segment descriptors only) 1 =32-bit segment 0 = 16 – bit segment

0 $\hspace{1.7cm}$ Bit must be zero (0) for compatibility with future processors

AVL $\hspace{1.2cm}$ Available field for user or OS

Note:

In a maximum – size segment (i.e. a segment with G = 1 and segment limit 19……0=FFFFFFH).

The lowest 12 bits of the segment base should be zero. (i.e. segment base 11…..000=000H)

General Segment Descriptor Format

  • 0 (Reserved by Intel): It neither can be defined nor can be used by user. This bit must be zero for compatibility with future processors.
  • AVL/U (User Bit) : This bit is completely undefined, and 80386 ignores it. This is available field/bit for user or operating system. Access Rights Byte:
  • P (Present Bit): The present P bit is 1 if the segment is loaded in the physical memory, if P = 0 then any attempt to access this segment causes a not present exception (exception 11).
  • DPL (Descriptor Privilege Level): It is a 2-bit field defines the level of privilege associated with the memory space that the descriptor defines- DPL0 is the most privileged whereas DPL3 is the least privileged.
  • S (System Bit): The segment S bit in the segment descriptor determines if a given segment is a system segment or a code or a data segment. If the S bit is I then the segment is either a code or data segment, if it is 0 then the segment is system segment.
  • Type: This specifies the specific descriptors among various kinds of descriptors. (Detail explanation is given in the following sections).
  • A (Accessed Bit): The 80386 automatically sets this bit when a selector for the descriptor is loaded into a segment register. This means that 80386 sets accessed bit whenever a memory reference is made by accessing the segment.
Please log in to add an answer.