4 ****************************************************************************
5 * Copyright IBM Corporation 1988, 1989 - All Rights Reserved *
7 * Permission to use, copy, modify, and distribute this software and its *
8 * documentation for any purpose and without fee is hereby granted, *
9 * provided that the above copyright notice appear in all copies and *
10 * that both that copyright notice and this permission notice appear in *
11 * supporting documentation, and that the name of IBM not be used in *
12 * advertising or publicity pertaining to distribution of the software *
13 * without specific, written prior permission. *
15 * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL *
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL IBM *
17 * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY *
18 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER *
19 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *
20 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
21 ****************************************************************************
29 #ifdef AFS_BSD_PIC_ENV
30 /* this code is PIC */
34 ; savecontext(f, area1, newsp)
36 ; struct savearea *area1;
42 ; Callinfo sets up register saves using the ENTRY_GR
43 ; and ENTRY_FR parameters. ENTRY_FR=21 is only valid
44 ; for PA 1.1. (How to deal with this for 800?)
46 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
48 STW %r2, -20(%sr0,%r30)
67 LDI 1,%r1 /* Store a (char) 1 in */
68 LDW T%PRE_Block(%sr0,%r19),%r31 /* global variable */
69 STW %r1,0(%sr0,%r31) /* PRE_Block. */
72 COPY %arg0,%r22 /* Copy arg0 (f) to dyncall's input register */
74 COMIB,= 0,%arg2,L$0001 /* Compare arg2 (newsp) to 0. Execute the */
75 /* next instruction regardless of value. */
76 STW %r30,0(%sr0,%arg1)/* Store the stack pointer in the first */
77 /* element (0th offset) of arg1 (area1). */
78 COPY %arg2,%r30 /* Move arg2 (newsp) into the stack ptr. */
83 BL $$dyncall,%r31 /* Dynamic call using pointer in r22. */
85 COPY %r20, %r19 /* restore link table. */
88 BL exit,%r2 /* Can't get here, so abort. */
94 * struct savearea *area2;
98 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
99 /* No ENTRY is used since this is a magic routine. */
100 LDWS 0(0,%arg0),%r30 /* Load the stack pointer from area2 */
102 ldw -0x04(%r30), %r19
103 ldw -0x08(%r30), %r18
104 ldw -0x0c(%r30), %r17
105 ldw -0x10(%r30), %r16
106 ldw -0x14(%r30), %r15
107 ldw -0x18(%r30), %r14
108 ldw -0x1c(%r30), %r13
109 ldw -0x20(%r30), %r12
110 ldw -0x24(%r30), %r11
111 ldw -0x28(%r30), %r10
118 ldw,mb -0x80(%r30), %r3
119 LDW T%PRE_Block(0,%r19),%r31 /* set PRE_Block = 0; */
120 LDW -20(%sr0,%r30), %r2
126 .EXPORT savecontext,ENTRY
127 .EXPORT returnto,ENTRY
128 .IMPORT PRE_Block,DATA
129 .IMPORT $$dyncall,MILLICODE
133 #else /* AFS_BSD_PIC_ENV */
134 /* non-pic'ified code */
135 .IMPORT $global$,DATA
136 .IMPORT PRE_Block,DATA
137 .IMPORT $$dyncall,MILLICODE
143 ; savecontext(f, area1, newsp)
145 ; struct savearea *area1;
148 .EXPORT savecontext,ENTRY
152 ; Callinfo sets up register saves using the ENTRY_GR
153 ; and ENTRY_FR parameters. ENTRY_FR=21 is only valid
154 ; for PA 1.1. (How to deal with this for 800?)
156 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
158 STW %r2, -20(%sr0,%r30)
166 stw %r10, -0x28(%r30)
167 stw %r11, -0x24(%r30)
168 stw %r12, -0x20(%r30)
169 stw %r13, -0x1c(%r30)
170 stw %r14, -0x18(%r30)
171 stw %r15, -0x14(%r30)
172 stw %r16, -0x10(%r30)
173 stw %r17, -0x0c(%r30)
174 stw %r18, -0x08(%r30)
175 stw %r19, -0x04(%r30)
177 LDI 1,%r31 /* Store a (char) 1 in */
178 ADDIL L%PRE_Block-$global$,%r27 /* global variable */
179 STW %r31,R%PRE_Block-$global$(0,%r1) /* PRE_Block. */
181 COPY %r26,%r22 /* Copy arg0 (f) to dyncall's input register. */
183 COMIB,= 0,%r24,L$0001 /* Compare arg2 (newsp) to 0. Execute the */
184 /* next instruction regardless of value. */
185 STWS %r30,0(0,%r25) /* Store the stack pointer in the first */
186 /* element (0th offset) of arg1 (area1). */
187 COPY %r24,%r30 /* Move arg2 (newsp) into the stack ptr. */
192 BL $$dyncall,%r31 /* Dynamic call using pointer in r22. */
196 BL abort,%r2 /* Can't get here, so abort. */
205 ; struct savearea *area2;
207 .EXPORT returnto,ENTRY
210 .CALLINFO CALLER,FRAME=0,SAVE_RP,ENTRY_GR=18,ENTRY_FR=21
212 LDWS 0(0,%r26),%r30 /* Load the stack pointer from area2 */
213 ADDIL L%PRE_Block-$global$,%r27 /* PRE_Block = 0 */
215 ldw -0x04(%r30), %r19
216 ldw -0x08(%r30), %r18
217 ldw -0x0c(%r30), %r17
218 ldw -0x10(%r30), %r16
219 ldw -0x14(%r30), %r15
220 ldw -0x18(%r30), %r14
221 ldw -0x1c(%r30), %r13
222 ldw -0x20(%r30), %r12
223 ldw -0x24(%r30), %r11
224 ldw -0x28(%r30), %r10
231 ldw,mb -0x80(%r30), %r3
232 LDW -20(%sr0,%r30), %r2
234 STW %r0,R%PRE_Block-$global$(0,%r1)
239 #endif /* AFS_BSD_PIC_ENV */
240 #endif /* AFS_BSD_ENV */