use USER_CPPFLAGS
[AROS.git] / arch / m68k-all / stdc / longjmp.s
blob9887e2c587589b89b05bb4484034fe05bef6ef5c
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: longjmp
6 Lang: english
8 The jmp_buf is filled as follows (d0/d1/a0/a1 are not saved):
10 _jmp_buf offset contents
11 [0] 0 old pc
12 [1] 4 d2
13 [2] 8 d3
14 [3] 12 d4
15 [4] 16 d5
16 [5] 20 d6
17 [6] 24 d7
18 [7] 28 a2
19 [8] 32 a3
20 [9] 36 a4
21 [10] 40 a5
22 [11] 44 a6
23 [12] 48 old sp
24 [13] 52 padding
25 [14] 56 padding
26 [15] 60 DEBUG_MAGIC
29 #include "aros/m68k/asm.h"
31 .text
32 .balign 4
33 .global AROS_CDEFNAME(longjmp)
34 .type AROS_CDEFNAME(longjmp),%function
36 AROS_CDEFNAME(longjmp):
37 /* New version adapted from libnix instead of ixemul.
38 * Note the slightly different register save order.
40 addq.l #4,%sp /* returns to other address */
41 move.l %sp@+,%a0 /* get address of jmp_buf */
42 move.l %sp@+,%d0 /* get return code */
43 jne .okret
44 moveq.l #1,%d0 /* make sure it isn't 0 */
45 .okret:
46 movem.l (%a0),%d1-%d7/%a2-%a6/%sp /* restore all registers except scratch */
47 #if DEBUG
48 cmp.l #DEBUG_MAGIC,%a0@(4 * 15)
49 beq 0f
50 trap #1
52 #endif
53 move.l %d1,%a0
54 jmp %a0@