Test initialisation of MUIA_List_AdjustWidth and MUIA_List_AdjustHeight, and
[AROS.git] / arch / .unmaintained / m68k-pp-native / clib / setjmp.s
blob67f03e1cf4055c2d2d896fbe538cc86848c22355
1 /*
2 Copyright © 1995-2001, 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 "../include/aros/machine.i"
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 #if OLDJMP
71 move.l env(%sp),%a0 /* save area pointer */
72 move.l retaddr(%sp),(%a0)+ /* save old PC (return address) */
73 lea env(%sp),%a1 /* adjust saved SP since we won't rts */
74 move.l %a1,(%a0)+ /* save old SP */
75 movem.l %d2-%d7/%a2-%a6,(%a0) /* save remaining non-scratch regs */
76 clr.l %d0 /* return 0 */
77 rts
78 #else
79 /* New version adapted from libnix instead of ixemul.
80 * Note the slightly different register save order.
82 move.l 4(%sp),%a0 /* get address of jmp_buf */
83 move.l (%sp),(%a0)+ /* store return address */
84 movem.l %d2-%d7/%a2-%a6/%sp,(%a0) /* store all registers except scratch */
85 moveq.l #0,%d0 /* return 0 */
86 rts
87 #endif
90 The jmp_buf is filled as follows (d0/d1/a0/a1 are not saved):
92 _jmp_buf offset contents
93 [0] 0 old pc
94 [1] 4 d2
95 [2] 8 d3
96 [3] 12 d4
97 [4] 16 d5
98 [5] 20 d6
99 [6] 24 d7
100 [7] 28 a2
101 [8] 32 a3
102 [9] 36 a4
103 [10] 40 a5
104 [11] 44 a6
105 [12] 48 old sp