blob: ac99bfe0a7bd25f1235c075e5408b08868885e9b [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/*
2 * libc/sysdeps/linux/nios2/bsd-setjmp.S
3 *
4 * Copyright (C) 2004,05,06 Microtronix Datacom Ltd
5 *
6 * This file is subject to the terms and conditions of the GNU Lesser
7 * General Public License. See the file COPYING.LIB in the main
8 * directory of this archive for more details.
9 *
10 * Written by Wentao Xu <wentao@microtronix.com>
11 *
12 */
13
14
15#define _ASM
16#define _SETJMP_H
17#include <bits/setjmp.h>
18
19 .globl setjmp
20 .type setjmp,@function
21 .balign 4
22
23setjmp:
24 stw r16, (JB_REGS+ 0)(r4)
25 stw r17, (JB_REGS+ 4)(r4)
26 stw r18, (JB_REGS+ 8)(r4)
27 stw r19, (JB_REGS+12)(r4)
28 stw r20, (JB_REGS+16)(r4)
29 stw r21, (JB_REGS+20)(r4)
30 stw r22, (JB_REGS+24)(r4)
31 stw r23, (JB_REGS+28)(r4)
32
33 stw ra, JB_PC(r4)
34 stw sp, JB_SP(r4)
35 stw fp, JB_FP(r4)
36 stw gp, JB_GP(r4)
37
38#if defined(__HAVE_FPU__)
39 SAVE_FPU r4 JB_FPREGS
40#endif
41
42 movui r5, 1
43#ifdef __PIC__
44 /* just pray 16 bit offset is enough */
45 br __sigjmp_save
46#else
47 movhi r8, %hi(__sigjmp_save)
48 ori r8, r8, %lo(__sigjmp_save)
49 jmp r8
50#endif
51
52