0% found this document useful (0 votes)
2 views

3-Operating Systems- PC Hardware & Booting [Autosaved]

The document provides an overview of operating systems, focusing on PC hardware and the booting process. It discusses various address types, the evolution of x86 processors, and the steps involved in building and booting an operating system, including the role of BIOS and bootloaders. Additionally, it covers multiprocessor organization and the booting of Linux systems.

Uploaded by

elsa6.6.2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

3-Operating Systems- PC Hardware & Booting [Autosaved]

The document provides an overview of operating systems, focusing on PC hardware and the booting process. It discusses various address types, the evolution of x86 processors, and the steps involved in building and booting an operating system, including the role of BIOS and bootloaders. Additionally, it covers multiprocessor organization and the booting of Linux systems.

Uploaded by

elsa6.6.2023
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Operating Systems –

PC Hardware and
Booting

Dr. M. Brindha
Associate Professor
Department of CSE
NIT, Trichy-15
CPUs

Processor
i386
Everything has an
address

0x3c0:0x3cf
0x60:0x6f

Processor
i386

0x1f0:0x1f7

0x0 : 0x200000 0x60:0x6f


Address
Types
• Memory Addresses
• IO Addresses
• Memory Mapped IO Addresses
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
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
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
inb $0x64, %al
outb %al, $0x64

ref : http://bochs.sourceforge.net/techspec/PORTS.LST 8
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
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
PC
Organization
Processor Processor Processor Processor
1 2 3 4

front side bus

Memory bus
DRAM North Bridge

PCI Bus 0
bus
DMI
South Bridge PCI-PCI Ethernet USB
VGA
Bridge Controller Controller

PCI Bus 1
USB
USB USB USB device
device bridge device
More
PCI
Legacy devices
Devices PS2
(keyboard, mouse,
PC speaker)
The x86 Evolution (8088)
General Purpose Registers
• 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 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
The x86 Evolution (80386)
General Purpose Registers
• 80386
– 32 bit microprocessor
(1995)
– 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
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
Building and Booting an Operating System

• Operating systems generally designed to run on a


class of systems with variety of peripherals
• Commonly, operating system already installed on
purchased computer
• But can build and install some other operating systems
• If generating an operating system from scratch
• Write the operating system source code
• Configure the operating system for the system on which it
will run
• Compile the operating system
• Install the operating system
• Boot the computer and its new operating system
System Boot
• When power initialized on system, execution starts at a fixed
memory location
• Operating system must be made available to hardware so
hardware can start it
• Small piece of code – bootstrap loader, BIOS, stored in ROM
or EEPROM locates the kernel, loads it into memory, and starts it
• Sometimes two-step process where boot block at fixed location
loaded by ROM code, which loads bootstrap loader from disk
• Modern systems replace BIOS with Unified Extensible
Firmware Interface (UEFI)
• Common bootstrap loader, GRUB, allows selection of kernel
from multiple disks, versions, kernel options
• Kernel loads and system is then running
• Boot loaders frequently allow various boot states, such as single
user mode
Powering Up
Power on Reset

reset
Powering up :
Reset
Power on Reset
Physical address = (CS << 4) + IP
Every register initialized = 0xffff0
to 0 except • first instruction fetched from location 0xffff0.
CS=0xf000, IP=0xfff0
• 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
Inaccessible • First instruction is at right on top of accessible
memory
memory
• Should jump to another location
first instructions 0x100000
(Jump to rom bios) 0xFFFF0

0xF0000
BIO
S
0
RAM
Powering up :
BIOS
Power on Reset

Every register initialized


to 0 except
CS=0xf000, IP=0xfff0

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
Powering up :
MBR
Power on Reset
• Sector 0 in the disk called Master Boot Record (MBR)
Every register initialized
to 0 except • Contains code that boots the OS or another boot loader
CS=0xf000, IP=0xfff0 • Copied from disk to RAM (@0x7c00) by BIOS and then
begins to execute
BIOS • Size 512 bytes
446 bytes bootable code
64 bytes disk partition information (16 bytes per partition)
MBR Execution 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
Powering Up :
bootloader
Power on Reset

Every register initialized • Loads the operating system


to 0 except – May also allow the user to select which OS to load
CS=0xf000, IP=0xfff0 (eg. Windows or Linux)
• Other jobs done
BIOS – Disable interrupts :
• Don’t want to bother with interrupts at this stage
• Interrupts re-enabled by xv6 when ready
MBR Execution – Setup GDT
– Switch from real mode to protected mode
– Read operating system from disk
Bootloader

The bootloader may be present in the MBR (sector 0)


itself
Powering Up :
OS
Power on Reset

Every register initialized


to 0 except
CS=0xf000, IP=0xfff0

• Set up virtual memory


BIOS
• Initialize interrupt vectors
• Initilize
MBR Execution • timers,
• monitors,
Bootloader • hard disks,
• consoles,
• filesystems,
OS
• Initialized other processors (if any)
• Startup user process
Multiprocessor
Organization
Processor Processor Processor Processor
1 2 3 4

front side bus

Memory bus
DRAM North Bridge

• 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
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 26
Building and Booting Linux

• Download Linux source code


(http://www.kernel.org)
• Configure kernel via “make menuconfig”
• Compile the kernel using “make”
• Produces vmlinuz, the kernel image
• Compile kernel modules via “make modules”
• Install kernel modules into vmlinuz via “make
modules_install”
• Install new kernel on the system via “make
install”
Thank You!!!

You might also like