2 Copyright © 2015, The AROS Development Team. All rights reserved.
5 Desc: ANSI C function siglongjmp()
9 /******************************************************************************
14 void siglongjmp (jmp_buf env, int val);
17 Save the current context so that you can return to it later.
20 env - The context/environment to restore
21 val - This value is returned by setjmp() when you return to the
22 saved context. You cannot return 0. If val is 0, then
23 setjmp() returns with 1.
26 This function doesn't return.
37 ... this code is executed after setjmp() returns ...
39 // This is no good example on how to use this function
40 // You should not do that
48 ... this code is executed if you call siglongjmp(env) ...
60 ******************************************************************************/
62 #include "aros/i386/asm.h"
66 .globl AROS_CDEFNAME(siglongjmp)
67 _FUNCTION
(AROS_CDEFNAME
(siglongjmp
))
69 .set FirstArg, 4 /* Skip Return-Adress */
73 AROS_CDEFNAME
(siglongjmp
):
74 /* Fetch the address of the env-structure off the stack.
75 The address is stored in %eax which is not preserved
76 because it's contents are overwritten anyway by the
80 /* Read return value into %ebx and make sure it's not 0 */
87 /* Restore stack pointer and all registers from env */
88 movl
28(%eax
),%esp
/* Restore original stack */
91 movl
%ecx
,retaddr
(%esp
) /* Restore return address */
93 pushl
%ebx
/* Save return value on new stack */
95 /* Restore all registers */
96 movl
4(%eax
),%ebx
/* %ebx */
97 movl
8(%eax
),%ecx
/* %ecx */
98 movl
12(%eax
),%edx
/* %edx */
99 movl
16(%eax
),%esi
/* %esi */
100 movl
20(%eax
),%edi
/* %edi */
101 movl
24(%eax
),%ebp
/* %ebp */
103 popl
%eax
/* Fetch return value */