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 * Written by Derek Atkins <warlord@MIT.EDU>
31 * (debugging help by Chris Provenzano <proven@mit.edu>)
33 * + * "ojala que sea correcto!"
36 #ifdef HAVE_MACHINE_ASM_H
37 #include <machine/asm.h>
43 #define LWP_ABORT L_abort$stub
45 #define LWP_ABORT _C_LABEL(abort)
63 * savecontext(f, area1, newsp)
64 * int (*f)(); struct savearea *area1; char *newsp;
67 /* offsets, to make my life easier! */
72 .globl _C_LABEL(PRE_Block)
73 .globl _C_LABEL(savecontext)
76 pushl %ebp /* New Frame! */
78 pushal /* Push all registers */
79 movl $1,_C_LABEL(PRE_Block) /* Do not allow any interrupt finagling */
80 movl area1(%ebp),%eax /* eax = base of savearea */
81 movl %esp,topstack(%eax) /* area->topstack = esp */
82 movl newsp(%ebp),%eax /* get new sp into eax */
84 je L1 /* if new sp is 0 then dont change esp */
85 movl %eax,%esp /* go ahead. make my day! */
87 jmp *f(%ebp) /* ebx = &f */
89 /* Shouldnt be here....*/
95 * struct savearea *area2;
101 .globl _C_LABEL(returnto)
105 movl %esp, %ebp /* New frame, to get correct pointer */
106 movl area2(%ebp),%eax /* eax = area2 */
107 movl topstack(%eax),%esp /* restore esp */
109 movl $0,_C_LABEL(PRE_Block) /* clear it up... */
113 /* I see, said the blind man, as he picked up his hammer and saw! */
117 #ifdef AFS_DARWIN_ENV
118 .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
120 .indirect_symbol _abort
121 hlt ; hlt ; hlt ; hlt ; hlt
122 .subsections_via_symbols