chiark / gitweb /
Make run_directory.c stat the place it is going to try to run.
[elogind.git] / klibc / klibc / arch / sparc / setjmp.S
1 !
2 ! setjmp.S
3 !
4 ! Basic setjmp/longjmp
5 !
6 ! This code was based on the equivalent code in NetBSD
7 !
8
9 #include <machine/asm.h>
10 #include <machine/trap.h>
11
12 !
13 ! The jmp_buf contains the following entries:
14 !   sp
15 !   fp
16 !   pc
17 !       
18 ENTRY(setjmp)
19         st      %sp,[%o0+0]     ! Callers stack pointer
20         st      %o7,[%o0+4]     ! Return pc
21         st      %fp,[%o0+8]     ! Frame pointer
22         retl                    ! Return
23          clr    %o0             !  ...0
24
25 ENTRY(longjmp)
26         sub     %sp, 64, %sp    ! set up a local stack frame
27 0:
28         t       ST_FLUSHWIN     ! flush register windows out to memory
29         !
30         ! We restore the saved stack pointer to %fp, then issue
31         ! a restore instruction which will reload the register
32         ! window from the stack.
33         !
34         ld      [%o0+4], %o7    /* restore return pc */
35         ld      [%o0+0], %fp    /* and stack pointer */
36
37         retl                    ! success, return %g6
38          restore        %o1, 0, %o0