Real Time Systems: Notes

Review of Interrupts & Exceptions

 

Review of Interrupts & Exceptions

The use of terminology varies from vendor to vendor. Intel terminology is used here, except as noted.

There are two kinds of special control transfers, implemented by similar mechanisms: Interrupts and Exceptions.

(Motorola calls them externally or internally caused exceptions, respectively.)


What happens when an interrupt/exception occurs?

  1. Control is transferred to a handler procedure
    (previously associated with the interrupt/exception)
    This means the value of the IP (a.k.a. PC)x is changed.
  2. No state information is lost.
    This means the old value of the IP is saved.
  3. Usually, other state information may be change
    (e.g. privilege mode, interrupt masking state, stack pointer)
    The old values must also be saved.

Interrupt Vectors -- Intel 8086 Architecture


Saved State

Stack save area for 8086 (80386 real mode):

-------------------------------------------------
|    FLAGS      |       CS      |      IP       |   (register values)
-------------------------------------------------
|       |       |       |       |       |       |   (byte addresses)
   SP+5    SP+4    SP+3    SP+2    SP+1    SP

Mask


Fan-In

Interrupts may come from several sources, which fan in through controllers.

             --------------
   source--->|            |
             | controller |-----|
   source--->|            |     |     INTR    -------
      :      --------------     |-------+---->| CPU |
      :      --------------     |     vector  -------
   source--->| controller |-----|             ^
             --------------                   mask/unmask
                   ^
                   disable/enable

The controller can preserve some info. about source
via the vector value.


Interrupt Handlers


Preventing Interrupts

Can be done at several levels:


See also separate notes on how to mask individual interrupts at the controller level for the I386 architecture in the context of the Linux kernel.

© 1998, 2003 T. P. Baker. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means without written permission.
$Id: interrupts.html,v 1.1 2003/10/17 12:34:01 baker Exp baker $