Timeout for some demos An instructive look at how the Linux Operating System sets up system data-structures.

Slides:



Advertisements
Similar presentations
Using VMX within Linux We explore the feasibility of executing ROM-BIOS code within the Linux x86_64 kernel.
Advertisements

Another device-driver? Getting ready to program the network interface.
Computer Organization. This module surveys the physical resources of a computer system. –Basic components CPUMemoryBus I/O devices –CPU structure Registers.
Creating a device-file node An introduction to some privileged Linux system-calls (needed for an upcoming programming exercise)
Computer Science 635 Advanced Systems Programming Fall 2007 Professor Allan Cruse.
The ‘system-call’ interface We see how an application program can invoke privileged kernel services.
Exceptions and Interrupts
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
1 Homework Reading –Review previous material on “interrupts” Machine Projects –MP4 Due today –Starting on MP5 (Due at start of Class 28) Labs –Continue.
Getting Ready to Enter x86 Protected Mode Survival tactics for enabling Protected-Mode with a minimum of supporting infrastructure.
Interrupts What is an interrupt? What does an interrupt do to the “flow of control” Interrupts used to overlap computation & I/O – Examples would be console.
Page-Faults in Linux How can we study the handling of page-fault exceptions?
Exceptions and Interrupts How does Linux handle service- requests from the cpu and from the peripheral devices?
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
Message Signaled Interrupts
Deferred segment-loading An exercise on implementing the concept of ‘load-on-demand’ for the program-segments in an ELF executable file.
Venturing into protected-mode A first look at the CPU registers and instructions which provide the essential supporting infrastructure.
SiS 315 Graphics Engine Introduction to some capabilities of graphics accelerator hardware.
Our first 64-bit ventures How to remotely access our new Core-2 Duo platforms for some exploration and programming.
1 CE6105 Linux 作業系統 Linux Operating System 許 富 皓.
How to make a pseudo-file As a follow-up to our first lab, we examine the steps needed to create our own ‘/proc’ file.
Linux Operating System
Linux Operating System
CS 635 Advanced Systems Programming Spring 2005 Professor Allan B. Cruse University of San Francisco.
The ‘ioctl’ driver-function On implementing a way to query and modify our UART’s baudrate via the ‘device-file’ abstraction.
CS 635 Advanced Systems Programming Fall 2007 Professor Allan B. Cruse University of San Francisco.
Hardware Support for Operating Systems Sunny Gleason Vivek Uppal COM S 414
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Venturing into protected-mode
Homework / Exam Return and Review Exam #1 Reading Machine Projects
8086 emulation Using Virtual-8086 mode to execute real-mode procedures in a protected-mode environment.
Interrupts in Protected-Mode Writing a protected-mode interrupt-service routine for the timer-tick interrupt.
Copyright Arshi Khan1 System Programming Instructor Arshi Khan.
UNIT 2 Memory Management Unit and Segment Description and Paging
1 CSC 2405: Computer Systems II Spring 2012 Dr. Tom Way.
EEE527 Embedded Systems Lecture 8: Practical Interrupts Ian McCrumRoom 5B18, Tel: voice mail on 6 th ring Web site:
Operating System Program 5 I/O System DMA Device Driver.
FINAL MPX DELIVERABLE Due when you schedule your interview and presentation.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview Part 2: History (continued)
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Interrupts in the guest VM A look at the steps needed to “reflect” hardware interrupts back into the ROM-BIOS for servicing.
Intro MIPS Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann – Wrote a.
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
EFLAG Register of The The only new flag bit is the AC alignment check, used to indicate that the microprocessor has accessed a word at an odd.
Processor Structure and Function Chapter8:. CPU Structure  CPU must:  Fetch instructions –Read instruction from memory  Interpret instructions –Instruction.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
7. IRQ and PIC ENGI 3655 Lab Sessions. Richard Khoury2 Textbook Readings  Interrupts ◦ Section
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
What is a Process ? A program in execution.
What You Need to Know for Project One Joey Echeverria Friday, August 29, Fall 2003.
Lecture 5 Rootkits Hoglund/Butler (Chapters 1-3).
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
Transmitter Interrupts Review of Receiver Interrupts How to Handle Transmitter Interrupts? Critical Regions Text: Tanenbaum
Interrupts and Exceptions 國立中正大學 資訊工程研究所 羅習五 老師. Interrupt & Exceptions Interrupts – maskable & nonmaskable interrupt Exceptions – Processor-detected.
CIT 140: Introduction to ITSlide #1 CSC 140: Introduction to IT Operating Systems.
Homework Reading Machine Projects
Homework / Exam Return and Review Exam #1 Reading Machine Projects
Homework Reading Machine Projects Labs
Interrupts and exceptions
EmuOS Phase 3 Design Brendon Drew Will Mosley Anna Clayton
Interrupts and signals
Microprocessor and Assembly Language
Anton Burtsev February, 2017
Homework Reading Labs S&S Extracts ,
Homework Reading Machine Projects Labs
Interrupt Driven I/O References Text: Tanenbaum ch.1.4.3, ch Receiver Interrupt Program Example:
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

Timeout for some demos An instructive look at how the Linux Operating System sets up system data-structures

Simplified Block Diagram Central Processing Unit Main Memory I/O device I/O device I/O device I/O device system bus

CPU’s ‘fetch-execute’ cycle Fetch instruction at CS:EIP Advance EIP to next instruction Decode the fetched instruction Execute the decoded instruction IRQ? no Save context Get INTR ID Lookup ISR Execute ISR yes IRET

System registers and tables IDTR Interrupt Descriptor Table GDTR Global Descriptor Table CR3 (4-level) page-mapping tables page frame CR0 CR2 CR4 EFER

‘activity.s’ This is a ‘boot-time’ application program You assemble, link, install, and reboot It runs entirely in x86 ‘real-mode’ It maintains an array of counters It ‘hooks’ all of the 256 interrupt-vectors Every interrupt-occurrence gets counted The counters are continuously displayed

‘activity.cpp’ This is a Linux application program It’s similar to our previous demo ‘activity.s’ It shows us all the interrupts which occur But it runs in ‘protected-mode’ at ring3 So it can’t modify the IDT directly Instead it uses the services of an LKM The LKM source-file is called ‘activity.c’

‘mmake.cpp’ This program makes it easy to compile an LKM for version 2.6 of the Linux kernel If your LKM is named ‘myLKM.c’, then you compile it using: $ mmake myLKM The result is a kernel object (‘myLKM.ko’) You install the kernel object with ‘insmod’, and you remove it with ‘rmmod’, like this: $ /sbin/insmod myLKM.ko $ /sbin/rmmod myLKM.ko

Overview of the LKM activity standard runtime libraries user-space (ring3) kernel-space (ring0) Linux kernel activity.ko call ret int $0x80 iret call ret access barrier clientserver

Device-driver LKM Our ‘dram.c’ module provides services Lets applications ‘read’ physical memory Lets applications find the memory’s size Works with 32-bit Linux or 64-bit Linux SysAdmin must setup device-file node

‘showgdt.cpp’ This application shows the Linux GDT It uses services of the ‘dram.ko’ driver You can try it in Kudlick classroom You can try it on your ‘anchor’ machine

‘showidt.cpp’ This application shows the Linux IDT It uses services of the ‘dram.ko’ driver You can try running it on ‘anchor’ machine You will see all 256 IDT gate-descriptors! (But it’s designed only for 64-bit Linux)

pseudocode We wrote an algorithm-description (using pseudocode) for UART’s THRE interrupt when you want to implement ‘redirection’ of console output to a remote terminal via the serial null-modem cable We implemented our algorithm in a demo program (named ‘redirect.s’) which runs in 32-bit protected-mode

Two Interrupt-Controllers x86 CPU Master PIC (8259) Slave PIC (8259) INTR Programmable Interval-TimerKeyboard controller Serial-UART controller

A ‘rapid prototype’ tool We wrote a ‘newapp64.cpp’ It creates six pages of ‘boilerplate’ code for a boot-time assembly language application that will execute 64-bit code It includes ‘isrGPF’ (for debugging aid) We can use it to quickly create future demo programs that explore EM64T

In-class exercise Use the ‘newapp64’ tool to create a ‘test’ program that you will install and execute on an ‘anchor’ machine – but first insert into the 64-bit portion of the code some type of invalid instruction which will trigger a General Protection Exception – so you can see what debugging information gets displayed by the ‘isrGPF’ fault-handler