Laface - 2007 1.1 Operating System Design Booting a PC to run a kernel from Low memory VGA display.

Slides:



Advertisements
Similar presentations
Chapter 2 How Hardware and Software Work Together.
Advertisements

PC bootup Presented by: Rahul Garg (2003CS10183) Rajat Sahni (2003CS10184) Varun Gulshan(2003CS10191)
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
The power supply performs a self-test. When all voltages and current levels are acceptable, the supply indicates that the power is stable and sends the.
Intel MP.
OS Memory Addressing.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Memory Management (II)
“Virtual” Memory How does the OS kernel provide “private” and “shared” memory areas to multiple concurrent processes?
1 Last Class: Introduction Operating system = interface between user & architecture Importance of OS OS history: Change is only constant User-level Applications.
CS2422 Assembly Language & System Programming September 22, 2005.
IT Systems Memory EN230-1 Justin Champion C208 –
1 OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
The Internal Components of a Personal Computer (PC)
Conventional Memory 8088 processor could address only 1 MB
Introduction Part 1 The Microprocessor Based Systems  Memory and I/O System  Microprocessor.
Aug CMSC 104, LECT-021 Machine Architecture and Number Systems Some material in this presentation is borrowed form Adrian Ilie From The UNIVERSITY.
Computer Organization
Basic Input Output System
Linux Booting Procedure
Computing Hardware Starter.
6.828: PC hardware and x86 Frans Kaashoek
Day 4 Understanding Hardware Partitions Linux Boot Sequence.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
A+ Guide to Software Managing, Maintaining and Troubleshooting THIRD EDITION Chapter 9 Managing Memory.
Boot Sequence (DOS) for the IBM PC
1 CS503: Operating Systems Spring 2014 Dongyan Xu Department of Computer Science Purdue University.
From UEFI Shell to Linux - UEFI Linux BootLoader Zhang Rui Software Engineer Sep 28 th 2011.
Hardware Data Storage.
Hardware Boot Sequence. Vocabulary BIOS = Basic Input Output System UEFI = Unified Extensible Firmware Interface POST= Power On Self Test BR = Boot Record.
Making MINT64OS Chan Seok Kang 2013/01/21. 2Computer Systems and Platforms Lab Content Introduction My Approach Encountered Problem Conclusion & Future.
Operating Systems COMP 4850/CISG 5550 Page Tables TLBs Inverted Page Tables Dr. James Money.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Inside your computer. Hardware Review Motherboard Processor / CPU Bus Bios chip Memory Hard drive Video Card Sound Card Monitor/printer Ports.
Inside your computer. Hardware Motherboard Processor / CPU Bus Bios chip Memory Hard drive Video Card Sound Card Monitor/printer Ports.
GCSE Information Technology Computer Systems 2 Hardware is the name that is given to any part of a computer that you can actually touch. An individual.
Virtual Memory Review Goal: give illusion of a large memory Allow many processes to share single memory Strategy Break physical memory up into blocks (pages)
2003 Dominic Swayne1 Microsoft Disk Operating System and PC DOS CS-550-1: Operating Systems Fall 2003 Dominic Swayne.
Computers Are Your Future Chapter 1 Slide 1 Introduction to the Computers & Internet Chapter 1 Concepts of Information Technology IT.
SAPC Hardware Pentium CPU (or 486) 4M usable memory no hard disk; boot from floppy no keyboard or monitor or mouse COM2 serial port: used for console i/o.
1 Homework Reading –PAL pp , Continue mp1 –Questions? Continue lab sessions with your section.
Aug CMSC 104, LECT-021 Machine Architecture Some material in this presentation is borrowed form Adrian Ilie From The UNIVERSITY of NORTH CAROLINA.
Computer Systems Week 14: Memory Management Amanda Oddie.
Bootstrapping Steve Muckle Dave Eckhardt. Carnegie Mellon University1 Synchronization Project 3 checkpoint 1 Bboard post, web page Paging, COW optional.
1.4 Hardware Review. CPU  Fetch-decode-execute cycle 1. Fetch 2. Bump PC 3. Decode 4. Determine operand addr (if necessary) 5. Fetch operand from memory.
Electronic Analog Computer Dr. Amin Danial Asham by.
© GCSE Computing Computing Hardware Starter. Creating a spreadsheet to demonstrate the size of memory. 1 byte = 1 character or about 1 pixel of information.
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Bootable Programs Building an O/S. Basic Requirements of any O/S Respond to interrupts (all kinds) Preserve user environment Protect users and self from.
POST and The Boot Process
Memory The term memory is referred to computer’s main memory, or RAM (Random Access Memory). RAM is the location where data and programs are stored (temporarily),
OS Memory Addressing. Architecture CPU – Processing units – Caches – Interrupt controllers – MMU Memory Interconnect North bridge South bridge PCI, etc.
Bootstrapping Introduction. Bootstrapping Introduction: Computers execute programs stored in main memory, and initially the operating system is on the.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
Computer Technician POST and The Boot Process ©UNT in Partnership with TEA1.
Lecture 2. General-Purpose Computer Systems Prof. Taeweon Suh Computer Science Education Korea University ECM586 Special Topics in Embedded Systems.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 1 Looking Inside the Computer System.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
OS Virtualization.
Booting Up 15-Nov-18 boot.ppt.
SAPC Hardware Pentium CPU (or 486) 4M usable memory
Von Neumann model - Memory
2.C Memory GCSE Computing Langley Park School for Boys.
Modern PC operating systems
Reverse engineering through full system simulations
CS444/544 Operating Systems II Virtual Memory
Presentation transcript:

Laface Operating System Design Booting a PC to run a kernel from Low memory VGA display 16-bit devices Expansion ROMs Bios ROM Extended memory Unused 32-bit BIOS and memory mapped devices 0xFFFFFFFF (4GB) 0x (1MB) 0x000F0000 (960 KB) 0x000C0000 (768 KB) 0x000A0000 (640 KB) 0x Depends on amount of RAM

Laface Operating System Design PC physical address space layout The first PCs, which were based on the 16-bit Intel 8088 processor, were only capable of addressing 1MB of physical memory. The physical address space of an early PC would therefore start at 0x but end at 0x000FFFFF instead of 0xFFFFFFFF. The 640KB area marked "Low Memory" was the only random- access memory (RAM) that an early PC could use. Low memory 0x000A0000 (640 KB) 0x

Laface Operating System Design PC physical address space layout The 384KB area from 0x000A0000 through 0x000FFFFF was reserved by the hardware for special uses such as video display buffers and firmware held in nonvolatile memory. The most important part of this reserved area is the Basic Input/Output System (BIOS), which occupies the 64KB region from 0x000F0000 through 0x000FFFFF. 0x (1MB) 0x000F0000 (960 KB) 0x000C0000 (768 KB) 0x000A0000 (640 KB) 0x Low memory VGA display 16-bit devices Expansion ROMs Bios ROM

Laface Operating System Design The BIOS More BIOS is located at the high end of the 32-bit address range for use by 32-bit PCI devices. The BIOS is responsible for performing Power- On-Self-Test and basic system initialization such as activating the video card and checking the amount of memory installed. After performing this initialization, the BIOS loads the operating system from some appropriate location such as floppy disk, hard disk, CD-ROM, or the network, and passes control of the machine to the operating system 32-bit BIOS and memory mapped devices Unused Extended memory Bios ROM 16-bit devices Expansion ROMs VGA display Low memory

Laface Operating System Design PC physical address space layout Intel and processors supported 16MB and 4GB physical address spaces respectively, but the PC architects preserved the original layout for the low 1MB of physical address space for backward compatibility with existing software. Modern PCs therefore have a "hole" in physical memory from 0x000A0000 to 0x , dividing RAM into "low" or "conventional memory" (the first 640KB) and "extended memory" (everything else). 32-bit BIOS and memory mapped devices Unused Extended memory Bios ROM 16-bit devices Expansion ROMs VGA display Low memory

Laface Operating System Design ROM BIOS in action 486 and later processors start executing at physical address 0xFFFFFFF0, which is at the very top of the memory space, in an area reserved for the ROM BIOS. The first instruction is: jmp far f000:e05b This instruction jumps to the normal BIOS, which is located in the 64KB region from 0xF0000 to 0xFFFFF mentioned above. The CPU starts in real mode, so the jmp far instruction is a real mode jump that restores us to low memory. In real mode, the segmented address segment:offset translates to the physical address segment*16+offset Thus, f000:e05b translates to 0x000fe05b 0x000f x0000e05b = 0x000fe05b 0x0000f000 * 16 =

Laface Operating System Design ROM BIOS in action No GDT, LDT or paging table is needed by the CPU in real mode The code that initializes these data structures must run in real mode When the BIOS runs –it initializes the PCI bus and all the important devices it knows about, (in particular VGA display) –then it searches for a bootable device such as a floppy, hard drive, or CD-ROM. –when it finds a bootable disk, it reads the boot loader from the disk and transfers control to it.

Laface Operating System Design The Boot Loader Is the program run by the BIOS to load the image of a kernel into RAM. Floppy and hard disks for PCs are by historical convention divided up into 512 byte regions called sectors. If the disk is bootable, the first sector is called the boot sector, since this is where the Boot Loader code resides. When the BIOS finds a bootable floppy or hard disk, it loads the 512- byte boot sector into low memory, at physical addresses 0x7c00 through 0x7dff and then uses a jmp instruction to set the CS:IP to 0000:7c00, passing control to the Boot Loader. 0x7e00 - 0x7c00 = 0x0200 = 2 9 = 512

Laface Operating System Design Boot Loader Files boot.S –First, the boot loader switches the processor from real mode to 32-bit protected mode, because it is only in this mode that software can access all the memory above 1MB in the processor's physical address space. main.c –Second, the boot loader reads the kernel from the hard disk by directly accessing the IDE disk device registers via the x86's special I/O instructions. boot.asm –This file is a disassembly of the boot loader. It easy to see exactly where in physical memory all of the boot loader's code resides.

Laface Operating System Design Bochs x86 Emulator (bochsdbg) Next at t=0 (0) [0xfffffff0] f000:fff0 (unk. ctxt): jmp far f000:e05b ; ea5be000f help -*- Debugger control -*- help, q|quit|exit, set, instrument, show, trace, trace-reg, record, playback, load-symbols, slist -*- Execution control -*- c|cont|continue, s|step|stepi, p|n|next, modebp -*- Breakpoint management -*- vb|vbreak, lb|lbreak, pb|pbreak|b|break, sb, sba, blist, bpe, bpd, d|del|delete -*- CPU and memory contents -*- x, xp, u|disasm|disassemble, r|reg|regs|registers, setpmem, crc, info, set, dump_cpu, set_cpu, ptime, print-stack, watch, unwatch, ?|calc

Laface Operating System Design Passing control to Kernel The boot loader's link and load addresses match perfectly There is a rather large disparity between the kernel's link and load addresses. Operating system kernels often like to be linked and run at very high virtual address, such as 0xf , in order to leave the lower part of the processor's virtual address space for user programs to use.

Laface Operating System Design Kernel load address and virtual address Since we can't actually load the kernel at physical address 0xf , we will use the processor's memory management hardware to map virtual address 0xf the link address at which the kernel code expects to run -- to physical address 0x where the boot loader actually loaded the kernel. The kernel's virtual address is high enough to leave plenty of address space for user processes, it will be loaded in physical memory at the 1MB point in the PC's RAM, just above the BIOS ROM. 0x (1MB) 0x000F0000 (960 KB) 0x000C0000 (768 KB) 0x000A0000 (640 KB) 0x Low memory VGA display 16-bit devices Expansion ROMs Bios ROM

Laface Operating System Design JOS Kernel Map the entire bottom 256MB of the PC's physical address space, from 0x through 0x0FFFFFFF, to virtual addresses 0xF through 0xFFFFFFFF respectively. Thus, the JOS kernel is limited to using only the first 256MB of physical memory in a PC. When the JOS kernel first starts up segmentation is used to establish our desired virtual-to-physical mapping.