home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / config / m68k-emul / exception.s < prev    next >
Encoding:
Text File  |  1996-12-11  |  1.6 KB  |  86 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: exception.s,v 1.4 1996/12/11 09:58:37 aros Exp $
  4.  
  5.     Desc: Exec function Exception
  6.     Lang: english
  7. */
  8.  
  9. /******************************************************************************
  10.  
  11.     NAME
  12.         AROS_LH0(void, Exception,
  13.  
  14.     LOCATION
  15.         struct ExecBase *, SysBase, 11, Exec)
  16.  
  17.     FUNCTION
  18.  
  19.     INPUTS
  20.  
  21.     RESULT
  22.  
  23.     NOTES
  24.  
  25.     EXAMPLE
  26.  
  27.     BUGS
  28.  
  29.     SEE ALSO
  30.  
  31.     INTERNALS
  32.  
  33.     HISTORY
  34.  
  35. ******************************************************************************/
  36.  
  37.         #include "machine.i"
  38.  
  39.         .text
  40.         .balign 16
  41.         .globl  AROS_SLIB_ENTRY(Exception,Exec)
  42.         .type   AROS_SLIB_ENTRY(Exception,Exec),@function
  43. AROS_SLIB_ENTRY(Exception,Exec):
  44.     movem.l    %a2/%a6/%d2,-(%sp)
  45.     /* First clear task exception bit. */
  46.     move.l    16(%sp),%a6
  47.     move.l    ThisTask(%a6),%a2
  48.     bclr    #TB_EXCEPT,tc_Flags(%a2)
  49.  
  50.     /* If the exception is raised out of Wait IDNestCnt may be >0 */
  51.     move.b    IDNestCnt(%a6),%d2
  52.     /* Set it to a defined value */
  53.     clr.b    IDNestCnt(%a6)
  54.  
  55. exloop:    /* Get mask of signals causing the exception */
  56.     move.l    tc_SigExcept(%a2),%d0
  57.     and.l    tc_SigRecvd(%a2),%d0
  58.     beq    excend
  59.  
  60.     /* Clear bits */
  61.     eor.l    %d0,tc_SigExcept(%a2)
  62.     eor.l    %d0,tc_SigRecvd(%a2)
  63.  
  64.     /* Raise exception. Enable Interrupts */
  65.     move.l    tc_ExceptData(%a2),%a1
  66.     move.l    %a6,-(%sp)
  67.     jsr    Enable(%a6)
  68.     move.l    %a6,-(%sp)
  69.     move.l    %a1,-(%sp)
  70.     move.l    %d0,-(%sp)
  71.     move.l    tc_ExceptCode(%a2),%a1
  72.     jsr    (%a1)
  73.     move.l    %a6,-(%sp)
  74.     jsr    Disable(%a6)
  75.     add.w    #20,%sp
  76.  
  77.     /* Re-use returned bits */
  78.     or.l    %d0,tc_SigExcept(%a2)
  79.     bra    exloop
  80.  
  81. excend:    /* Restore IDNestCnt and return */
  82.     move.b    %d2,IDNestCnt(%a6)
  83.     movem.l    (%sp)+,%a2/%a6/%d2
  84.     rts
  85.  
  86.