back
  Interrupts - jump to system code and return.

    Interrupts are calls to code independent of the application.
      Depending on type, they may run in user or supervisor state.

    Interrupts preserve current state allowing for resumption on completion.
 
    Interrupts will generally push the program counter (and stack or bank
      register) and the condition code register onto the stack.

    Various CPUs may preserve other selected work registers using different techniques.
      ARM uses duplicates of some of its registers for different call modes.
 
    Often called routine is tasked with preserving the state of other work registers in the cpu.
      Although, a specific interrupt may be expected to return information in known registers.

    Two general catagories :

      Software - common sytem routines called triggered by software.
        Handle conditions that may or may not be problem (within CPU).
          Divide by zero, overflow, etc.

        Different routines to do common tasks, 
          such as requesting disk access or initializing a keyboard read.

        Software interrups are triggered by a code condition or an actual
          invoking of interrupt code.

          See : Intel BIOS Interrupt calls 
  
      Hardware - change in state of an external circuit or device.
        Memory error, I/O request processed, etc.
        Hard drive response to a disk access request.
        Asynchronous in nature. unpredicatable.

        Hardware interrupts initially handled by separate logic circuits.

      * Processor - generated in systems where some form of co-processor exists.
        
    Interrupt priority.
      
      Interrupts often assigned priorities.

      IRQ vs. NMI - maskable interrupt vs non-maskable interrupt.

        Non-maskable are of a higher priority, such as a memory fault,
          that cannot be ignored.   

        Maskable interrupts are interrupts that can be delayed or even
          ignored. Common for an executing interrupt to mask (delay) other
          interrupts until done.
 
        Within a known set if maskable interrupts, heiarchical priority
          often assigned.

          For example, a hard drive returning a sector read has higher authority
            that a keyboard returing a keystroke.

    Example of software/hardware combo.  (Intel)


      Perform integer math.

      If treating as signed math
        Call INTO instruction. - if overflow occurred, this will call int 04h 

      int 04h (hardware interrupt because it checks the cc flag of cpu). 
        This routine's job is to preserve the cc register on stack and clear
        the overflow and trap flags. 

Lectures