Don't keep asking for S2EVENT_CONNECT reports if driver doen't
[AROS.git] / arch / i386-all / clib / setjmp.s
blob694c7249a3c46423a2c2fb0cc5b5070cc7821a6a
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ANSI C function setjmp()
6 Lang: english
7 */
9 /******************************************************************************
11 NAME
12 #include <setjmp.h>
14 int setjmp (jmp_buf env);
16 FUNCTION
17 Save the current context so that you can return to it later.
19 INPUTS
20 env - The context/environment is saved here for later restoring
22 RESULT
23 0 if it returns from setjmp() and 1 when it returns from longjmp().
25 NOTES
27 EXAMPLE
28 jmp_buf env;
30 ... some code ...
32 if (!setjmp (env))
34 ... this code is executed after setjmp() returns ...
36 // This is no good example on how to use this function
37 // You should not do that
38 if (error)
39 longjmp (env, 5);
41 ... some code ...
43 else
45 ... this code is executed if you call longjmp(env) ...
48 BUGS
50 SEE ALSO
51 longjmp()
53 INTERNALS
55 HISTORY
57 ******************************************************************************/
59 #include "aros/i386/asm.h"
61 .text
62 _ALIGNMENT
63 .globl AROS_CDEFNAME(setjmp)
64 _FUNCTION(AROS_CDEFNAME(setjmp))
66 .set FirstArg, 4 /* Skip Return-Adress */
67 .set env, FirstArg
69 AROS_CDEFNAME(setjmp):
70 /* Fetch the address of the env-structure off the stack.
71 The address is stored in %eax which is not preserved
72 because it's contents are overwritten anyway by the
73 return code */
74 movl env(%esp),%eax
76 /* Save stack pointer and all registers into env */
77 movl %ebx,4(%eax) /* %ebx */
78 movl %ecx,8(%eax) /* %ecx */
79 movl %edx,12(%eax) /* %edx */
80 movl %esi,16(%eax) /* %esi */
81 movl %edi,20(%eax) /* %edi */
82 movl %ebp,24(%eax) /* %ebp */
83 movl %esp,28(%eax) /* %esp */
85 pushl %ebx
87 movl retaddr+4(%esp), %ebx /* Save return address (%esp has changed) */
88 movl %ebx,0(%eax)
90 popl %ebx
92 xorl %eax,%eax /* Return 0 */
93 ret