home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / config / unix / sgi_irix / rswitch.s < prev    next >
Text File  |  2000-07-29  |  2KB  |  77 lines

  1.     .data    
  2.     .align    0
  3. $$8:
  4.     .ascii    "new_context() returned in coswitch\X00"
  5.     .text    
  6.     .align    2
  7.     .globl    coswitch
  8.  #        coswitch(old_cs,new_cs,first)
  9.  #        int *old_cs,*new_cs;
  10.  #        int first;
  11.  #    {
  12.     .ent    coswitch
  13. coswitch:
  14.  #    standard entry code, including decrement of sp
  15.     subu    $sp, 32
  16.     sw    $31, 20($sp)
  17.     .mask    0x80000000, -4
  18.     .frame    $sp, 32, $31
  19.  #        save (decremented) sp and other registers in old_cs
  20.     sw    $sp,  0($4)
  21.     sw    $31,  4($4)
  22.     sd    $16,  8($4)
  23.     sd    $18, 16($4)
  24.     sd    $20, 24($4)
  25.     sd    $22, 32($4)
  26.     s.d    $f20,40($4)
  27.     s.d    $f22,48($4)
  28.     s.d    $f24,56($4)
  29.     s.d    $f26,64($4)
  30.     s.d    $f28,72($4)
  31.     s.d    $f30,80($4)
  32.     sw    $gp,88($4)
  33.     sw    $fp,96($4)
  34.  #        if first = 0, this is first activation
  35.     bne    $6, 0, $33
  36.  #        load sp from new_cs[0] (ignore other registers)
  37.     lw    $sp, 0($5)
  38.  #    Decrement sp by the size of the stackframe.  
  39.  #    Store decremented sp in new_cs.  Then call new_context().
  40.         subu    $sp, 32
  41.         sw      $sp,  0($5)
  42.  #        new_context(0,0);
  43.     move    $4, $0
  44.     move    $5, $0
  45.     jal    new_context
  46.  #        syserr("new_context() returned in coswitch");
  47.     la    $4, $$8
  48.     jal    syserr
  49.  #    if we're in control now, something is really wrong, so go into
  50.  #    a tight loop until someone notices...
  51. $32:
  52.     b    $32
  53. $33:
  54.  #    here for not first activation
  55.  #        load sp and other registers from new_cs
  56.     lw    $sp,  0($5)
  57.     lw    $31,  4($5)
  58.  #    (could compare $31 with 20($sp) as a consistency check now)
  59.     ld    $16,  8($5)
  60.     ld    $18, 16($5)
  61.     ld    $20, 24($5)
  62.     ld    $22, 32($5)
  63.     l.d    $f20,40($5)
  64.     l.d    $f22,48($5)
  65.     l.d    $f24,56($5)
  66.     l.d    $f26,64($5)
  67.     l.d    $f28,72($5)
  68.     l.d    $f30,80($5)
  69.     lw    $gp,88($5)
  70.     lw    $fp,96($5)
  71.  #    increment sp as for normal return
  72.     addu    $sp, 32
  73.  #    return
  74.     j    $31
  75.  #    }
  76.     .end    coswitch
  77.