Advanced Processors
T1. Barry B Brey, The Intel Microprocessors .Pearson, Eight Ed. 2009. Chapter 16-17
April 27th 2023
16 bit Microprocessor
5/2/2023 2
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
32 bit Microprocessor
5/2/2023 3
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Real and Protected
Modes
5/2/2023 4
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Difference between
Real and Protected
Modes
5/2/2023 5
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Real Mode
In real mode the First 1 MB memory is accessible
• i.e. Real/conventional memory
• Ex: DOS operating system- it can access only the first 1 MB
memory(real memory)
5/2/2023 6
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Real Mode
• In 8086/8088 –(20 bit address) operate only in real mode
• They can access only 1 MB memory.
• The concept of real mode and protected mode comes only in
80286 onwards. (80286, 80386, 80486)
• They can capable of working in real mode as well as protected
mode.
5/2/2023 7
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Real Mode
• To access the real memory, segment should be discussed
• Segment Registers:
Code
Data
Stack
Extra
FS & GS
• Every address is going to have two parts: segment and offset.
• Maximum segment size 64 K
• Segments -Relocatability
5/2/2023 8
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Protected memory
Above 1M
• Windows operate
• Segment + Offset
• Segment Register –Selector –Selects Descriptor from Descriptor
Table
• Descriptor
• Location
• Length
• Access Rights
• Instructions don’t change as still it is segment-offset combo
• In 80386 & 80486 –32-bit pointers possible
5/2/2023 9
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
How does it work?
Two Descriptor Tables
• Global / System
• Apply to all programs
• Local /Application
• Apply to particular appln
• Each Descriptor Table has 8192 entries
• 16,384 descriptors
• 16,384 segments
• Size of segment= 4G size (80386 have 32 bit offset)= Physical
• Virtually–4G x 16K=64T
• Program size can be 64 TB
5/2/2023 10
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor
Each descriptor is of 8 bytes
• Total memory for GDT /LDT – 8192X8=64K
• 80286 –upward compatible
5/2/2023 11
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80286
5/2/2023 12
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80286
Protected memory = not all applications can access the segment
due to Access Right byte
Base address= 3 bytes= 24 bits= 16 MB= beginning of segment
= starting address of the segment
Limits= 2 bytes= size of segment= 16 bit offset
Size of segment= 16 bit= 64 k= last offset adderess
Total virtual memory= 64KX8192X2= 64KX16K= 1GB
Physical
5/2/2023 13
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80386
5/2/2023 14
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80386
Protected memory = not all applications can access the segment
due to Access Right byte
Base address= 4 bytes= 3 2 bits= 4 GB= beginning of segment
= starting address of the segment
Limits= 20 bits= size of segment= 1 MB
Every segment can come upto 4 GB
How this 1 MB will come upto 4GB
Possible by G bit
Total virtual memory= 4GX8192X2= 4GX16K= 64TB
5/2/2023 15
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80386
AV bit = Available bit= 1 = segment is available in Physical
memory
AV bit = Available bit= 0 = segment is not available in Physical
memory (present in hard disk)
5/2/2023 16
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80386
D bit = determine the instruction size= 1 = 386 or 486 working in
32 bit mode of operation
D bit = determine the instruction size= 0 = 386 or 486 working in
16 bit mode of operation
5/2/2023 17
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor-80386
G bit = Granularity bit= 1 = changes the limit size 20 bit to 32 bit
G bit = Granularity bit= 0 = limit size 20 bit
Limit= 20 bit = 1 MB= size can be 1 MB
Limit= 32 bit = 4 GB= size can be as high as 4 GB
G bit = Granularity bit= 1 = limit multiplied by 4K= 1MBX4K
= 4GB
5/2/2023 18
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Example
Base = Start = 1000 0000H
G = 0
Limit –001FFH
End = 1000 0000 + 001FFH = 1000 01FFH
G =1
End = 1000 0000 + 001FF FFF = 101F FFFFH
5/2/2023 19
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Access Rights Byte Format
5/2/2023 20
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Access Rights Byte Format
5/2/2023 21
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Address Translation- Segment
5/2/2023 22
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Invisible Registers
5/2/2023 23
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Example: GDT
MOV AX, [1000H]
DS:1000
DS = 0018
1st 13 bits –0000 0000 0001 1000 -GDT
GDTR + 0018 (entry no. 3)
GDTR –00 00 00 00
DS starts at –00 20 00 00
Size= 0FFFF= 64K
LIMIT BYTE= SIZE-1= 64k
ACCESS RIGHT =93= 10010011
Linear address= 00200000+1000H
= 00201000H
5/2/2023 24
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Example: LDT
(slightly more complicated)
MOV AX,[1000H]
DS:1000
DS = 001C
1st13 bits –0000 0000 0001 1100 -LDT
Selector –LDTR
LDTR –0018 –0000 0000 0001 1000
GDTR + 0018 (entry no. 3)
GDTR –00 00 00
LDT starts at –40 00 00
5/2/2023 25
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Invisible Registers
5/2/2023 26
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Example
DS:1000
DS = 001C
1st13 bits –0000 0000 0001 1100 –LDT
Selector –LDTR
LDTR + 0018 (entry no. 3)
GDTR –00 00 00
DS starts at –80 00 00
Linear Address –80 10 00
5/2/2023 27
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Memory: 8086 to 80486
Segment (SR) -Offset
8086 /8088 –Real mode
Segment Value shifted left by 4 bits + offset –20 bit address
5/2/2023 28
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Memory: 8086 to 80486
80286
Real Mode
Protected Mode
• Segment Register –Selector –points to descriptor
(LDT/GDT) –descriptor has starting address of
segment –Starting Address + Offset
• Linear address –Physical Address (24-bits)
• Segmentation: Process of conversion from virtual
address to linear address
5/2/2023 29
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Memory: 8086 to 80486
80386/80486
Real Mode
Protected Mode
• Segment Register –Selector –points to descriptor
(LDT/GDT) –descriptor has starting address of segment –
Starting Address + Offset
• Segmentation=Virtual address to Linear Address (32-bits)
• Linear to Physical Address – one more translation=
Paging (80386 and 80486)
5/2/2023 30
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Descriptor: 80386 & 80486
5/2/2023 31
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Example: GDT
MOV AX, [1000H]
DS:1000
DS = 0018
1st 13 bits –0000 0000 0001 1000 -GDT
GDTR + 0018 (entry no. 3)
GDTR –00 00 00 00
DS starts at –00 20 00 00
Size= 0FFFF= 64K
LIMIT BYTE= SIZE-1= 64k
ACCESS RIGHT =93= 10010011
Linear address= 00200000
5/2/2023 32
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
PD/PT Entry
5/2/2023 33
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Paging 80386 onwards
Linear –physical
Resources From Microprocessor
• CR0 –CR3 (4 control registers from 386 Microprocessor)
Resources From Memory
• Page directory –1024 entries –every entries 4 bytes (32 bit) –
each point to Page Table
=>1024 * 4 = 4k
4 byte will give starting address of Paging table
So 1K paging table
5/2/2023 34
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Paging 80386 onwards
Resources From Memory
• Page directory – 1 K page table
• Page table –1024 entries –every entries have 4 bytes –each
point towards Page (block of memory)
=>1024 *4 =4k
Total no.pages =>1024 * 1024 = 1 M
Page block of 4k size of page
1 M pages X 4K= 4GB
5/2/2023 35
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Linear to Physical
5/2/2023 36
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
CR0-3
CR0 –MSB PG bit
CR3 –BITS 12 -31-base address of Page Directory
000000000000
5/2/2023 37
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
PD/PT Entry
5/2/2023 38
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
PD/PT Entry
5/2/2023 39
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION
Linear to Physical
5/2/2023 40
ELECTRICAL ELECTRONICS COMMUNICATION INSTRUMENTATION