venus: Remove dedebug
[openafs.git] / src / lwp / process.i386.s
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 /* Sun 386i... I hope this does the right thing!!!
11  * 
12  * Written by Derek Atkins <warlord@MIT.EDU>
13  * (debugging help by Chris Provenzano <proven@mit.edu>)
14  * 11/1991
15  *
16  * "ojala que es correcto!"
17  */
18
19 #include <lwp_elf.h>
20
21         .file "process.s"
22
23         .data
24
25         .text
26
27 /*
28  * struct savearea {
29  *      char    *topstack;
30  * }
31  */
32
33         .set    topstack,0
34
35 /*
36  * savecontext(f, area1, newsp)
37  *      int (*f)(); struct savearea *area1; char *newsp;
38  */
39
40 /* offsets, to make my life easier! */
41         .set    f,8
42         .set    area1,12
43         .set    newsp,16
44
45 .globl  _C_LABEL(PRE_Block)
46 .globl  _C_LABEL(savecontext)
47
48 ENTRY(savecontext)
49         pushl   %ebp                    /* New Frame! */
50         movl    %esp,%ebp
51         pusha                           /* Push all registers */
52         movl    $1,_C_LABEL(PRE_Block)  /* Pre-emption code */
53         movl    area1(%ebp),%eax        /* eax = base of savearea */
54         movl    %esp,(%eax)             /* area->topstack = esp */
55         movl    newsp(%ebp),%eax        /* get new sp into eax */
56         cmpl    $0,%eax
57         je      L1                      /* if new sp is 0 then dont change esp */
58         movl    %eax,%esp               /* go ahead.  make my day! */
59 L1:
60         jmp     *f(%ebp)                        /* ebx = &f */
61
62 /*
63  * returnto(area2)
64  *      struct savearea *area2;
65  */
66
67 /* stack offset */
68         .set    area2,8
69
70 .globl  _C_LABEL(returnto)
71
72 ENTRY(returnto)
73         pushl   %ebp
74         movl    %esp, %ebp              /* New frame, to get correct pointer */
75         movl    area2(%ebp),%eax        /* eax = area2 */
76         movl    (%eax),%esp             /* restore esp */
77         popa 
78         movl    $0,_C_LABEL(PRE_Block)          /* clear it up... */
79         popl    %ebp
80         ret
81
82 #if defined(__linux__) && defined(__ELF__)
83         .section .note.GNU-stack,"",%progbits
84 #endif