Interrupt Mechanisms in the 74xx PowerPC Architecture Porting Plan 9 to the PowerPC Architecture Ajay Surie Adam Wolbach.

Slides:



Advertisements
Similar presentations
Computer-System Structures Er.Harsimran Singh
Advertisements

CPU Structure and Function
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Memory Protection: Kernel and User Address Spaces  Background  Address binding  How memory protection is achieved.
Interrupts Chapter 8 – pp Chapter 10 – pp Appendix A – pp 537 &
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Architectural Support for OS March 29, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Exception Processing ECE511: Digital System & Microprocessor.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
OS Spring’03 Introduction Operating Systems Spring 2003.
Abhinav Kamra Computer Science, Columbia University 2.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 2: Computer-System Structures.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Computer System Structures memory memory controller disk controller disk controller printer controller printer controller tape-drive controller tape-drive.
Process Description and Control A process is sometimes called a task, it is a program in execution.
COMPUTER SYSTEMS An Integrated Approach to Architecture and Operating Systems Chapter 4 Processor Implementation ©Copyright 2008 Umakishore Ramachandran.
Chapter 2 The OS, the Computer, and User Programs Copyright © 2008.
General System Architecture and I/O.  I/O devices and the CPU can execute concurrently.  Each device controller is in charge of a particular device.
Introduction to Embedded Systems
COMP201 Computer Systems Exceptions and Interrupts.
Protection and the Kernel: Mode, Space, and Context.
80386DX.
CHAPTER 2: COMPUTER-SYSTEM STRUCTURES Computer system operation Computer system operation I/O structure I/O structure Storage structure Storage structure.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 2: Computer-System Structures Computer System Operation I/O Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Chapter 2: Computer-System Structures
1 CSE Department MAITSandeep Tayal Computer-System Structures Computer System Operation I/O Structure Storage Structure Storage Hierarchy Hardware Protection.
2: Computer-System Structures
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Chapter 2: Computer-System Structures 2.1 Computer System Operation 2.5 Hardware Protection 2.6 Network Structure.
1 CS/COE0447 Computer Organization & Assembly Language Chapter 5 part 4 Exceptions.
The Functions of Operating Systems Interrupts. Learning Objectives Explain how interrupts are used to obtain processor time. Explain how processing of.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Interrupt driven I/O. MIPS RISC Exception Mechanism The processor operates in The processor operates in user mode user mode kernel mode kernel mode Access.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Operating Systems 1 K. Salah Module 1.2: Fundamental Concepts Interrupts System Calls.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 2 Computer-System Structures Slide 1 Chapter 2 Computer-System Structures.
Silberschatz, Galvin and Gagne  Applied Operating System Concepts Chapter 2: Computer-System Structures Computer System Architecture and Operation.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Interrupt driven I/O Computer Organization and Assembly Language: Module 12.
Chapter 2: Computer-System Structures(Hardware) or Architecture or Organization Computer System Operation I/O Structure Storage Structure Storage Hierarchy.
Introduction to Operating Systems
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Chapter 2: Computer-System Structures(Hardware)
Interrupts and exceptions
Chapter 2: Computer-System Structures
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Microprocessor Systems Design I
Anton Burtsev February, 2017
Protection of System Resources
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 2: Computer-System Structures Computer System Operation I/O Structure Storage.
Computer-System Architecture
Module 2: Computer-System Structures
Architectural Support for OS
CSE 451: Operating Systems Autumn 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 596 Allen Center 1.
Module 2: Computer-System Structures
CSE 451: Operating Systems Autumn 2001 Lecture 2 Architectural Support for Operating Systems Brian Bershad 310 Sieg Hall 1.
Interrupt handling Explain how interrupts are used to obtain processor time and how processing of interrupted jobs may later be resumed, (typical.
CSE 451: Operating Systems Winter 2003 Lecture 2 Architectural Support for Operating Systems Hank Levy 412 Sieg Hall 1.
Architectural Support for OS
Chapter 2: Computer-System Structures
Chapter 2: Computer-System Structures
Module 2: Computer-System Structures
Module 2: Computer-System Structures
Interrupts and Exception Handling
Presentation transcript:

Interrupt Mechanisms in the 74xx PowerPC Architecture Porting Plan 9 to the PowerPC Architecture Ajay Surie Adam Wolbach

2 Definitions MSR FOO FOO bit of MSR SRRxSave/Restore Register X [y, z)Memory, spanning y to z (not including z)

3 Interrupt Classes Four Classes of System-Caused Interrupts  System Reset, Machine Check Not maskable  External, Decrementer (Timer) Maskable, taken if MSR EE bit is set to 1 Two Classes of Instruction-Caused Interrupts  Precise: System calls, most exceptions  Imprecise: Floating-Point Enabled Exception No guarantees with knowing which instruction actually caused the exception

4 Interrupt Vectors A vector is a region in main memory containing the initial sequence of instructions to be executed upon taking an interrupt  Vector location unique to each type of interrupt  256 bytes / 64 instructions allotted per vector Enough to do some register manipulation and call an operating system’s handler function Not a concrete rule  [0x0, 0x3000) used for vectors in main memory [0x0, 0x1000) used for architecture-defined interrupts [0x1000, 0x3000) are implementation-specific

5 Outline of Interrupt Processing An interrupt can only occur when it has a higher priority level than any currently occurring interrupt SRR0 loaded with instruction address depending on the type of interrupt  Generally, tries to identify culprit, or next to execute Important bits of MSR (0, 5:9, 16:31) saved in SRR1  Bits 1:4 and 10:15 contain interrupt-specific information MSR IR, DR,PR set to 0  Virtualization off, kernel mode MSR RI set if interrupt is “recoverable”

6 Interrupt “Ordering” and Program State System Reset and Machine Check interrupts are not “ordered”  Can occur at any time  Program state may be lost All other interrupts are “ordered”  Only one interrupt is reported at same time  When it is processed, no program state is lost Save/Restore Register 0 and 1 (SRR0/1)  Used in the saving of context

7 Important Bits in the MSR IP[25]: Interrupt Prefix  Controls the prefix of where interrupt vectors are stored in real memory (0xfffff000 if set, 0x0 if not) RI[30]: Recoverable Interrupt  If this is set on an interrupt, state can be salvaged  Hardware determines if state is salvageable

8 Plan 9 Interrupt Handling Overview All exception vectors contain an instruction sequence that calls trapvec(SB) to handle state saves / mode changes On an interrupt, virtualization is disabled The kernel determines whether a stack switch is necessary  This can be accomplished by determining the mode in which the interrupt occurred, stored in SRR1 After registers are saved, virtualization is renabled and the kernel determines the appropriate handler to run

9 Plan 9 Vector contains instruction sequence to an assembly routine that handles the interrupt If the interrupt was in user mode, find the wrapper routine

10 System Reset Interrupt Vector location: 0x100 (RA), 256 bytes Can be hardware or software generated SRR0 set to EA of instruction that would have executed next without this interrupt SRR1’s interrupt info set to 0, MSR copied “Implementations can provide a means for software to distinguish between power-on Reset and other types of System Reset” Can be recovered from if MSR RI = 1

11 Machine Check Exception Vector location: 0x200 (RA), 256 bytes Enabled if MSR ME = 1 when exception hit  If MSR ME = 0, machine enters Checkstop state Caused by hardware dying, temperature problem, or possibly by referencing a nonexistent RA  I think; implementation definitely processor-specific though SRR0 set on “best effort” basis to the instruction executing when the exception hit SRR1 set to processor-specific value If storage registers are valid, MSR RI set to 1 and resumption of execution can occur

12 External Interrupts Vector location: 0x500 (RA), 256 bytes Generic for all external hardware interrupts: keyboard, mouse, etc, but not timer Occurs when MSR EE = 1 and an external interrupt exception is presented to CPU SRR0 contains next instruction to execute, as if no interrupt had occurred SRR1 set as outlined

13 Decrementer (Timer) Interrupt Vector location: 0x900 (RA), 256 bytes Decrementer is a 32-bit register that acts as a countdown timer, causing an interrupt after passing through zero  Frequency is processor-specific  Interesting: Speculative execution can possibly read decrementer in advance of actual execution, getting old value; fixed with an isync before decrementer reads Occurs when MSR EE = 1 and a decrementer exception is presented to CPU SRR0 contains next instruction to execute, as if no interrupt had occurred

14 Plan 9 Clock / Timer Decrementer used to maintain ticks since boot The timer is board specific and is handled as an external interrupt  Causes a context switch every 10 ms

15 System Calls Vector location: 0xC00 (RA), 256 bytes Occurs when system call instruction executes  Determining which system call is to be executed is something that is handled by the operating system In Plan 9, R3 contains the number of the system call intended for execution SRR0 set to address of instruction after SC SRR1’s interrupt info set to 0, MSR copied

16 Plan 9 System Calls System calls are all mostly machine independent (except fork, exec, etc.) A generic system call handler validates user stack state, etc. R3 contains the number of the system call to be executed After the system call executes, the kernel places the return value in R3, and restores the user mode state

17 Instruction Storage Interrupt Vector location: 0x400 (RA), 256 bytes Occurs on an instruction fetch when an EA cannot be translated, EA is in a direct-store segment, or a violation of storage protection SRR0 holds faulting instruction’s EA SRR1 1 set if it was a hashed translation miss SRR1 3 set if it was a direct-store segment SRR1 4 set if storage access not permitted SRR1 10 set if segment table failed to find a translation

18 Data Storage Interrupt Vector location: 0x300 (RA), 256 bytes Occurs on direct-store errors with external devices, EA translation failures on data loads or stores, or a violation of storage protection SRR0 set to faulting instruction’s EA Data Storage Interrupt Status Register holds information specific to DSI type Data Address Register set to the EA of the data access that failed

19 Less Interesting Interrupts Alignment Interrupts  Load/Store not aligned to size of data type Program  Illegal Instruction, Not privileged Trace  If enabled, occurs after every non-rfi instruction Several Floating-Point Exceptions  Divide-by-zero, etc.

20 Returning From Interruption (IRET) To return to normal execution, the following needs to occur  MSR RI set to 0  SRR0/1 possibly set to values to be used by rfi  Execute rfi instruction SRR1 copied into MSR SRR0 copied into Next Instruction Address Register  Normal execution resumes

21 Precise/Imprecise Interrupts Upon taking a precise interrupt:  SRR0 points to instruction causing the exception or some instruction a known distance after it, depending on the interrupt’s type Guaranteed that all previous instructions have completed, and no subsequent instructions have begun processing on this processor Upon taking an imprecise interrupt:  SRR0 points to some unknown instruction, either at or after the instruction causing the interrupt All instruction interrupts are precise, except for floating-point enabled exceptions

22 Bibliography The book