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

setjmp.S « fr30 « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 98ac44d48aedb771cfd1f92c71c89141bfcc26a8 (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
# setjmp/longjmp for FR30.  The jmpbuf looks like this:
#	
# Register	jmpbuf offset
# R8		0x00
# R9		0x04
# R10		0x08
# R11		0x0c
# R12		0x10
# R13		0x14
# R14 (FP)	0x18
# R15 (SP)	0x1c
# RP            0x20
	
.macro save reg
	st	\reg,@r4
	add	#4,r4
.endm
	
.macro restore reg
	ld	@r4,\reg
	add	#4,r4
.endm


	.text
	.global	setjmp
setjmp:
	save	r8
	save	r9
	save	r10
	save	r11
	save	r12
	save	r13
	save	r14
	save	r15
	mov	RP,r5
	st	r5,@r4

# Return 0 to caller.
	ldi:8	#0,r4
	ret

	.global	longjmp
longjmp:
	restore	r8
	restore	r9
	restore	r10
	restore	r11
	restore	r12
	restore	r13
	restore	r14
	restore	r15
	ld	@r4,r4
	mov	r4,RP

# If caller attempted to return 0, return 1 instead.

	mov	r5,r4
	or	r4,r4
	bne	1f
	ldi:8	#1,r4
    1:
	ret