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 ****************************************************************************
30 #if !defined(__ELF__) && !defined(sun3)
32 #else /* __ELF__ || sun3 */
38 #endif /* __ELF__ || sun3 */
42 # Information Technology Center
43 # Carnegie-Mellon University
51 # Process assembly language assist for Suns.
66 .globl _C_LABEL(PRE_Block)
67 .globl _C_LABEL(savecontext)
68 .globl _C_LABEL(returnto)
72 /* Stuff to allow saving/restoring registers */
74 regs = 0x3ffe | d1-d7 & a0-a5
77 # savecontext(f, area1, newsp)
78 # int (*f)(); struct savearea *area1; char *newsp;
81 /* Stack offsets of arguments */
87 movl #1,_C_LABEL(PRE_Block) | Dont allow any interrupt finagling
88 link reg(a6),#-(nregs*4) | Save frame pointer & ...
89 | ... allocate space for nregs registers
93 movl reg(a6)@(area1),reg(a0) | a0 = base of savearea
94 movl reg(sp),reg(a0)@(topstack) | area->topstack = sp
95 movl reg(a6)@(newsp),reg(d0) | Get new sp
96 jeq forw1 | If newsp == 0, no stack switch
97 movl reg(d0),reg(sp) | Switch to new stack
99 movl reg(a6)@(f),reg(a0) | a0 = f
102 /* It is impossible to be here, so abort() */
108 # struct savearea *area2;
111 /* Stack offset of argument */
116 movl reg(a6)@(area2),reg(a0) | Base of savearea
117 movl reg(a0)@(topstack),reg(sp) | Restore sp
118 /* Restore registers */
119 moveml reg(sp)@,#regs
121 addl #(nregs*4),reg(sp)
122 movl reg(sp),reg(a6) | Argghh...be careful here
124 clrl _C_LABEL(PRE_Block)
125 rts | Return to previous process