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 / freebsd / alpha.s next >
Text File  |  2002-01-28  |  1KB  |  47 lines

  1. /*
  2.  *  coswitch(old_cs, new_cs, first) for Dec Alpha architecture
  3.  *             $16     $17    $18
  4.  */
  5.     .data
  6. errmsg:    .ascii    "new_context() returned in coswitch\X00"
  7.  
  8.     .text
  9.     .globl    coswitch
  10.     .ent    coswitch
  11. coswitch:
  12.     lda    $sp, -72($sp)        /* make room on stack */
  13.     stq    $sp, 0($16)        /* save stack pointer */
  14.     stq    $9, 0($sp)        /* save registers on stack */
  15.     stq    $10, 8($sp)
  16.     stq    $11, 16($sp)
  17.     stq    $12, 24($sp)
  18.     stq    $13, 32($sp)
  19.     stq    $14, 40($sp)
  20.     stq    $15, 48($sp)
  21.     stq    $27, 56($sp)
  22.     stq    $26, 64($sp)        /* return address */
  23.     beq    $18, first        /* if first time */
  24.  
  25.     ldq    $sp, 0($17)        /* load new stack pointer */
  26.     ldq    $9, 0($sp)        /* load registers from stack */
  27.     ldq    $10, 8($sp)
  28.     ldq    $11, 16($sp)
  29.     ldq    $12, 24($sp)
  30.     ldq    $13, 32($sp)
  31.     ldq    $14, 40($sp)
  32.     ldq    $15, 48($sp)
  33.     ldq    $27, 56($sp)
  34.     ldq    $26, 64($sp)        /* return address */
  35.     lda    $sp, 72($sp)        /* reset sp */
  36.     jsr_coroutine    $31, ($26), 0    /* jump into new_context */
  37.  
  38. first:    
  39.     ldq    $sp, 0($17)        /* load stack pointer only */
  40.     bis    $31, $31, $16        /* r16 = 0 */
  41.     bis    $31, $31, $17        /* r17 = 0 */
  42.     jsr    $26, new_context    /* new_context(0,0) */
  43.     lda    $16, errmsg
  44.     jsr    $26, syserr        /* shouldn't get here */
  45.  
  46.     .end    coswitch
  47.