Exceptio NS: Is Often Used To Refer To Any Event That Causes An Interruption

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 18

EXCEPTIO

NS
Is often used to refer to
any event that causes an
interruption
Kinds of Exceptions
Recovery from Errors

 Exception-Service Routine
-takes appropriate action
to recover from the error or to
inform the user about it.
Debugging
 Debugger
-helps the programmer find errors
in a program.

2 important facilities of debugger:


 Trace Mode
 Breakpoints
• Trace Mode
-an exception occurs after execution of
every instruction.
• Breakpoints
-the program being debugged is interrupted
only at specific points selected by the user.
Privilege Exception

 Privileged Instruction
-modifies the priority of the
processor.
Operating System

Responsible for coordinating all activities within a


computer.

Makes extensive use of I/O operations.

Incorporates the interrupt-service routines for all


devices connected to a computer.

Provides a variety of services to application


programs.
The OS includes:

• Multitasking – a mode of operation


in which a processor executes several
user programs at the same time.

• Time slicing – with this technique,


each program runs for a short period
called a time slice.

• OSINIT – set interrupt vectors.


• SCHEDULER – an OS routine whose
function is to determine which user
program should run in the next time slice.
It saves all the information that will be
needed later when the execution of a
program is resumed.
• Program State – the information saved
by the SCHEDULER. It includes register
contents, the program counter, and the
processor status word.
• Processor Status Word – it contains
the condition flags and other information
such as priority level.
• PROCESS
Running – the program is currently
being executed.
Runnable – the program is ready
for execution but is waiting to be
selected by the SCHEDULER.
Blocked – the program is not ready
to resume execution for some reason.

• OSSERVICES – examine stack to


determine requested operation.
• IOINIT – a routine that is responsible
for starting I/O operations.

• Device Driver - is a computer


program allowing higher-level computer
programs to interact with a hardware
device.

• IODATA – poll devices to determine


source of interrupt.

• END – a flag that is set to 1 if the


character is a carriage return.
Use of Interrupts in OS
 Enables the operating system to assign
priorities, switch from one user program
to another, implement security and
protection features, and coordinate I/O
activities.

 Can be used to call different parts of the


OS, depending on the service being
requested.
Processor Examples
ARM Interrupt Structure

 ARM Processor
- Advanced RISC (Reduced Instruction
Set Computer) Machines has a simple yet
powerful exception-handling mechanism.
• 5 Sources of Exceptions
External interrupt-request lines
(IRQ).

Fast Interrupt Request (FIQ).

Software Interrupt Instruction


(SWI).

External Abort following a bus


error.

Attempt to execute an undefined


instruction.
• Exceptions are handled
according to the following
priority structure:

3. Reset
4. Data Abort
5. FIQ
6. IRQ
7. Prefetch Abort
8. Undefined Structure
• When the processor accepts an
interrupt, it takes the following
actions:
2. It saves the return address of the
interrupted program in register14 of the
corresponding mode.
3. It saves the contents of the current
processor status register (CPSR) in the
corresponding SPSR (Saved Processor
Status Register).
4. It changes the mode bits in CPSR
according to the type of interrupt.
5. It branches to the interrupt-service
routine starting at the appropriate vector
address.
*The ARM Processor uses a pipelined structure.

Pipelined Structure
- an instruction is fetched before the
execution of the preceding instruction is
completed.
• ARM Processor
Stacks and Nesting

• ARM Interrupt Mechanism


- stores the return address in a
register and does not automatically
implements a stacking mechanism to
allow subroutine or interrupt nesting.

You might also like