DAT2343 - idallen

Download Report

Transcript DAT2343 - idallen

DAT2343
Accessing Services
Through Interrupts
© Alan T. Pinck / Algonquin College; 2003
Operating System Services
A large part of the code which makes up an
Operating System is composed of
subroutines or functions which perform
common tasks required by most application
programs.
Having these “service” subroutines in the
OS means that application programs do not
need to recreate them for each new
application.
Hardware Interrupts as a Method of
Accessing OS Services
Hardware Interrupts and the
Instruction Processing Cycle
Copy instruction at address given by Instruction Pointer into
Instruction Register
Increment Instruction Pointer by length of instruction in Instruction
Register
Execute instruction in Instruction Register
IF a hardware interrupt has occurred
 Save value in Instruction Pointer (as if a CALL had occurred)
and the value of the Flags, then reset Instruction Pointer to
address from Interrupt Vector Table for this hardware device
Repeat from first step
Hardware Interrupts: IRQ numbers
Each device which can generate a request for a
service using a hardware interrupt must have its
own “interrupt request number” (IRQ).
The IRQ number acts as an index into the
Interrupt Vector Table to determine the address of
the Service Routine to be processed in response to
a request from the specific device.
Software Interrupts as Replacements
for Calls to OS Subroutines
The Operating System includes service functions
for application software as well as for hardware.
If a CALL instruction were use to access these
services, each service would need to always be at
the same fixed memory address (regardless of the
version of the operating system or the computer’s
configuration).
Instead, these software support services are
normally accessed, through the Interrupt Vector
Table, using an Interrupt instruction (instead of a
hardware interrupt signal).
End of Lecture