source: trunk/libs/newlib/src/newlib/libc/machine/d10v/setjmp.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.1 KB
Line 
1; setjmp/longjmp for D10V.  The jmpbuf looks like this:
2;
3; Register              jmpbuf offset
4; R6                    0x00
5; R7                    0x02
6; R8                    0x04
7; R9                    0x06
8; R10                   0x08
9; R11                   0x0a
10; R13 (return address)  0x0c
11; R15 (SP)              0x0E
12
13        .text
14        .globl  setjmp
15        .type   setjmp,@function
16        .stabs  "setjmp.S",100,0,0,setjmp
17        .stabs  "int:t(0,1)=r(0,1);-65536;65535;",128,0,0,0
18        .stabs  "setjmp:F(0,1)",36,0,1,setjmp
19
20setjmp:
21; Address of jmpbuf is passed in R0.  Save the appropriate registers.
22        st2w    r6, @r0+
23        st2w    r8, @r0+
24        st2w    r10, @r0+
25        st      r13, @r0+
26        st      r15, @r0+
27
28; Return 0 to caller
29        ldi     r0, 0
30        jmp     r13
31.Lsetjmp:
32        .size   setjmp,.Lsetjmp-setjmp
33        .stabs  "",36,0,0,.Lsetjmp-setjmp
34
35        .globl  longjmp
36        .type   longjmp,@function
37        .stabs  "longjmp:F(0,1)",36,0,1,longjmp
38longjmp:
39; Address of jmpbuf is in R0.  Restore the registers.
40        ld2w    r6, @r0+
41        ld2w    r8, @r0+
42        ld2w    r10, @r0+
43        ld      r13, @r0+
44        ld      r15, @r0+
45
46; Value to return to caller is in R1.  If caller attemped to return 0,
47; return 1 instead.
48
49        mv      r0, r1
50        cmpeqi  r0, 0
51        exef0t || ldi r0,1
52        jmp     r13
53.Llongjmp:
54        .size   longjmp,.Llongjmp-longjmp
55        .stabs  "",36,0,0,.Llongjmp-longjmp
Note: See TracBrowser for help on using the repository browser.