summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/nios2/bsd-_setjmp.S
blob: e1350f55ed304483d8a4bca98e8db17a6285496f (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
/*
 * libc/sysdeps/linux/nios2/bsd-_setjmp.S
 *
 *  Copyright (C) 2004,05,06  Microtronix Datacom Ltd
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License.  See the file COPYING.LIB in the main
 * directory of this archive for more details.
 * 
 * Written by Wentao Xu <wentao@microtronix.com>
 * 
 */

#include <features.h>
#include <jmpbuf-offsets.h>

   .globl _setjmp
   .type  _setjmp,@function
   .balign 4

_setjmp:
    stw     r16, (JB_REGS+ 0)(r4)
    stw     r17, (JB_REGS+ 4)(r4)
    stw     r18, (JB_REGS+ 8)(r4)
    stw     r19, (JB_REGS+12)(r4)
    stw     r20, (JB_REGS+16)(r4)
    stw     r21, (JB_REGS+20)(r4)
    stw     r22, (JB_REGS+24)(r4)
    stw     r23, (JB_REGS+28)(r4)
    
    stw     ra, JB_PC(r4)
    stw     sp, JB_SP(r4)
    stw     fp, JB_FP(r4)
    stw     gp, JB_GP(r4)
    
#ifdef __UCLIBC_HAS_FPU__
    SAVE_FPU r4 JB_FPREGS
#endif
    stw     r0, JB_SIZE(r4) /* signal mask is not saved */
    mov     r2, zero
    ret