0% found this document useful (0 votes)
142 views24 pages

80186

Protected mode memory addressing allows accessing memory locations above 1MB by using descriptor tables, segment selectors, and 32-bit offsets. Descriptor tables contain segment descriptors that define base addresses, limits, and access permissions for up to 16,384 segments. Segments are addressed using segment selectors that point to descriptors, rather than directly storing base addresses in segment registers as in real mode. This allows flexible, protected memory management through segmentation and paging.

Uploaded by

a_charania
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views24 pages

80186

Protected mode memory addressing allows accessing memory locations above 1MB by using descriptor tables, segment selectors, and 32-bit offsets. Descriptor tables contain segment descriptors that define base addresses, limits, and access permissions for up to 16,384 segments. Segments are addressed using segment selectors that point to descriptors, rather than directly storing base addresses in segment registers as in real mode. This allows flexible, protected memory management through segmentation and paging.

Uploaded by

a_charania
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Microprocessors CSE - 341

Protected Mode Memory Addressing


Remember using real mode addressing we were previously able to address 1M Byte of memory.
Using Protected Mode memory addressing locations above the 1M byte boundary can be addressed. The Protected Memory scheme still uses base address and index address to calculate actual memory locations but, this is done in a different way from what we had done previously.

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 ?

80286 Descriptor 00000000 00000000 Access Rights Base (B23-B16)

80386 through P4 Descriptor Base (B31-B24) G D 0 A Limit V (L19-L16)

Base (B15 B0)


Limit (L15 L0)

Access Rights Base (B23-B16) Base (B15 B0) Limit (L15 L0)

Base Address Starting location of the memory segment.


80826 has 24 bits allocated to storing the base address. 16 MB Memory locations. 80386 and above use 32 bits for storing the base address. 4GB of memory locations. 80286 is Upward computable because its MSB above the 24 bits are 0000

Segment Limit The last possible offset address of the segment.


So if the segment begins at memory location F00000H and ends at location F000FFH. What should be the value of the limit register ? Remember the limit registers size on 80286 is 16 bits and 80386 and above is 20 bit. Additional bits available to 80386 and above G Granularity bit If G =0 The limit specifies segment limit of 00000H to FFFFFH. If G =1 The limit specifies segment limit of 00000XXXH to 8 FFFFFXXXH.

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.

Base = Start = 10000000H G =0 End = Base + Limit = 10000000H + 001FFH = 100001FFH

10

Example:
Segment start and end if the base address is 10000000H, the limit is 001FFH and G bit =1.

Base = Start = 10000000H G =1 End = Base + Limit = 10000000H + 001FFXXXH = 101FFFFFH

11

AV Available
AV =1 Available AV =0 Not Available.

D = Data access

D = 1 The instructions are in 32bits and the registers are 32 bits.


D = 0 The instructions are 16 bit instructions compatible with 8086-80286

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

S =0 System descriptor S =1 Code or data segment descriptor


DLP = sets the descriptor privilege level ( 00 11)

P = 0 Descriptor is undefined P =1 Segment contains a valid base and limit

14

15

1 0

Selector

TI

RPL

Selector Selects one of the 8192 descriptors.

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

Segment Registers CS DS ES SS FS GS Base Address

Descriptor Cache Limit Access

Base Address TR LDTR

Limit

Access

Descriptor Table addresses GDTR IDTR Base Address Limit 19

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy