The onintr Library Function

NAME

onintr - connect exception handler

SYNOPSIS

onintr (EXCCODE,handler)

DESCRIPTION

onintr connects an assembly language execption handler to a selected EXCCODE in the CAUSE register, refer the LR33000 for a list of EXCCODE values. This function is only available for programs running under PMON.

When control is passed to the handler, the first element of the array, whose address was passed during the onintr() call, will contain a pointer to another similar array. Therefore, if the handler decides that it doesn't want to handle this exception after all, it can pass control to the next exception handler in the list.

EXAMPLE

  typedef int iFunc();
  int hwint();
  iFunc *dat1[] = {0,hwint};

  main()
  {
  onintr(0,dat1);
  ....
  }

       .globl hwint
       .ent hwint
       .set noat
       .set noreorder
  hwint:
       # ignore non INT0 exceptions
       mfc0 k0,C0_CAUSE
       nop
       .set reorder
       sll  k0,21          # move INT0 to MSB
       bltz k0,1f          # branch if MSB set

       # if not, return to PMON
       la   k0,dat1
       lw   k0,(k0)
       lw   k0,4(k0)
       j    k0   # return to PMON

1:        .....
       User's handler
       .....

       # return to interrupted program
       .set noreorder
       mfc0 k0,C0_EPC
       nop
       j    k0
       rfe
       .set reorder
       .set at
       .end hwint
For a complete example, see onintr.c and tisr.s.


Navigation: Document Home | Document Contents | Document Index