Download presentation
Published byRayna Rounds Modified over 9 years ago
1
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Lecture 7 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
2
Real Mode Memory Addressing
The first 1MB memory is Real memory or the Conventional memory * Segment 1 Segment 2 Segment n 0000h CS 8000h DS A000h SS 1MB offset 16 bit Segment registers 1 MB requires 20 bit address Each segment is 64 KB Offset address is 16 bit or 2 byte Actual address = segment address + offset address
3
Real Mode Memory Addressing
Real mode operation allows to address 1MB of memory space – even for the Pentium microprocessor This first 1MB memory is called the real memory or the conventional memory A combination of segment and offset address access the real memory Segment registers contains the beginning address of any 64KB memory segment The offset address selects the any location within the 64KB memory space
4
Segment Plus Offset Determines Address
To get the real address Pad 0H at the end of segment register Add the offset value 10000H F000H 1F000H CS = 1000H Offset = F000H 12340H 245FH 1479FH DS = 1234H Offset = 245FH Since each segment is 64 K, the offset address can take maximum of FFFFH Once, the beginning address is found in segment registers, ending address is calculated by adding FFFFH with the value of segment register after padding 0H after it. From Intel Microprocessor
5
Default Segment and Offset Registers
If CS = 1400H and IP/EIP = 1200 H The microprocessor access instruction from H+ 1200H = 15200H.
6
Allows relocation Suppose 1000H bytes of code 190H bytes of data
Figure 2-4: A memory system showing the placement of four memory segments Suppose 1000H bytes of code 190H bytes of data 200H bytes of stack Allows relocation Figure 2-5
7
Protected Mode The segment register now contains a selector
Selector selects a descriptor from a descriptor table The descriptor describes the memory segment’s location Two descriptor table Global Descriptor Table (GDT) Local Descriptor Table (LDT)
8
Selectors and Descriptors
* GDT/LDT 8191 * 2 1 16 8 31 15 7 Offset Segment Registers As Selector 8192 number of descriptors in each table Each descriptor 8 bytes long, thus table size is 64 KB Selector selects one descriptor Descriptor describes the segment
9
Selectors and Descriptors
CS/DS/ES Offset 16 8 31 15 7 GDT/LDT 8191 * 2 1 Segment Register 0012H 0044H FFF0H
10
Selectors and Descriptors
CS/DS/ES Offset 16 8 31 15 7 GDT/LDT 8191 * 2 1
11
Access Right Bits
12
Selectors and Descriptors
CS/DS/ES Offset 16 8 31 15 7 GDT/LDT 8191 * 2 1 7 5 3 1 6 4 2 00H A0H C2H 10H H
13
Selectors and Descriptors
CS/DS/ES Offset 16 8 31 15 7 GDT/LDT 8191 * 2 1 Code a descriptor for that starts at H and ends at 21001FH. This memory segment is a code segment that can be read 7 5 3 1 6 4 2 21H 00H H 00H FH Limit = 21001FH – H = 001FH
14
Selectors and Descriptors
Code a descriptor for that starts at H and ends at 21001FH. This memory segment is a code segment that can be read 7 5 3 1 6 4 2 1xx x11 21H 00H H 00H FH Limit = 21001FH – H = 001FH
15
Selectors and Descriptors
32 bit / 4 byte base, memory size is 4 GB = 22x210x210x210 AV = 1, means available, 0 means not available D = 1, means 32 bit instructions, 0 means 16 bit instructions G bit or the Granularity bit G = 0, the limit is from 1 to 1MB in length G = 1, the limit is multiplied by 4K bytes (appended with 000H). So segment length is 4K to 4G bytes in steps of 4K bytes
16
Selectors and Descriptors
7 5 3 1 6 4 2 01H AV D O 0H 00H 00H H FFH FFH Start = H Limit = FFFFH End = FFFFH G bit or the Granularity bit G = 0, the limit is from 1 to 1MB in length G = 1, the limit is multiplied by 4K bytes (appended with 000H). So segment length is 4K to 4G bytes in steps of 4K bytes
17
Selectors and Descriptors
7 5 3 1 6 4 2 00H AV 1 D O 0H 28H 00H H 00H H Start = H Limit = End = 00010 000 H G bit or the Granularity bit G = 0, the limit is from 1 to 1MB in length G = 1, the limit is multiplied by 4K bytes (appended with 000H). So segment length is 4K to 4G bytes in steps of 4K bytes H
18
G bit or the Granularity bit
7 5 3 1 6 4 2 03H AV G 1 D O 0H 00H 00H H 2FH FFH End = 05FFFFFFH Start = H G bit or the Granularity bit G = 0, the limit is from 1 to 1MB in length G = 1, the limit is multiplied by 4K bytes (appended with 000H). So segment length is 4K to 4G bytes in steps of 4K bytes Size = 02FFFFFFH Limit = 02FFFH
19
03H 1 0H 1xx1 001x 00H 00H 00H 2FH FFH End = 05FFFFFFH
7 5 3 1 6 4 2 03H AV G 1 D O 0H 1xx x 00H 00H H 2FH FFH End = 05FFFFFFH Start = H Size = 02FFFFFFH Limit = 02FFFH
20
References Chapter 2, Intel Microprocessors – by Brey
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.