1 Microprocessors CSE - 341. 2 Protected Mode Memory Addressing Remember using real mode addressing we were previously able to address 1M Byte of memory.

Slides:



Advertisements
Similar presentations
Memory Management Unit
Advertisements

O PERATING I N P ROTECTED M ODE Prof.P.C.Patil Department of Computer Engg Matoshri College of Engg.Nasik M ICROPROCESSOR A RCHITECTURE.
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Chapter 2: The Microprocessor and its Architecture.
Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors: 8086/8088, 80186/80188,
FEATURES OF 80386: Two versions of are commonly available: 1) 80386DX
The Microprocessor and its Architecture
16.317: Microprocessor System Design I
Intel MP.
CSC 221 Computer Organization and Assembly Language
OS Memory Addressing.
Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system.
IA-32 Processor Architecture
Vacuum tubes Transistor 1948 ICs 1960s Microprocessors 1970s.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Chapter 8.3: Memory Management
Memory Management (II)
CS2422 Assembly Language & System Programming September 22, 2005.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2012 Lecture 2: 80386DX Internal Architecture & Data Organization.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 15: Protected mode intro.
Protected Mode. Protected Mode (1 of 2) 4 GB addressable RAM –( to FFFFFFFFh) Each program assigned a memory partition which is protected from.
UNIT 2 Memory Management Unit and Segment Description and Paging
Intel MP (32-bit microprocessor) Designed to overcome the limits of its predecessor while maintaining the software compatibility with the.
1/2002JNM1 With 20 bits, 1,048,576 different combinations are available. Each memory location is assigned a different combination. Each memory location.
Microprocessor system architectures – IA32 segmentation Jakub Yaghob.
The Pentium Processor.
The Intel Microprocessors. Real Mode Memory Addressing Real mode, also called real address mode, is an operating mode of and later x86-compatible.
Multitasking Mr. Mahendra B. Salunke Asst. Prof. Dept. of Computer Engg., STES SITS, Narhe, Pune-41 STES Sinhgad Institute of Tech. & Science Dept. of.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Memory Addressing / Kernel Modules.
Memory Addressing in Linux (Chap. 2, Understanding the Linux Kernel) J. H. Wang Oct. 20, 2008.
System Address Registers/Memory Management Registers Four memory management registers are used to specify the locations of data structures which control.
80386DX.
1 i386 Memory Management Professor Ching-Chi Hsu 1998 年 4 月.
Virtual 8086 Mode  The supports execution of one or more 8086, 8088, 80186, or programs in an protected-mode environment.  An 8086.
The Microprocessor and Its Architecture A Course in Microprocessor Electrical Engineering Department University of Indonesia.
EFLAG Register of The The only new flag bit is the AC alignment check, used to indicate that the microprocessor has accessed a word at an odd.
Microprocessor system architectures – IA32 tasks Jakub Yaghob.
Segment Descriptor Segments are areas of memory defined by a programmer and can be a code, data or stack segment. In segments need not be all the.
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 8: Real & Protected Mode Paging and Virtual Memory Constantine D. Polychronopoulos Professor, ECE.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Chapter 2 The Microprocessor Architecture Microprocessors prepared by Dr. Mohamed A. Shohla.
Microprocessor and Assembly Language Addressing Models
Information Security - 2. Descriptor Tables There are two descriptor tables – Global Descriptor Tables – Local Descriptor Tables The global descriptor.
Information Security - 2. Descriptor Tables Descriptors are stored in three tables: – Global descriptor table (GDT) Maintains a list of most segments.
OS Memory Addressing. Architecture CPU – Processing units – Caches – Interrupt controllers – MMU Memory Interconnect North bridge South bridge PCI, etc.
contains 8086 processor and several additional functional chips: –clock generator –2 independent DMA channels –PIC –3 programmable 16-bit.
32- bit Microprocessor-Intel 80386
Lecture on Real Mode Memory Addressing
Descriptor Table & Register
16.317: Microprocessor System Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
Microprocessor Systems Design I
143A: Principles of Operating Systems Lecture 5: Address translation
Information Security - 2
x86 segmentation, page tables, and interrupts
Page Replacement Implementation Issues
Subject Name: Microprocesor Subject Code: 10CS45
Tutorial 7 MODULE 6.
Chapter 2: The Microprocessor and its Architecture
Intel Microprocessor.
Operating Modes UQ: State and explain the operating modes of X86 family of processors. Show the mode transition diagram highlighting important features.(10.
Microprocessor and Assembly Language Addressing Models
Page Replacement Implementation Issues
Chapter 2: The Microprocessor and its Architecture
Information Security - 2
Assembly Language for Intel-Based Computers, 5th Edition
AKT211 – CAO 05 – x86 Architecture: Intel 8088 (2)
Presentation transcript:

1 Microprocessors CSE - 341

2 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.

3 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.

4 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.

5 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 descriptors available to any application. This also now means that up to memory segments could be described to be used by each application.

6 Why do you think we have only 8192 descriptors and not 64K ? Descriptor Access RightsBase (B23-B16) Base (B15 – B0) Limit (L15 –L0) through P4 Descriptor Base (B31-B24) GD0AVAV Limit (L19-L16) Access RightsBase (B23-B16) Base (B15 – B0) Limit (L15 –L0)

7 Base Address – Starting location of the memory segment has 24 bits allocated to storing the base address. 16 MB Memory locations and above use 32 bits for storing the base address. 4GB of memory locations is Upward computable because its MSB above the 24 bits are 0000

8 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 is 16 bits and and above is 20 bit. Additional bits available to 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 FFFFFXXXH.

9 This increases the limit and allows the segment length of 4K to 4G bytes in steps of 4K Bytes has 16 bits to define offset because of its internal architecture 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.

10 Example: Segment start and end if the base address is H, the limit is 001FFH and G bit =0. Base = Start = H G =0 End = Base + Limit = H + 001FFH = FFH

11 Example: Segment start and end if the base address is H, the limit is 001FFH and G bit =1. Base = Start = H G =1 End = Base + Limit = H + 001FFXXXH = 101FFFFFH

12 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

13 Access Rights bytes- Control access to protected mode memory segment. This byte describes how the segment functions in the system PDPLSEED/CR/WA 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

14 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

15 SelectorTIRPL 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

16 DS 0008 Descriptor 0 Descriptor 1 Descriptor 2 Descriptor 3 Descriptor 4 Descriptor 5 Descriptor 6 Descriptor 7 Descriptor 8 Descriptor 9 Descriptor 10 Descriptor 11

17 DS 0008 FF Data Segment FF

18 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 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.

19 CS DS ES SS FS GS Segment Registers Descriptor Cache Base AddressLimitAccess TR LDTR Base AddressLimitAccessDescriptor Table addresses GDTRBase AddressLimit IDTR

20 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.

21 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.

22 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.

23 Memory Paging The memory paging mechanism located within the 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.

24 Quiz In question 2 the word actually should be actual