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