home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / internal / i386-emul / permit.s < prev    next >
Encoding:
Text File  |  1996-07-16  |  689 b   |  39 lines

  1.     IDNestCnt   =    302
  2.     AttnResched =    306
  3.     TDNestCnt   =    303
  4.     Switch      =    -30
  5.  
  6.     .text
  7.     .align    16
  8.     .globl    Exec_Permit
  9.     .type    Exec_Permit,@function
  10. Exec_Permit:
  11.     /* Preserve all registers */
  12.     pushl    %edx
  13.     pushl    %eax
  14.  
  15.     /* Get SysBase */
  16.     movl    12(%esp),%edx
  17.  
  18.     /* Decrement and test TDNestCnt */
  19.     decl    TDNestCnt(%edx)
  20.     jge    noswch
  21.  
  22.     /* Is the a delayed switch pending and are taskswitches allowed? */
  23.     cmpb    $0,AttnResched(%edx)
  24.     jge    noswch
  25.     cmpb    $0,IDNestCnt(%edx)
  26.     jge    noswch
  27.  
  28.     /* Clear delayed switch bit and do the delayed switch */
  29.     andb    $127,AttnResched(%edx)
  30.     leal    Switch(%edx),%eax
  31.     pushl    %edx
  32.     call    *%eax
  33.     addl    $4,%esp
  34.  
  35.     /* Restore registers and return */
  36. noswch:    popl    %eax
  37.     popl    %edx
  38.     ret
  39.