added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / ppc-all / clib / setjmp.s
blob5025f1a50fd08d731c26abd84ca1dfafef0624be
1 /*
2 Copyright © 1995-2007, 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
56 12.10.1999 Code rewritten according to glibc
57 ******************************************************************************/
59 #include "aros/ppc/asm.h"
61 .text
62 _ALIGNMENT
63 .global AROS_CDEFNAME(setjmp)
64 _FUNCTION(AROS_CDEFNAME(setjmp))
66 AROS_CDEFNAME(setjmp):
67 stw %r1,(0*4)(3)
68 mflr %r0
69 stw %r2,(1*4)(3)
70 stw %r14,((3+0)*4)(3)
71 stfd %f14,((22+0*2)*4)(3)
72 stw %r0,(2*4)(3)
73 stw %r15,((3+1)*4)(3)
74 stfd %f15,((22+1*2)*4)(3)
75 mfcr %r0
76 stw %r16,((3+2)*4)(3)
77 stfd %f16,((22+2*2)*4)(3)
78 stw %r0,(21*4)(3)
79 stw %r17,((3+3)*4)(3)
80 stfd %f17,((22+3*2)*4)(3)
81 stw %r18,((3+4)*4)(3)
82 stfd %f18,((22+4*2)*4)(3)
83 stw %r19,((3+5)*4)(3)
84 stfd %f19,((22+5*2)*4)(3)
85 stw %r20,((3+6)*4)(3)
86 stfd %f20,((22+6*2)*4)(3)
87 stw %r21,((3+7)*4)(3)
88 stfd %f21,((22+7*2)*4)(3)
89 stw %r22,((3+8)*4)(3)
90 stfd %f22,((22+8*2)*4)(3)
91 stw %r23,((3+9)*4)(3)
92 stfd %f23,((22+9*2)*4)(3)
93 stw %r24,((3+10)*4)(3)
94 stfd %f24,((22+10*2)*4)(3)
95 stw %r25,((3+11)*4)(3)
96 stfd %f25,((22+11*2)*4)(3)
97 stw %r26,((3+12)*4)(3)
98 stfd %f26,((22+12*2)*4)(3)
99 stw %r27,((3+13)*4)(3)
100 stfd %f27,((22+13*2)*4)(3)
101 stw %r28,((3+14)*4)(3)
102 stfd %f28,((22+14*2)*4)(3)
103 stw %r29,((3+15)*4)(3)
104 stfd %f29,((22+15*2)*4)(3)
105 stw %r30,((3+16)*4)(3)
106 stfd %f30,((22+16*2)*4)(3)
107 stw %r31,((3+17)*4)(3)
108 stfd %f31,((22+17*2)*4)(3)
109 li %r3,0