Download presentation
Presentation is loading. Please wait.
1
CHAPTER 5
2
Default Segment and Offset Registers
The microprocessor has a set of rules that apply to segments whenever memory is addressed. These rules, which apply in the real and protected mode, define the segment register and offset register combination.
3
The code segment register is always used with the instruction pointer to address the next instruction in a program. This combination is CS:IP or CS:EIP depending upon the microprocessor’s mode of operation.
4
Examples Find the memory address of the next instruction executed by the microprocessor, when operated in the real mode, for the following CS:IP combinations: CS = 1000H and IP = 2000H. CS = 3456H and IP = ABCDH.
5
CS = 1000H and IP = 2000H 10000H + 2000H 12000H
6
b) CS = 3456H and IP = ABCDH. 34560H + ABCDH 3F12DH
7
exercise Find the memory address of the next instruction executed by the microprocessor, when operated in the real mode, for the following CS:IP combinations: a)CS = 1000H and IP = 400H b)CS = 2300H and IP = 1A00H c)CS = 1A00H and IP = B000H
8
Another of the default combinations is the stack.
Stack data are referenced through the stack segment at the memory location addressed by either the stack pointer (SP/ESP) or the pointer (BP/EBP). These combinations are referred to as SS:SP (SS:ESP), or SS:BP (SS:EBP).
9
Example, if SS = 2000H and BP = 3000H, the microprocessor addresses memory location
23000H for the stack segment memory location
10
Exercise Determine the memory location addressed by the following real mode register combinations: SS = 2900H and SP = 3A00H DS = A000H and BX = 1000H DS = 2000H and SI = 1002H SS = 2300H and BP = 3200H
11
PROTECTED MODE MEMORY ADDRESSING
Protected mode memory addressing (80286 and above) allows access to data and programs located above the first 1M byte of memory, as well as within the first 1M byte of memory. Protected mode is where Windows operates.
12
The segment register contains:
The descriptor describes the memory segment’s location, length, and access rights. Selector that selects a descriptor from a descriptor table.
13
There are two descriptor tables used with the segment registers:
Global descriptors contain segment definitions that apply to all programs. Local descriptors are usually unique to an application.
14
The segment limit contains the last offset address found in a segment
15
Examples Show the segment start and end if the base address is H, the limit is 001FFH, and the Granularity bit (G bit = 0 ). Base = Start = H. End = Base + Limit H FFH 100001FFH
16
b) Show the segment start and end if the base address is 10000000H, the limit
is 001FFH, and the G bit = 1. Notice that the limit is appended with FFFH to determine the ending segment address.
17
Base = Start = H. Limit= 001FFFFFH End = Base + Limit H +001FFFFFH 101FFFFFH
18
exercise 1)For a Core2 descriptor that contains a base address of H, a limit of 0FFFFH, and, what starting and ending locations are addressed by this descriptor? 2)For a Core2 descriptor that contains a base address of H, a limit of 00010H, and G = 1, what starting and ending locations are addressed by this descriptor?
19
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. The physical address is the actual memory location accessed by a program.
20
FLAT MODE MEMORY The memory system in a Pentium-based computer that uses the 64-bit extensions uses a flat mode memory system. A flat mode memory system is one in which there is no segmentation. The flat model does not use a segment register to address a location in the memory.
21
END
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.