1/*
2Copyright (c) 1990 The Regents of the University of California.
3All rights reserved.
4
5Redistribution and use in source and binary forms are permitted
6provided that the above copyright notice and this paragraph are
7duplicated in all such forms and that any documentation,
8and/or other materials related to such
9distribution and use acknowledge that the software was developed
10by the University of California, Berkeley.  The name of the
11University may not be used to endorse or promote products derived
12from this software without specific prior written permission.
13THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16 */
17#include "m68kasm.h"
18
19.global SYM (setjmp)
20.global SYM (longjmp)
21
22SYM (setjmp):
23	moveal sp@(4),a0
24	movel sp@(0),a0@(12)
25	movel sp,a0@(8)
26	moveml d2-d7/a2-a6,a0@(20)
27	clrl d0
28	rts
29
30SYM (longjmp):
31	moveal sp@(4),a0
32	movel sp@(8),d0
33	bne 1f
34	movel &1,d0
351:
36	moveml a0@(20),d2-d7/a2-a6
37	moveal a0@(8),sp
38	movel a0@(12),sp@
39	rts
40
41#ifdef M68881
42.global SYM (setjmp_68881)
43.global SYM (longjmp_68881)
44
45SYM (setjmp_68881):
46	moveal sp@(4),a0
47	movel sp@(0),a0@(12)
48	movel sp,a0@(8)
49	moveml d2-d7/a2-a6,a0@(20)
50	fmovemx fp2-fp7,a0@(64)
51	clrl d0
52	rts
53
54SYM (longjmp_68881):
55	moveal sp@(4),a0
56	fmovemx a0@(64),fp2-fp7
57	movel sp@(8),d0
58	bne 1f
59	movel &1,d0
601:
61	moveml a0@(20),d2-d7/a2-a6
62	moveal a0@(8),sp
63	movel a0@(12),sp@
64	rts
65#endif
66