Administrative Overview 6 Projects Design Review: Monday before 6:30pm Lab Friend Center 010 (“Fishbowl”)

Slides:



Advertisements
Similar presentations
COMP 2003: Assembly Language and Digital Logic
Advertisements

Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.
CS318 Project #2 Bootup Mechanism.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Lecture 6 Machine Code: How the CPU is programmed.
Princess Sumaya University
Operating Systems: Segments 1 Segmentation Hardware Support single user program system: – wish somehow to relocate address 0 to after operating system.
COS318 Lec 21 Operating System Structures Vivek Pai Princeton University.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
PC hardware and x86 3/3/08 Frans Kaashoek MIT
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.
CS2422 Assembly Language & System Programming November 2, 2006.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
6.828: PC hardware and x86 Frans Kaashoek
CDP ECE Spring 2000 ECE 291 Spring 2000 Lecture 7: More on Addressing Modes, Structures, and Stack Constantine D. Polychronopoulos Professor, ECE.
The Pentium Processor.
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
(-133)*33+44* *33+44*14 Input device memory calculator Output device controller Control bus data bus memory.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Carnegie Mellon 1 Machine-Level Programming I: Basics Lecture, Feb. 21, 2013 These slides are from website which accompanies the.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
4. Kernel and VGA ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  None.
X86 Assembly Language We will be using the nasm assembler (other assemblers: MASM, as, gas)
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
BITS Pilani Pilani Campus Pawan Sharma Lecture / ES C263 INSTR/CS/EEE F241 Microprocessor Programming and Interfacing.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Assembly language programming
Homework Reading Lab with your assigned section starts next week
Assembly language.
Format of Assembly language
Operating Systems Engineering
143A: Principles of Operating Systems Lecture 7: System boot
Computer Organization & Assembly Language Chapter 3
16.317: Microprocessor System Design I
Microprocessor Systems Design I
Chapter 4 Data Movement Instructions
Assembly IA-32.
x86 segmentation, page tables, and interrupts
Homework Reading Continue work on mp1
Basic of Computer Organization
Symbolic Instruction and Addressing
Introduction to Assembly Language
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
שפת סף וארכיטקטורה של מעבד 8086
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
Assembly Language (CSW 353)
Lecture 06 Programming language.
Computer Architecture CST 250
Chapter 6 –Symbolic Instruction and Addressing
CSC 497/583 Advanced Topics in Computer Security
Computer Architecture and System Programming Laboratory
Presentation transcript:

Administrative Overview 6 Projects Design Review: Monday before 6:30pm Lab Friend Center 010 (“Fishbowl”)

COS 318 Project 1 Bootloader

Problem We will write an Operating System  Manages programs, resources, users, etc. How are programs loaded?  The OS takes care of this How is the OS loaded? …

Booting a Computer On Startup… The BIOS is loaded  Typically doesn’t know anything about the OS  Minimal functionality The BIOS loads & runs the first sector of a boot device.  An OS cannot fit in just one sector

Bootup Details Start at 0xFFFF0 Self test & initialization Search for a boot device  Hard disk  Floppy  Flash  …

Bootup Details 1 st sector loaded to 0x7c00 Jump to 0x7c bytes to load the kernel

Bootloader Kernel Disk Memory

Entering the Bootloader %dl = Boot device number  Load the kernel from this device %cs = Code segment NO STACK! (%ss, %sp unset) %ds unset (set it to 0x07c0 before fetching from memory!) Other registers unset

The kernel might be big Kernel

Solution Move the bootloader Kernel

Loading the kernel Load to address 0x0000:1000 Set up the stack  %ss = 0x9000, %sp=0xfffe %ds = 0 Long Jump to 0x0000:1000

Design Review print_char, print_string Example: _start: jmp past_data welcome_msg:.asciz “OS Project 1\n\rLoading…” past_data: push welcome_msg call print_string jmp somewhere_else

Design Review Bootloader  How to find the kernel on disk?  Where to copy the kernel?  How to copy the kernel? Createimage  How do you find the code segments in ELF using header information?  Give a formula for the disk/image address of segment i in the program header.  Where do you use padding?

How long will this take? Bootloader  About 80 lines assembly  Simple instructions (int, mov, cld) Createimage  About 200 lines of C  Hardest part: navigating ELF structs Debugging will take the most time.

Addressing Real Mode  1 MB  Format: 0x0000:0000  Physical address = (segment << 4)+offset Ex: 0x07c0:0000 = 0x0000:7c00 Protected Mode  4 GB (32-bit)  Format: 0x0000: (32-bit)  Virtual Addressing (user mode)  Physical address = a bit more complicated…

Registers E_XEAX, EBX, ECX, EDX _XAX, BX, CX, DX _H_LAH, AL, BH, BL, … Segment Registers 16 CS, DS, SS, ES, FS, GS Index Registers 32 BP, SI, DI, SP Status & Control 32 EFLAGS, EIP General Registers

AT&T Syntax Registers: %ax, %ah, %eax,… Definitions .equ BOOT_SEGMENT, 0x07c0 Constants: $0x0100, $4 Labels  _start:  print_string: Memory access  movw %ax, (0x40)  movb %dl, (a_label)  movw %es:(%ax), %dx Comments  /* multiline */  # to the end of the line Directives .equ,.byte,.word,.ascii,.asciz

Assembly Pitfalls.equ BOOT_SEGMENT, 0x07c0 movw BOOT_SEGMENT, %ds