(nnpfs_block_open): better cleanup on failure
[arla.git] / lwp / process.vax.S
bloba893c0ba3ef0cf9665bccafc00856c5d9cc3db8f
1 /* $Id$ */
3 /*
4 ****************************************************************************
5 *        Copyright IBM Corporation 1988, 1989 - All Rights Reserved        *
6 *                                                                          *
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.                              *
14 *                                                                          *
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 ****************************************************************************
24 #include <config.h>
26 #undef RCSID
28 #include <lwp_elf.h>
29         
32 #       Information Technology Center
33 #       Carnegie-Mellon University
37         .data
41 #       Transcribed for Vaxen by M. Satyanarayanan, September 1985
42 #       Algorithm: "Monkey see, monkey do"
46         .text
50 # struct savearea {
51 #       char    *topstack;
52 # }
56         .set    topstack,0
58 /* Stuff to allow saving/restoring registers */
61 # savecontext(f, area1, newsp)
62 #     int (*f)(); struct savearea *area1; char *newsp;
65 /* Stack offsets of arguments */
66         .set    f,4
67         .set    area1,8
68         .set    newsp,12
70 .globl  _C_LABEL(PRE_Block)
71 .globl  _C_LABEL(savecontext)
73 ENTRY(savecontext)
74         .word 0x0ffc    # Save regs R2-R11
75         movl    $1,_C_LABEL(PRE_Block)  # Critical section for preemption code
76         pushl   %ap                     # save old ap
77         pushl   %fp                     # save old fp    
78         movl    area1(%ap),%r0          # r0 = base of savearea
79         movl    %sp,topstack(%r0)       # area->topstack = sp
80         movl    newsp(%ap),%r0          # Get new sp
81         beql    L1                      # if new sp is 0, dont change stacks
82         movl    %r0,%sp                 # else switch to new stack
83 L1:
84         movl    f(%ap),%r1              # r1 = f
85         calls   $0,0(%r1)               # f()
87 /* It is impossible to be here, so abort() */
89         calls   $0,_C_LABEL(abort)
92 # returnto(area2)
93 #     struct savearea *area2;
96 /* Stack offset of argument */
97         .set    area2,4
99         .globl _C_LABEL(returnto)
100 ENTRY(returnto)
101         .word   0x0                     # Who cares about these regs?
102         movl    area2(%ap),%r0          # r0 = address of area2
103         movl    topstack(%r0),%sp               # Restore sp
104         movl    (%sp)+,%fp              # Restore fp
105         movl    (%sp)+,%ap              # ,,,,
106         clrl    _C_LABEL(PRE_Block)     # End of preemption critical section
107         ret
109         pushl   $1234                   # I will gloat, Kazar
110         calls   $0,_C_LABEL(abort)