1/* setjmp for C-SKY ABIV2. 2 Copyright (C) 2018-2021 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 21ENTRY (setjmp) 22 movi a1, 1 23 br __sigsetjmp 24END (setjmp) 25 26ENTRY (_setjmp) 27 movi a1, 0 28 br __sigsetjmp 29END (_setjmp) 30 31libc_hidden_def (_setjmp) 32 33ENTRY (__sigsetjmp) 34 mov a2, a0 35 /* Save registers. */ 36 37#ifdef PTR_MANGLE 38 PTR_MANGLE (t0, sp, a3) 39 stw t0, (a2, 0) 40 PTR_MANGLE2 (t0, lr, a3) 41 stw t0, (a2, 4) 42#else 43 stw sp, (a2, 0) 44 stw lr, (a2, 4) 45#endif 46 stw r4, (a2, 8) 47 stw r5, (a2, 12) 48 stw r6, (a2, 16) 49 stw r7, (a2, 20) 50 stw r8, (a2, 24) 51 stw r9, (a2, 28) 52 stw r10, (a2, 32) 53 stw r11, (a2, 36) 54 stw r16, (a2, 40) 55 stw r17, (a2, 44) 56 stw r26, (a2, 48) 57 stw r27, (a2, 52) 58 stw r28, (a2, 56) 59 stw r29, (a2, 60) 60 stw r30, (a2, 64) 61 stw r31, (a2, 68) 62 addi a2, 72 63 64#ifdef __PIC__ 65 grs t1, .Lgetpc 66.Lgetpc: 67 lrw t0, .Lgetpc@GOTPC 68 addu t1, t0 69 lrw a2, __sigjmp_save@PLT 70 ldr.w a2, (t1, a2 << 0) 71 jmp a2 72#else 73 jmpi __sigjmp_save 74#endif /* !__PIC__ */ 75END (__sigsetjmp) 76 77hidden_def (__sigsetjmp) 78