- DeviceNodes shouldn't be added to mountlist if DOS is already up.
[AROS.git] / arch / m68k-all / clib / setjmp.s
blobe1c941bfea8be2cc7bd5b27cf87ec3a2788a1d56
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: 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/m68k/asm.h"
61 .text
62 .balign 4
63 .globl setjmp
65 .set FirstArg, 4 /* Skip Return-Adress */
66 .set env, FirstArg
67 .set retaddr, 0
69 setjmp:
70 /* New version adapted from libnix instead of ixemul.
71 * Note the slightly different register save order.
73 move.l 4(%sp),%a0 /* get address of jmp_buf */
74 move.l (%sp),(%a0)+ /* store return address */
75 movem.l %d2-%d7/%a2-%a6/%sp,(%a0) /* store all registers except scratch */
76 moveq.l #0,%d0 /* return 0 */
77 rts
80 The jmp_buf is filled as follows (d0/d1/a0/a1 are not saved):
82 _jmp_buf offset contents
83 [0] 0 old pc
84 [1] 4 d2
85 [2] 8 d3
86 [3] 12 d4
87 [4] 16 d5
88 [5] 20 d6
89 [6] 24 d7
90 [7] 28 a2
91 [8] 32 a3
92 [9] 36 a4
93 [10] 40 a5
94 [11] 44 a6
95 [12] 48 old sp