SlideShare a Scribd company logo
PC Hardware & Booting
Chester Rebeiro
IIT Madras
22
Outline
• Memory and Device Addresses
• PC Organization
• x86 Evolution
• Powering up
• Booting xv6
• Multiprocessor booting
3
CPUs
Processor
i386
4
Everything has an address
Processor
i386
0x0 : 0x200000 0x60:0x6f
0x1f0:0x1f7
0x3c0:0x3cf
0x60:0x6f
Address Types
• Memory Addresses
• IO Addresses
• Memory Mapped IO Addresses
5
6
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
Memory Map
7
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
8
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
inb $0x64, %al
outb %al, $0x64
9
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
10
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
11
PC Organization
Processor
1
Processor
2
Processor
3
Processor
4
front side bus
North BridgeDRAM
South Bridge Ethernet
Controller
VGA
PCI-PCI
Bridge
USB
Controller
DMI bus
PCI Bus 0
More
PCI
devices
USB
device
USB
bridge
USB
device
USB
device
Legacy
Devices PS2
(keyboard, mouse,
PC speaker)
PCI Bus 1
Memory bus
12
The x86 Evolution (8088)
• 8088
– 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
CS, SS, DS, ES
– Accessing memory
(segment_base << 4) + offset
eg: (CS << 4) + IP
General Purpose Registers
GPRs can be accessed as
8 bit or 16 bit registers
Eg.
mov $0x1, %ah ; 8 bit move
mov $0x1, %ax ; 16 bit move
13
The x86 Evolution (80386)
• 80386 (1995)
– 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
CS, SS, DS, ES
– Lot more features
• Protected operating mode
• Virtual addresses
General Purpose Registers
GPRs can be accessed as
8, 16, 32 bit registers
e.g.
mov $0x1, %ah ; 8 bit move
mov $0x1, %ax ; 16 bit move
mov $0x1, %eax ; 32 bit move
14
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
15
The curse of backward compatibility
(the A20 gate)
• 8088 addressing
– CS = 0xf800, IP = 0x8000, physical address
= (CS << 4) + IP = 0x100000
– but 8088 has only 20 address lines (a0 to a19)
so only 20 bits of 0x100000 are valid
– effective address = 0x0 (due to wrap around)
MSDOS programs make use of this wrap
around for speed.
(No need to change the CS)
memory
0x0
0x10000
Having 2 segments with one segment register
CS = 0xf800
IP = 0:0x7ffff (gets mapped to top of memory)
IP = 0x8000:0xffff (gets mapped to bottom of memory)
16
The curse of backward compatibility
contd. (the A20 gate)
• 80386 addressing
– CS = 0xf800, IP = 0x8000, physical
address = (CS << 4) + IP = 0x100000
– 80386 has 32 address lines (a0 to a31)
therefore can access more than 1MB
– effective address is therefore 0x100000
and not 0.
• Not backward compatible to 8086
memory
0x0
0x10000
Having 2 segments with one segment register
NOT FEASIBLE!!
CS = 0xf800
IP = 0:0x7ffff (gets mapped below 1MB)
IP = 0x8000:0xffff (gets mapped above 1MB)
17
The curse of backward compatibility
contd. (the A20 gate)
• Have a gate (called A20 gate)
– In real mode (8086 compatible mode) disable A20 to ensure wrap
around
– In protected mode (not 8086 compatible) enable A20 to allow full
memory access.
• Implementing the gate
– port 0x64 (part of keyboard I/O memory)
while(keyboard is busy);
output 0xD1 to port 0x64
while(keyboard is busy);
output 0xDF to port 0x60
Powering Up
18
Power on Reset
reset
19
Powering up : Reset
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
Physical address = (CS << 4) + IP
= 0xffff0
• first instruction fetched from location 0xffff0.
• Processor in real mode (backward compatible to
8088)
• Limited to 1MB addresses
• No protection; no privilege levels
• Direct access to all memory
• No multi-tasking
• First instruction is at right on top of accessible
memory
• Should jump to another location
Inaccessible
memory
BIOS
0
0x100000
0xFFFF0
0xF0000
first instructions
(Jump to rom bios)
RAM
20
Powering up : BIOS
• Present in a small chip connected to the
processor
– Flash/EPROM/E2PROM
• Does the following
– Power on self test
– Initialize video card and other devices
– Display BIOS screen
– Perform brief memory test
– Set DRAM memory parameters
– Configure Plug & Play devices
– Assign resources (DMA channels & IRQs)
– Identify the boot device
• Read sector 0 from boot device into memory location 0x7c00
• Jumps to 0x7c00
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
BIOS
21
Powering up : MBR
• Sector 0 in the disk called Master Boot Record (MBR)
• Contains code that boots the OS or another boot loader
• Copied from disk to RAM (@0x7c00) by BIOS and then
begins to execute
• Size 512 bytes
446 bytes bootable code
64 bytes disk partition information (16 bytes per partition)
2 bytes signature
• Typically, MBR code looks through partition table and
loads the bootloader (such as Linux or Windows)
• or, it may directly load the OS
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
BIOS
MBR Execution
22
Powering Up : bootloader
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
BIOS
MBR Execution
Bootloader
• Loads the operating system
– May also allow the user to select which OS to load
(eg. Windows or Linux)
• Other jobs done
– Disable interrupts :
• Don’t want to bother with interrupts at this stage
• Interrupts re-enabled by xv6 when ready
– Setup GDT
– Switch from real mode to protected mode
– Read operating system from disk
The bootloader may be present in the MBR (sector 0)
itself
23
Powering Up : OS
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
BIOS
MBR Execution
Bootloader
• Set up virtual memory
• Initialize interrupt vectors
• Initilize
• timers,
• monitors,
• hard disks,
• consoles,
• filesystems,
• Initialized other processors (if any)
• Startup user process
OS
24
Powering Up : xv6
Power on Reset
Every register initialized
to 0 except
CS=0xf000, IP=0xfff0
BIOS
Bootloader
OS
• Bootloader
• Present in sector 0 of disk.
• 512 bytes
• 2 parts:
– bootasm.S (8900)
• Enters in 16 bit real mode, leaves in 32 bit
protected mode
• Disables interrupts
– We don’t want to use BIOS ISRs
• Enable A20 line
• Load GDT (only segmentation, no paging)
• Set stack to 0x7c00
• Invoke bootmain
• Never returns
– bootmain.c (9017)
• Loads the xv6 kernel from sector 1 to RAM
starting at 0x100000 (1MB)
• Invoke the xv6 kernel entry
– _start present in entry.S (sheet 10)
– This entry point is known from the ELF
header
Multiprocessor Organization
Processor
1
Processor
2
Processor
3
Processor
4
front side bus
North BridgeDRAM
Memory bus
• Memory Symmetry
• All processors in the system share the same memory space
• Advantage : Common operating system code
• I/O Symmetry
• All processors share the same I/O subsystem
• Every processor can receive interrupt from any I/O device
26
Multiprocessor Booting
• One processor designated as ‘Boot Processor’ (BSP)
– Designation done either by Hardware or BIOS
– All other processors are designated AP (Application Processors)
• BIOS boots the BSP
• BSP learns system configuration
• BSP triggers boot of other AP
– Done by sending an Startup IPI (inter processor interrupt) signal to
the AP
http://www.intel.com/design/pentium/datashts/24201606.pdf
xv6 Multiprocessor Boot
• mpinit (7001) invoked from main (1221)
– Searches for an MP table in memory
• (generally put there by the BIOS)
• Contains information about processors in system along with
other details such as IO-APICs, Processor buses, etc.
• Extracts system information from MP table
– Fills in the cpu id (7024)
• CPU is a structure which contains CPU specific data (2304)
27
Booting APs
• startothers (1274) invoked from main(1237)
– copy ‘entryother’ to location 0x7000
– For each CPU found
• Allocate a stack (1295)
• Set C entry point to mpenter (1252)
• Send a Startup IPI (1299)
– Pass the entryother.S location to the new processor (40:67  0x7000
>> 4)
– Send inter processor interrupt to the AP processor using its apicid
• Wait until CPU has started
28
for next class
• Read / revise about memory management
in x86 especially
– Segmentation (GDT)
– Virtual memory (page tables, CR3 register,
etc)
29

More Related Content

What's hot

Intel Pentium Pro
Intel Pentium ProIntel Pentium Pro
Intel Pentium Pro
Muhtasim Fuad Rafid
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor SpecificationsAli Usman
 
Chapter 5 Processors
Chapter 5 ProcessorsChapter 5 Processors
Chapter 5 ProcessorsPatty Ramsey
 
What is-32-bit-and-64-bit
What is-32-bit-and-64-bitWhat is-32-bit-and-64-bit
What is-32-bit-and-64-bit
IGZ Software house
 
Intel microprocessor history
Intel microprocessor historyIntel microprocessor history
Intel microprocessor historyRamzi Alqrainy
 
Emulating Game Boy in Java
Emulating Game Boy in JavaEmulating Game Boy in Java
Emulating Game Boy in Java
Tomasz Rękawek
 
Computer System Architecture Lecture Note 4: intel microprocessors
Computer System Architecture Lecture Note 4: intel microprocessorsComputer System Architecture Lecture Note 4: intel microprocessors
Computer System Architecture Lecture Note 4: intel microprocessors
Budditha Hettige
 
Cpu And Memory Events
Cpu And Memory EventsCpu And Memory Events
Cpu And Memory EventsAero Plane
 
Chapter 5 Questions
Chapter 5 QuestionsChapter 5 Questions
Chapter 5 Questionsguest1689620
 
Intel Processors
Intel ProcessorsIntel Processors
Intel Processors
home
 
3 microprocessors
3 microprocessors3 microprocessors
3 microprocessors
hafizhanif86
 
Shashank hardware workshop final
Shashank hardware workshop finalShashank hardware workshop final
Shashank hardware workshop final
techbed
 
Processor types
Processor typesProcessor types
Processor types
Amr Aboelgood
 
2nd puc computer science chapter 1 backdrop of computers
2nd puc computer science chapter 1  backdrop of computers 2nd puc computer science chapter 1  backdrop of computers
2nd puc computer science chapter 1 backdrop of computers
Aahwini Esware gowda
 
Operating Systems (slides)
Operating Systems (slides)Operating Systems (slides)
Operating Systems (slides)
wx672
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
maruthisai
 

What's hot (19)

Intel Pentium Pro
Intel Pentium ProIntel Pentium Pro
Intel Pentium Pro
 
Processor Specifications
Processor SpecificationsProcessor Specifications
Processor Specifications
 
11
1111
11
 
Chapter 5 Processors
Chapter 5 ProcessorsChapter 5 Processors
Chapter 5 Processors
 
What is-32-bit-and-64-bit
What is-32-bit-and-64-bitWhat is-32-bit-and-64-bit
What is-32-bit-and-64-bit
 
Intel microprocessor history
Intel microprocessor historyIntel microprocessor history
Intel microprocessor history
 
Emulating Game Boy in Java
Emulating Game Boy in JavaEmulating Game Boy in Java
Emulating Game Boy in Java
 
Computer System Architecture Lecture Note 4: intel microprocessors
Computer System Architecture Lecture Note 4: intel microprocessorsComputer System Architecture Lecture Note 4: intel microprocessors
Computer System Architecture Lecture Note 4: intel microprocessors
 
Vivekanand Motherboard Ppt
Vivekanand Motherboard PptVivekanand Motherboard Ppt
Vivekanand Motherboard Ppt
 
Cpu And Memory Events
Cpu And Memory EventsCpu And Memory Events
Cpu And Memory Events
 
Chapter 5 Questions
Chapter 5 QuestionsChapter 5 Questions
Chapter 5 Questions
 
Intel Processors
Intel ProcessorsIntel Processors
Intel Processors
 
Ch04
Ch04Ch04
Ch04
 
3 microprocessors
3 microprocessors3 microprocessors
3 microprocessors
 
Shashank hardware workshop final
Shashank hardware workshop finalShashank hardware workshop final
Shashank hardware workshop final
 
Processor types
Processor typesProcessor types
Processor types
 
2nd puc computer science chapter 1 backdrop of computers
2nd puc computer science chapter 1  backdrop of computers 2nd puc computer science chapter 1  backdrop of computers
2nd puc computer science chapter 1 backdrop of computers
 
Operating Systems (slides)
Operating Systems (slides)Operating Systems (slides)
Operating Systems (slides)
 
Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 

Similar to 3 hardware

Micro[processor
Micro[processorMicro[processor
Micro[processorcollege
 
1 study of motherboard
1 study of motherboard1 study of motherboard
1 study of motherboard
Ankit Dubey
 
Computer Main Comppponents.pdf
Computer Main Comppponents.pdfComputer Main Comppponents.pdf
Computer Main Comppponents.pdf
thinalost
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
RahnerJames
 
BIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptxBIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptx
SamiWhoo
 
Funciones del bios y codigos post ingles
Funciones del bios y codigos post inglesFunciones del bios y codigos post ingles
Funciones del bios y codigos post ingles
Jose Antonio Torres P
 
Computerhardware 130909042641-
Computerhardware 130909042641-Computerhardware 130909042641-
Computerhardware 130909042641-
zeyneptsd
 
Lecture_Chapter_8.ppt
Lecture_Chapter_8.pptLecture_Chapter_8.ppt
Lecture_Chapter_8.ppt
Hailsh
 
Chapter 1 Introducing Hardware
Chapter 1 Introducing HardwareChapter 1 Introducing Hardware
Chapter 1 Introducing HardwareApril Lorraine
 
Presentation007
Presentation007Presentation007
Presentation007ajaytank
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
shimosawa
 
OS-Part-01.pdf
OS-Part-01.pdfOS-Part-01.pdf
OS-Part-01.pdf
NguyenTienDungK17HL
 
8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt
JamesAlpha3
 
Register & Memory
Register & MemoryRegister & Memory
Register & Memory
Education Front
 
x86_1.ppt
x86_1.pptx86_1.ppt
x86_1.ppt
jeronimored
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
Jin Wu
 
It322 intro 2
It322 intro 2It322 intro 2
It322 intro 2
J Cza Àkera
 
8086 microprocessor introduction
8086 microprocessor introduction8086 microprocessor introduction
8086 microprocessor introduction
Aakash Ugale
 
Pai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadPai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadYogesh Deshpande
 

Similar to 3 hardware (20)

Micro[processor
Micro[processorMicro[processor
Micro[processor
 
1 study of motherboard
1 study of motherboard1 study of motherboard
1 study of motherboard
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
Computer Main Comppponents.pdf
Computer Main Comppponents.pdfComputer Main Comppponents.pdf
Computer Main Comppponents.pdf
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
 
BIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptxBIOS__Power-On-Self-Test.pptx
BIOS__Power-On-Self-Test.pptx
 
Funciones del bios y codigos post ingles
Funciones del bios y codigos post inglesFunciones del bios y codigos post ingles
Funciones del bios y codigos post ingles
 
Computerhardware 130909042641-
Computerhardware 130909042641-Computerhardware 130909042641-
Computerhardware 130909042641-
 
Lecture_Chapter_8.ppt
Lecture_Chapter_8.pptLecture_Chapter_8.ppt
Lecture_Chapter_8.ppt
 
Chapter 1 Introducing Hardware
Chapter 1 Introducing HardwareChapter 1 Introducing Hardware
Chapter 1 Introducing Hardware
 
Presentation007
Presentation007Presentation007
Presentation007
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
OS-Part-01.pdf
OS-Part-01.pdfOS-Part-01.pdf
OS-Part-01.pdf
 
8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt8086_architecture MMC PPT.ppt
8086_architecture MMC PPT.ppt
 
Register & Memory
Register & MemoryRegister & Memory
Register & Memory
 
x86_1.ppt
x86_1.pptx86_1.ppt
x86_1.ppt
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
 
It322 intro 2
It322 intro 2It322 intro 2
It322 intro 2
 
8086 microprocessor introduction
8086 microprocessor introduction8086 microprocessor introduction
8086 microprocessor introduction
 
Pai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_uploadPai unit 1_l1-l2-l3-l4_upload
Pai unit 1_l1-l2-l3-l4_upload
 

Recently uploaded

Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
aqil azizi
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
zwunae
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 

Recently uploaded (20)

Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdfTutorial for 16S rRNA Gene Analysis with QIIME2.pdf
Tutorial for 16S rRNA Gene Analysis with QIIME2.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单专业办理
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 

3 hardware

  • 1. PC Hardware & Booting Chester Rebeiro IIT Madras
  • 2. 22 Outline • Memory and Device Addresses • PC Organization • x86 Evolution • Powering up • Booting xv6 • Multiprocessor booting
  • 4. 4 Everything has an address Processor i386 0x0 : 0x200000 0x60:0x6f 0x1f0:0x1f7 0x3c0:0x3cf 0x60:0x6f
  • 5. Address Types • Memory Addresses • IO Addresses • Memory Mapped IO Addresses 5
  • 6. 6 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 Memory Map
  • 7. 7 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
  • 8. 8 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 inb $0x64, %al outb %al, $0x64
  • 9. 9 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
  • 10. 10 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
  • 11. 11 PC Organization Processor 1 Processor 2 Processor 3 Processor 4 front side bus North BridgeDRAM South Bridge Ethernet Controller VGA PCI-PCI Bridge USB Controller DMI bus PCI Bus 0 More PCI devices USB device USB bridge USB device USB device Legacy Devices PS2 (keyboard, mouse, PC speaker) PCI Bus 1 Memory bus
  • 12. 12 The x86 Evolution (8088) • 8088 – 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 CS, SS, DS, ES – Accessing memory (segment_base << 4) + offset eg: (CS << 4) + IP General Purpose Registers GPRs can be accessed as 8 bit or 16 bit registers Eg. mov $0x1, %ah ; 8 bit move mov $0x1, %ax ; 16 bit move
  • 13. 13 The x86 Evolution (80386) • 80386 (1995) – 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 CS, SS, DS, ES – Lot more features • Protected operating mode • Virtual addresses General Purpose Registers GPRs can be accessed as 8, 16, 32 bit registers e.g. mov $0x1, %ah ; 8 bit move mov $0x1, %ax ; 16 bit move mov $0x1, %eax ; 32 bit move
  • 14. 14 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
  • 15. 15 The curse of backward compatibility (the A20 gate) • 8088 addressing – CS = 0xf800, IP = 0x8000, physical address = (CS << 4) + IP = 0x100000 – but 8088 has only 20 address lines (a0 to a19) so only 20 bits of 0x100000 are valid – effective address = 0x0 (due to wrap around) MSDOS programs make use of this wrap around for speed. (No need to change the CS) memory 0x0 0x10000 Having 2 segments with one segment register CS = 0xf800 IP = 0:0x7ffff (gets mapped to top of memory) IP = 0x8000:0xffff (gets mapped to bottom of memory)
  • 16. 16 The curse of backward compatibility contd. (the A20 gate) • 80386 addressing – CS = 0xf800, IP = 0x8000, physical address = (CS << 4) + IP = 0x100000 – 80386 has 32 address lines (a0 to a31) therefore can access more than 1MB – effective address is therefore 0x100000 and not 0. • Not backward compatible to 8086 memory 0x0 0x10000 Having 2 segments with one segment register NOT FEASIBLE!! CS = 0xf800 IP = 0:0x7ffff (gets mapped below 1MB) IP = 0x8000:0xffff (gets mapped above 1MB)
  • 17. 17 The curse of backward compatibility contd. (the A20 gate) • Have a gate (called A20 gate) – In real mode (8086 compatible mode) disable A20 to ensure wrap around – In protected mode (not 8086 compatible) enable A20 to allow full memory access. • Implementing the gate – port 0x64 (part of keyboard I/O memory) while(keyboard is busy); output 0xD1 to port 0x64 while(keyboard is busy); output 0xDF to port 0x60
  • 18. Powering Up 18 Power on Reset reset
  • 19. 19 Powering up : Reset Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 Physical address = (CS << 4) + IP = 0xffff0 • first instruction fetched from location 0xffff0. • Processor in real mode (backward compatible to 8088) • Limited to 1MB addresses • No protection; no privilege levels • Direct access to all memory • No multi-tasking • First instruction is at right on top of accessible memory • Should jump to another location Inaccessible memory BIOS 0 0x100000 0xFFFF0 0xF0000 first instructions (Jump to rom bios) RAM
  • 20. 20 Powering up : BIOS • Present in a small chip connected to the processor – Flash/EPROM/E2PROM • Does the following – Power on self test – Initialize video card and other devices – Display BIOS screen – Perform brief memory test – Set DRAM memory parameters – Configure Plug & Play devices – Assign resources (DMA channels & IRQs) – Identify the boot device • Read sector 0 from boot device into memory location 0x7c00 • Jumps to 0x7c00 Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 BIOS
  • 21. 21 Powering up : MBR • Sector 0 in the disk called Master Boot Record (MBR) • Contains code that boots the OS or another boot loader • Copied from disk to RAM (@0x7c00) by BIOS and then begins to execute • Size 512 bytes 446 bytes bootable code 64 bytes disk partition information (16 bytes per partition) 2 bytes signature • Typically, MBR code looks through partition table and loads the bootloader (such as Linux or Windows) • or, it may directly load the OS Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 BIOS MBR Execution
  • 22. 22 Powering Up : bootloader Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 BIOS MBR Execution Bootloader • Loads the operating system – May also allow the user to select which OS to load (eg. Windows or Linux) • Other jobs done – Disable interrupts : • Don’t want to bother with interrupts at this stage • Interrupts re-enabled by xv6 when ready – Setup GDT – Switch from real mode to protected mode – Read operating system from disk The bootloader may be present in the MBR (sector 0) itself
  • 23. 23 Powering Up : OS Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 BIOS MBR Execution Bootloader • Set up virtual memory • Initialize interrupt vectors • Initilize • timers, • monitors, • hard disks, • consoles, • filesystems, • Initialized other processors (if any) • Startup user process OS
  • 24. 24 Powering Up : xv6 Power on Reset Every register initialized to 0 except CS=0xf000, IP=0xfff0 BIOS Bootloader OS • Bootloader • Present in sector 0 of disk. • 512 bytes • 2 parts: – bootasm.S (8900) • Enters in 16 bit real mode, leaves in 32 bit protected mode • Disables interrupts – We don’t want to use BIOS ISRs • Enable A20 line • Load GDT (only segmentation, no paging) • Set stack to 0x7c00 • Invoke bootmain • Never returns – bootmain.c (9017) • Loads the xv6 kernel from sector 1 to RAM starting at 0x100000 (1MB) • Invoke the xv6 kernel entry – _start present in entry.S (sheet 10) – This entry point is known from the ELF header
  • 25. Multiprocessor Organization Processor 1 Processor 2 Processor 3 Processor 4 front side bus North BridgeDRAM Memory bus • Memory Symmetry • All processors in the system share the same memory space • Advantage : Common operating system code • I/O Symmetry • All processors share the same I/O subsystem • Every processor can receive interrupt from any I/O device
  • 26. 26 Multiprocessor Booting • One processor designated as ‘Boot Processor’ (BSP) – Designation done either by Hardware or BIOS – All other processors are designated AP (Application Processors) • BIOS boots the BSP • BSP learns system configuration • BSP triggers boot of other AP – Done by sending an Startup IPI (inter processor interrupt) signal to the AP http://www.intel.com/design/pentium/datashts/24201606.pdf
  • 27. xv6 Multiprocessor Boot • mpinit (7001) invoked from main (1221) – Searches for an MP table in memory • (generally put there by the BIOS) • Contains information about processors in system along with other details such as IO-APICs, Processor buses, etc. • Extracts system information from MP table – Fills in the cpu id (7024) • CPU is a structure which contains CPU specific data (2304) 27
  • 28. Booting APs • startothers (1274) invoked from main(1237) – copy ‘entryother’ to location 0x7000 – For each CPU found • Allocate a stack (1295) • Set C entry point to mpenter (1252) • Send a Startup IPI (1299) – Pass the entryother.S location to the new processor (40:67  0x7000 >> 4) – Send inter processor interrupt to the AP processor using its apicid • Wait until CPU has started 28
  • 29. for next class • Read / revise about memory management in x86 especially – Segmentation (GDT) – Virtual memory (page tables, CR3 register, etc) 29