home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / misc / emu / AROSdev.lha / AROS / config / i386 / exception.s < prev    next >
Encoding:
Text File  |  1997-01-09  |  1.5 KB  |  87 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: exception.s,v 1.9 1996/12/06 03:54:39 aros Exp $
  4.  
  5.     Desc:
  6.     Lang:
  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.     /* Get SysBase amd pointer to current task */
  45.     movl    4(%esp),%ebp
  46.     movl    ThisTask(%ebp),%edi
  47.  
  48.     /* Clear exception flag */
  49.     andb    $~TF_EXCEPT,tc_Flags(%edi)
  50.  
  51.     /* If the exception is raised out of Wait IDNestCnt may be >0 */
  52.     movb    IDNestCnt(%ebp),%ebx
  53.     /* Set it to a defined value */
  54.     movb    $0,IDNestCnt(%ebp)
  55.  
  56. exloop: /* Get mask of signals causing the exception */
  57.     movl    tc_SigExcept(%edi),%ecx
  58.     andl    tc_SigRecvd(%edi),%ecx
  59.     je    excend
  60.  
  61.     /* Clear bits */
  62.     xorl    %ecx,tc_SigExcept(%edi)
  63.     xorl    %ecx,tc_SigRecvd(%edi)
  64.  
  65.     /* Raise exception. Enable Interrupts */
  66.     movl    tc_ExceptData(%edi),%eax
  67.     leal    Enable(%ebp),%edx
  68.     pushl    %ebp
  69.     call    *%edx
  70.     pushl    %ebp
  71.     pushl    %eax
  72.     pushl    %ecx
  73.     movl    tc_ExceptCode(%edi),%edx
  74.     call    *%edx
  75.     leal    Disable(%ebp),%edx
  76.     pushl    %ebp
  77.     call    *%edx
  78.     addl    $20,%esp
  79.  
  80.     /* Re-use returned bits */
  81.     orl    %eax,tc_SigExcept(%edi)
  82.     jmp    exloop
  83.  
  84. excend: /* Restore IDNestCnt and return */
  85.     movb    %ebx,IDNestCnt(%ebp)
  86.     ret
  87.