Segment Descriptor Describes a Memory Area in Detail

In a multitasking environment, the OS programmer must be able to specify the following characteristics of each segment:

  • The task that it belongs to.

  • Its start address anywhere in the 4GB memory address range.

  • Its length (anywhere from one byte to 4GB in length).

  • How it may be accessed: read-only, execute-only, read/writable.

  • The minimum privilege level a program must have to access the segment.

  • Whether it's a code or data segment, or a special segment that is only used by the OS.

  • Whether the segment of information is currently present in memory or resides on a mass storage device.

Figure 7-1 on page 111 illustrates the manner in which the processor interprets the contents of a segment register while operating in Real Mode. The only thing it contains is the upper 16 bits of the 20-bit start address of the segment within the first megabyte of memory space. The processor automatically appends the lower four bits of the start address and always sets them to zero. As an example, if the programmer moved the value 1010h into the DS register

mov ax, 1010
mov ds, ax

Figure 7-1. Segment Register Contents in Real Mode


this would set the start address of the data segment to 10100h.

As stated earlier in this chapter, when in Protected Mode the OS programmer must be able to define many more properties of a segment in addition to its start memory address. It should be obvious that it would not be possible to define all of these characteristics in the 16-bit segment register.

In Protected Mode, it requires eight bytes of information to describe all of the characteristics associated with a particular segment of memory space. The protected mode OS must provide an eight byte descriptor for each memory segment to be used by each program (including those used by the OS itself). It would consume a great deal of processor real estate to keep descriptors for all segments used by all programs in registers on the processor chip itself. For this reason, the descriptors are stored in special tables in memory. The next section provides a description of the descriptor tables.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.35.193