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