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 | Information Technology Center
30 | Carnegie-Mellon University
46 | Process assembly language assist for Sailboats.
61 | Stuff to allow saving/restoring registers
66 | savecontext(f, area1, newsp)
67 | int (*f)(); struct savearea *area1; char *newsp;
72 ai sp,sp,-regspace | Save frame pointer & ...
73 | ... allocate space for 16 registers
75 stm r0,0(sp) | Change this if save fewer regs.
76 | Set preemption semaphore
79 put r6,0(r7) | PRE_Block = 1
80 | r3 = base of savearea
81 put sp,topstack(r3) | area1->topstack = sp
84 be L1 | If newsp == 0, no stack switch
85 cas sp,r4,r0 | Switch to new stack
87 get r6,0(r2) | r2 = _f
93 | struct savearea *area2;
99 | Now in the context of the savecontext stack to be restored.
100 | Start with the registers...
101 | Clear preemption semaphore
104 put r6,0(r7) | PRE_Block = 0
105 lm r0,0(sp) | Change if saving fewer regs.
106 brx r15 | Return to previous process