80186
80186
The offset address is still used as previously, to find the memory location within the segment that we are interested in.
The use of the base or the segment address has changed a bit. The segment register now contains a selector rather than the actual base address of the segment. An additional table called a descriptor table uses the selector as an index to provide additional information known as descriptor. The descriptor describes: location
Length
Access rights For the segment of interest.
3
The actual instructions used for both real mode memory access and protected mode memory access may remain the same.
This is because again the value stored in the segment register and the index register are used to obtain the actual memory location. The difference in the two modes comes the from way the microprocessor interprets the data present in the two registers to perform the memory location calculations. Another difference is that the offset address can be a 32-bit number instead of a 16 bit number in the protected mode. A 32 bit offset address allows the microprocessor to access data within a segment that can be 4G bytes in length.
4
There are two descriptor tables. Global Descriptor table and local descriptor table.
Each table contains 8192 descriptors. Global descriptors contain segment definitions that apply to all programs. System Descriptor. Local Descriptors provide information that are unique to an application. Application Descriptor. Because each table contains 8192 descriptors, there are a total of 16384 descriptors available to any application.
This also now means that up to 16384 memory segments could be described to be used by each application.
5
Why do you think we have only 8192 descriptors and not 64K ?
Access Rights Base (B23-B16) Base (B15 B0) Limit (L15 L0)
This increases the limit and allows the segment length of 4K to 4G bytes in steps of 4K Bytes.
80286 has 16 bits to define offset because of its internal architecture. 80386 and above have 32 bits and have a 32 bit internal architecture. Thus operating systems also work in either 16 bit mode or 32 bit mode. DOS works uses 16 bit environment and windows uses 32 bits.
Example:
Segment start and end if the base address is 10000000H, the limit is 001FFH and G bit =0.
10
Example:
Segment start and end if the base address is 10000000H, the limit is 001FFH and G bit =1.
11
AV Available
AV =1 Available AV =0 Not Available.
D = Data access
12
Access Rights bytes- Control access to protected mode memory segment. This byte describes how the segment functions in the system.
7 P 6 DPL 5 4 S 3 E 2 ED/C 1 R/W 0 A
A = 0 Segment Not Accessed A =1 Segment has been accessed E = 0 Descriptor describes data segment ED = 0 Segment expands upwards ED =1 Segment expands downward W = 0 Data may not be written W =1 Data may be written
13
E = 1 Descriptor describes code segment C =0 Ignore descriptor privilege level C =1 Abide by privilege level R=0 Code segment may not be read R =1 Code segment may be read
14
15
1 0
Selector
TI
RPL
TI Chooses either the global descriptor table or the local table. T1 = 0 Global descriptor table T1 =1 Local descriptor table
RPL Requested privilege level. 00 highest 11 - lowest
15
DS 0008
Descriptor 11 Descriptor 10 Descriptor 9 Descriptor 8 Descriptor 7 Descriptor 6 Descriptor 5 Descriptor 4 Descriptor 3 Descriptor 2 Descriptor 1 Descriptor 0
16
1000FF 00 00 146 10 00 00 00 FF
DS 0008
Data Segment
100000
17
Note : Descriptor 0 is called null descriptor and may not be used for accessing memory. Just like the stack the addresses of these descriptor tables have to be specified for the microprocessor. For this purpose 80286 and above microprocessors contain program invisible registers. These registers are not directly addressed by software and hence are given this name.
These registers are used to control the microprocessor when operating in protected mode.
18
Limit
Access
The program invisible parts are known as CACHE. DO NOT confuse with cache memory L1 and L2.
Once a code segment is loaded with the base address of the segment the descriptor cache is loaded with the details.
The details are not changed until the value in the code segment register is updated. This increases efficiency as the values in the cache descriptor can be reused. Hence, the term cache is used for the invisible registers.
20
GDTR Global descriptor table register. The base address of the descriptor table and its limit. The limit of each descriptor table is 16 bits because the maximum length of the table is 64K bytes. When protected mode operation in desired the values are loaded in the GDTR . IDTR Interrupt descriptor table register.
The base address of the descriptor table and its limit. The limit of each descriptor table is 16 bits because the maximum length of the table is 64K bytes.
When protected mode operation in desired the values of the IDTR must also be initialized. We will deal with this later.
21
LDTR Local descriptor table register. The LDTR does not hold the direct address of the local descriptor table. Instead it hold a selector just as the segment registers.
The selector selects a descriptor in the global address table which points to the location of the local descriptor table. The base address of the LDT is then loaded in the LDTR.
TR Task Register
Holds a selector which access a descriptor that defines a task. Task can be procedure or application program. The descriptor for the task is stored in the GDT so access can be controlled. Task register allows fast context switching helping in tasks that are often used or in multi-programming.
22
Memory Paging
The memory paging mechanism located within the 80386 and above allows any physical memory location to be assigned to any linear address. The linear address is defined as the address generated by a program. Within the memory paging unit the linear address is invisibly translated into any physical address.
23
Quiz
In question 2 the word actually should be actual
24