Welcome to mirror list, hosted at ThFree Co, Russian Federation.

setjmp.S « m68hc11 « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 38d1188dc8f83b36a2bdb94553c4d9cb35d77cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* setjmp/longjmp routines for M68HC11 & M68HC12.
 * Copyright (C) 1999, 2000, 2001, 2002 Stephane Carrez (stcarrez@nerim.fr)	
 *
 * The authors hereby grant permission to use, copy, modify, distribute,
 * and license this software and its documentation for any purpose, provided
 * that existing copyright notices are retained in all copies and that this
 * notice is included verbatim in any distributions. No written agreement,
 * license, or royalty fee is required for any of the authorized uses.
 * Modifications to this software may be copyrighted by their authors
 * and need not follow the licensing terms described here, provided that
 * the new terms are clearly indicated on the first page of each file where
 * they apply.
 */

#if __INT__ == 32
# define val 4
# define INT32(X) X
#else
# define val 2
# define INT32(X)
#endif

#ifdef mc6811
# define REG(X) *X
#else
# define REG(X) X
#endif

	.sect .text
	.global setjmp
	.global longjmp

#ifdef mc6811
setjmp:
	xgdx
	tsy
	ldd	0,y
	std	0,x
	sty	2,x
	ldd	REG(_.frame)
	std	4,x
	ldd	REG(_.d1)
	std	6,x
	ldd	REG(_.d2)
	std	8,x
	ldd	REG(_.d3)
	std	10,x
	ldd	REG(_.d4)
	std	12,x
	ldd	REG(_.d5)
	std	14,x
	ldd	REG(_.d6)
	std	16,x
	ldd	REG(_.d7)
	std	18,x
	ldd	REG(_.d8)
	std	20,x
INT32(	ldx	#0)
	clra
	clrb
	rts
#else
setjmp:
	xgdx
	movw	0,sp,2,x+
	sts	2,x+
	movw	_.frame,2,x+
	movw	_.d1,2,x+
	movw	_.d2,2,x+
	movw	_.d3,2,x+
	movw	_.d4,2,x+
	movw	_.d5,2,x+
	movw	_.d6,2,x+
	movw	_.d7,2,x+
	movw	_.d8,2,x+
INT32(	ldx	#0)
	clra
	clrb
	rts
#endif

#ifdef mc6811
longjmp:
	xgdx
	tsy
	ldd	val,y
	bne	do_jump
	ldd	#1
do_jump:
	xgdy
	ldd	4,x
	std	REG(_.frame)
	ldd	6,x
	std	REG(_.d1)
	ldd	8,x
	std	REG(_.d2)
	ldd	10,x
	std	REG(_.d3)
	ldd	12,x
	std	REG(_.d4)
	ldd	14,x
	std	REG(_.d5)
	ldd	16,x
	std	REG(_.d6)
	ldd	18,x
	std	REG(_.d7)
	ldd	20,x
	std	REG(_.d8)
	ldd	0,x
	ldx	2,x
	txs
	std	0,x
INT32(	ldx	#0)
	xgdy
	rts
#else

longjmp:
	xgdx
	ldy	val,sp
	bne	do_jump
	ldy	#1
do_jump:
	ldd	4,x+
	movw	2,x+,_.frame
	movw	0,x,_.d1
	movw	2,x,_.d2
	movw	4,x,_.d3
	movw	6,x,_.d4
	movw	8,x,_.d5
	movw	10,x,_.d6
	movw	12,x,_.d7
	movw	14,x,_.d8
	ldx	-4,x
	txs
	std	0,x
INT32(	ldx	#0)
	xgdy
	rts
#endif