1 | /* setjmp for C-SKY ABIV2. |
2 | Copyright (C) 2018-2024 Free Software Foundation, Inc. |
3 | This file is part of the GNU C Library. |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License as published by the Free Software Foundation; either |
8 | version 2.1 of the License, or (at your option) any later version. |
9 | |
10 | The GNU C Library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. |
14 | |
15 | You should have received a copy of the GNU Lesser General Public |
16 | License along with the GNU C Library. If not, see |
17 | <https://www.gnu.org/licenses/>. */ |
18 | |
19 | #include <sysdep.h> |
20 | #include <pointer_guard.h> |
21 | |
22 | ENTRY (setjmp) |
23 | movi a1, 1 |
24 | br __sigsetjmp |
25 | END (setjmp) |
26 | |
27 | ENTRY (_setjmp) |
28 | movi a1, 0 |
29 | br __sigsetjmp |
30 | END (_setjmp) |
31 | |
32 | libc_hidden_def (_setjmp) |
33 | |
34 | ENTRY (__sigsetjmp) |
35 | mov a2, a0 |
36 | /* Save registers. */ |
37 | |
38 | #ifdef PTR_MANGLE |
39 | PTR_MANGLE (t0, sp, a3) |
40 | stw t0, (a2, 0) |
41 | PTR_MANGLE2 (t0, lr, a3) |
42 | stw t0, (a2, 4) |
43 | #else |
44 | stw sp, (a2, 0) |
45 | stw lr, (a2, 4) |
46 | #endif |
47 | stw r4, (a2, 8) |
48 | stw r5, (a2, 12) |
49 | stw r6, (a2, 16) |
50 | stw r7, (a2, 20) |
51 | stw r8, (a2, 24) |
52 | stw r9, (a2, 28) |
53 | stw r10, (a2, 32) |
54 | stw r11, (a2, 36) |
55 | stw r16, (a2, 40) |
56 | stw r17, (a2, 44) |
57 | stw r26, (a2, 48) |
58 | stw r27, (a2, 52) |
59 | stw r28, (a2, 56) |
60 | stw r29, (a2, 60) |
61 | stw r30, (a2, 64) |
62 | stw r31, (a2, 68) |
63 | addi a2, 72 |
64 | |
65 | #ifdef __PIC__ |
66 | grs t1, .Lgetpc |
67 | .Lgetpc: |
68 | lrw t0, .Lgetpc@GOTPC |
69 | addu t1, t0 |
70 | lrw a2, __sigjmp_save@PLT |
71 | ldr.w a2, (t1, a2 << 0) |
72 | jmp a2 |
73 | #else |
74 | jmpi __sigjmp_save |
75 | #endif /* !__PIC__ */ |
76 | END (__sigsetjmp) |
77 | |
78 | hidden_def (__sigsetjmp) |
79 | |