home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / nsprpub / pr / src / md / unix / os_ReliantUNIX.s < prev    next >
Encoding:
Text File  |  1998-04-08  |  3.1 KB  |  109 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /*
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  * 
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  * 
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* We want position independent code */
  19. #define PIC
  20.  
  21. #include <sys/asm.h>
  22. #include <sys/regdef.h>
  23. #include <sys/syscall.h>
  24.  
  25.     .file 1 "os_ReliantUNIX.s"
  26.     .option pic2
  27.     .text
  28.  
  29.     .align    2
  30.     .globl    getcxt
  31.     .ent    getcxt
  32. getcxt:
  33.     .frame    sp,0,$31        # vars= 0, regs= 0/0, args= 0, extra= 0
  34.     # saved integer regs
  35.     sw    ra,180(a0)    # gpregs[CXT_EPC]
  36.     sw    gp,152(a0)    # gpregs[CXT_GP]
  37.     sw    sp,156(a0)    # gpregs[CXT_SP]
  38.     sw    s8,160(a0)    # gpregs[CXT_S8]
  39.     sw    s0,104(a0)    # gpregs[CXT_S0]
  40.     sw    s1,108(a0)    # gpregs[CXT_S1]
  41.     sw    s2,112(a0)    # gpregs[CXT_S2]
  42.     sw    s3,116(a0)    # gpregs[CXT_S3]
  43.     sw    s4,120(a0)    # gpregs[CXT_S4]
  44.     sw    s5,124(a0)    # gpregs[CXT_S5]
  45.     sw    s6,128(a0)    # gpregs[CXT_S6]
  46.     sw    s7,132(a0)    # gpregs[CXT_S7]
  47.     # csr
  48.     cfc1    v0,$31
  49.     # saved float regs
  50.     s.d    $f20,264(a0)    # fpregs.fp_r.fp_dregs[10]
  51.     s.d    $f22,272(a0)    # fpregs.fp_r.fp_dregs[11]
  52.     s.d    $f24,280(a0)    # fpregs.fp_r.fp_dregs[12]
  53.     s.d    $f26,288(a0)    # fpregs.fp_r.fp_dregs[13]
  54.     s.d    $f28,296(a0)    # fpregs.fp_r.fp_dregs[14]
  55.     s.d    $f30,304(a0)    # fpregs.fp_r.fp_dregs[15]
  56.     sw    v0,312(a0)    # fpregs.fp_csr
  57.  
  58.     # give no illusions about the contents
  59.     li    v0,0x0c        # UC_CPU | UC_MAU
  60.     sw    v0,0(a0)    # uc_flags
  61.  
  62.     move    v0,zero
  63.     j    ra
  64.     .end    getcxt
  65.  
  66.     .align    2
  67.     .globl    setcxt
  68.     .ent    setcxt
  69. setcxt:
  70.     .frame    sp,0,$31        # vars= 0, regs= 0/0, args= 0, extra= 0
  71.     lw    v0,312(a0)    # fpregs.fp_csr
  72.     li    v1,0xfffc0fff    # mask out exception cause bits
  73.     and    v0,v0,v1
  74.     # saved integer regs
  75.     lw    t9,180(a0)    # gpregs[CXT_EPC]
  76.     lw    ra,180(a0)    # gpregs[CXT_EPC]
  77.     lw    gp,152(a0)    # gpregs[CXT_GP]
  78.     lw    sp,156(a0)    # gpregs[CXT_SP]
  79.     ctc1    v0,$31        # fp_csr
  80.     lw    s8,160(a0)    # gpregs[CXT_S8]
  81.     lw    s0,104(a0)    # gpregs[CXT_S0]
  82.     lw    s1,108(a0)    # gpregs[CXT_S1]
  83.     lw    s2,112(a0)    # gpregs[CXT_S2]
  84.     lw    s3,116(a0)    # gpregs[CXT_S3]
  85.     lw    s4,120(a0)    # gpregs[CXT_S4]
  86.     lw    s5,124(a0)    # gpregs[CXT_S5]
  87.     lw    s6,128(a0)    # gpregs[CXT_S6]
  88.     lw    s7,132(a0)    # gpregs[CXT_S7]
  89.     # saved float regs
  90.     l.d    $f20,264(a0)    # fpregs.fp_r.fp_dregs[10]
  91.     l.d    $f22,272(a0)    # fpregs.fp_r.fp_dregs[11]
  92.     l.d    $f24,280(a0)    # fpregs.fp_r.fp_dregs[12]
  93.     l.d    $f26,288(a0)    # fpregs.fp_r.fp_dregs[13]
  94.     l.d    $f28,296(a0)    # fpregs.fp_r.fp_dregs[14]
  95.     l.d    $f30,304(a0)    # fpregs.fp_r.fp_dregs[15]
  96.  
  97.     # load these, too
  98.     # they were not saved, but maybe the user modified them...
  99.     lw    v0,48(a0)
  100.     lw    v1,52(a0)
  101.     lw    a1,60(a0)
  102.     lw    a2,64(a0)
  103.     lw    a3,68(a0)
  104.     lw    a0,56(a0)    # there is no way back
  105.  
  106.     j    ra
  107.  
  108.     .end    setcxt
  109.