2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /******************************************************************************
14 int setjmp (jmp_buf env);
17 Save the current context so that you can return to it later.
20 env - The context/environment is saved here for later restoring
23 0 if it returns from setjmp() and 1 when it returns from longjmp().
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
45 ... this code is executed if you call longjmp(env) ...
57 ******************************************************************************/
61 #define FirstArg 4 /* Skip Return-Address */
67 .globl AROS_CDEFNAME(setjmp)
68 .type AROS_CDEFNAME(setjmp),@function
69 AROS_CDEFNAME
(setjmp
):
70 move.
l env
(%sp
),%a0
/* save area pointer */
71 move.
l retaddr
(%sp
),(%a0
)+ /* save old PC */
72 lea.
l env
(%sp
),%a1
/* adjust saved SP since we won't rts */
73 move.
l %a1
,(%a0
)+ /* save old SP */
74 movem.
l %d2-
%d7
/%a2-
%a6
,(%a0
) /* save remaining non-scratch regs */
75 clr.
l %d0
/* return 0 */
79 The jmp_buf is filled as follows (d0/d1/a0/a1 are not saved):
81 _jmp_buf offset contents