add another arch specific function for IRQ handling.
[AROS.git] / arch / ppc-all / stdc / longjmp.s
blob223761382b59fc627a2e731946175c19af19de66
1 /*
2 Copyright � 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: ANSI C function longjmp()
6 Lang: english
7 */
9 /******************************************************************************
11 NAME
12 #include <setjmp.h>
14 void longjmp (jmp_buf env, int val);
16 FUNCTION
17 Save the current context so that you can return to it later.
19 INPUTS
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.
25 RESULT
26 This function doesn't return.
28 NOTES
30 EXAMPLE
31 jmp_buf env;
33 ... some code ...
35 if (!setjmp (env))
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
41 if (error)
42 longjmp (env, 5);
44 ... some code ...
46 else
48 ... this code is executed if you call longjmp(env) ...
51 BUGS
53 SEE ALSO
54 setjmp()
56 INTERNALS
58 HISTORY
59 12.10.1999 Code rewritten according to glibc
61 ******************************************************************************/
63 #include "aros/ppc/asm.h"
65 .text
66 _ALIGNMENT
67 .globl AROS_CDEFNAME(longjmp)
68 _FUNCTION(longjmp)
69 AROS_CDEFNAME(longjmp):
70 cmpi 0,1,%r4,0
71 bne okret
72 li %r4,1
73 okret:
74 lwz %r1, 4(3)
75 lwz %r2, 8(3)
76 lwz %r0, 0(3)
77 lwz %r14, 16(3)
78 lfd %f14, 88(3)
79 lwz %r15, 20(3)
80 lfd %f15, 96(3)
81 lwz %r16, 24(3)
82 lfd %f16,104(3)
83 lwz %r17, 28(3)
84 lfd %f17,112(3)
85 lwz %r18, 32(3)
86 lfd %f18,120(3)
87 lwz %r19, 36(3)
88 lfd %f19,128(3)
89 lwz %r20, 40(3)
90 lfd %f20,136(3)
91 mtlr %r0
92 lwz %r21, 44(3)
93 lfd %f21,144(3)
94 lwz %r22, 48(3)
95 lfd %f22,152(3)
96 lwz %r0, 12(3)
97 lwz %r23, 52(3)
98 lfd %f23,160(3)
99 lwz %r24, 56(3)
100 lfd %f24,168(3)
101 lwz %r25, 60(3)
102 lfd %f25,176(3)
103 mtcrf 0xFF,%r0
104 lwz %r26, 64(3)
105 lfd %f26,184(3)
106 lwz %r27, 68(3)
107 lfd %f27,192(3)
108 lwz %r28, 72(3)
109 lfd %f28,200(3)
110 lwz %r29, 76(3)
111 lfd %f29,208(3)
112 lwz %r30, 80(3)
113 lfd %f30,216(3)
114 lwz %r31, 84(3)
115 lfd %f31,224(3)
116 mr %r3,%r4