1;;  xstormy16
2;;   Copyright (C) 2001 by  Red Hat, Incorporated. All rights reserved.
3;;
4;; Permission to use, copy, modify, and distribute this software
5;; is freely granted, provided that this notice is preserved.
6;;
7	.file "setjmp.S"
8
9	.section .text
10	.align 1
11	.global setjmp
12	.type setjmp,@function
13setjmp:
14	mov r0,r10
15	mov (r2++),r0
16	mov r0,r11
17	mov (r2++),r0
18	mov r0,r12
19	mov (r2++),r0
20	mov r0,r13
21	mov (r2++),r0
22	pop r0			; PC high word
23	pop r1			; PC low word
24	mov (r2++), r0
25	mov (r2++), r1
26	mov r3,sp
27	mov (r2++),r3
28	mov.w r2,#0
29	mov r8, r0
30	mov r9, r1
31	jmp r8, r9
32	.size setjmp,.-setjmp
33
34	.global longjmp
35	.type longjmp,@function
36longjmp:
37	mov r0,(r2++)
38	mov r10,r0
39	mov r0,(r2++)
40	mov r11,r0
41	mov r0,(r2++)
42	mov r12,r0
43	mov r0,(r2++)
44	mov r13,r0
45	mov r0,(r2++)
46	mov r8, r0
47	mov r1,(r2++)
48	mov r9, r1
49	mov r4,(r2++)
50	mov sp,r4
51;; status arg (r3) to longjmp is return value
52;; if it's zero, return 1
53	bnz r3, #0, 0f
54	mov.w r3,#1
550:	mov r2, r3
56	jmp r8,r9
57	.size longjmp,.-longjmp
58