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

setjmp.S « d10v « machine « libc « newlib - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 22287dd1e02736c7708f3fc6a7509105438ec796 (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
; setjmp/longjmp for D10V.  The jmpbuf looks like this:
;
; Register		jmpbuf offset
; R6			0x00
; R7			0x02
; R8			0x04
; R9			0x06
; R10			0x08
; R11			0x0a
; R13 (return address)	0x0c
; R15 (SP)		0x0E

	.text
	.globl	setjmp
	.type	setjmp,@function
	.stabs	"setjmp.S",100,0,0,setjmp
	.stabs	"int:t(0,1)=r(0,1);-65536;65535;",128,0,0,0
	.stabs	"setjmp:F(0,1)",36,0,1,setjmp

setjmp:
; Address of jmpbuf is passed in R0.  Save the appropriate registers.
	st2w	r6, @r0+
	st2w	r8, @r0+
	st2w	r10, @r0+
	st	r13, @r0+
	st	r15, @r0+

; Return 0 to caller
	ldi	r0, 0
	jmp	r13
.Lsetjmp:
	.size	setjmp,.Lsetjmp-setjmp
	.stabs	"",36,0,0,.Lsetjmp-setjmp

	.globl	longjmp
	.type	longjmp,@function
	.stabs	"longjmp:F(0,1)",36,0,1,longjmp
longjmp:
; Address of jmpbuf is in R0.  Restore the registers.
	ld2w	r6, @r0+
	ld2w	r8, @r0+
	ld2w	r10, @r0+
	ld	r13, @r0+
	ld	r15, @r0+

; Value to return to caller is in R1.  If caller attemped to return 0,
; return 1 instead.

	mv	r0, r1
	cmpeqi	r0, 0
	exef0t || ldi r0,1
	jmp	r13
.Llongjmp:
	.size	longjmp,.Llongjmp-longjmp
	.stabs	"",36,0,0,.Llongjmp-longjmp