PC Hardware: Chester Rebeiro IIT Madras
PC Hardware: Chester Rebeiro IIT Madras
PC Hardware: Chester Rebeiro IIT Madras
Chester Rebeiro
IIT Madras
CPUs
Processor
i386
2
Everything has an address
0x3c0:0x3cf
0x60:0x6f
Processor
i386
0x1f0:0x1f7
3
Address Types
• Memory Addresses
• IO Addresses
• Memory Mapped IO Addresses
4
Address Types :
(Memory Addresses)
• Range : 0 to (RAM size or 232-1)
• Where main memory is mapped
– Used to store data for code, heap, stack, OS, etc.
• Accessed by load/store instructions
RAM
5
Low and Extended Memory
(Legacy Issues)
• Why study it?
– Backward compatibility
• 8088 has 20 address lines; can address 220 bytes (1MB)
• Memory Ranges
– 0 to 640KB used by IBM PC MSDOS
• Other DOS versions have a different memory limit
– 640 KB to 1MB used by video buffers, expansion ROMS, BIOS
ROMs
– 1 MB onwards called extended memory
• Modern processors have more usable memory
– OSes like Linux and x86 simply ignore the first 1MB and load
kernel in extended memory
6
Address Types : (IO Ports)
• Range : 0 to 216-1
• Used to access devices
• Uses a different bus compared
to RAM memory access
– Completely isolated from memory
• Accessed by in/out instructions
ref : http://bochs.sourceforge.net/techspec/PORTS.LST 7
Memory Mapped I/O
• Why?
– More space
• Devices and RAM share
the same address space
• Instructions used to
access RAM can also be
used to access devices.
– Eg load/store
Memory Map
8
Who decides the address
ranges?
• Standards / Legacy
– Such as the IBM PC standard
– Fixed for all PCs.
– Ensures BIOS and OS to be portable across
platforms
• Plug and Play devices
– Address range set by BIOS or OS
– A device address range may vary every time the
system is restarted
9
PC Organization
Processor Processor Processor Processor
1 2 3 4
Memory bus
DRAM North Bridge
PCI Bus 0
us
DMI b
South Bridge PCI-PCI Ethernet USB
VGA
Bridge Controller Controller
PCI Bus 1
USB USB
USB USB device
device
More bridge device
PCI
Legacy devices
Devices PS2
(keyboard, mouse,
PC speaker)
10
The x86 Evolution (8088)
• 8088 General Purpose Registers
– 16 bit microprocessor
– 20 bit external address bus
• Can address 1MB of memory
– Registers are 16 bit
General Purpose Registers
AX, BX, CD, DX,
Pointer Registers
BP, SI, DI, SP
Instruction Pointer : IP
Segment Registers GPRs can be accessed as
CS, SS, DS, ES 8 bit or 16 bit registers
– Accessing memory Eg.
(segment_base << 4) + offset mov $0x1, %ah ; 8 bit move
eg: (CS << 4) + IP mov $0x1, %ax ; 16 bit move
11
The x86 Evolution (80386)
• 80386 (1995) General Purpose Registers
– 32 bit microprocessor
– 32 bit external address bus
• Can address 4GB of memory
– Registers are 32 bit
General Purpose Registers
EAX, EBX, ECD, EDX,
Pointer Registers
EBP, ESI, EDI, ESP
Instruction Pointer : IP
Segment Registers GPRs can be accessed as
CS, SS, DS, ES 8, 16, 32 bit registers
– Lot more features e.g.
• Protected operating mode mov $0x1, %ah ; 8 bit move
• Virtual addresses mov $0x1, %ax ; 16 bit move
mov $0x1, %eax ; 32 bit move
12
The x86 Evolution (k8)
• AMD k8 (2003)
– RAX instead of EAX
– X86-64, x64, amd64, intel64: all same thing
• Backward compatibility
– All systems backward compatible with 8088
13