yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame^] | 1 | /* setjmp for ARM. |
| 2 | Copyright (C) 1997, 1998 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, write to the Free |
| 17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 18 | 02111-1307 USA. */ |
| 19 | |
| 20 | #include <features.h> |
| 21 | #include <bits/arm_asm.h> |
| 22 | |
| 23 | .global __sigsetjmp |
| 24 | .type __sigsetjmp,%function |
| 25 | .align 2 |
| 26 | #if defined(THUMB1_ONLY) |
| 27 | .thumb_func |
| 28 | __sigsetjmp: |
| 29 | push {r3, r4, r5, r6, r7, lr} |
| 30 | mov ip, r0 |
| 31 | stmia r0!, {r4, r5, r6, r7} |
| 32 | mov r2, r8 |
| 33 | mov r3, r9 |
| 34 | mov r4, sl |
| 35 | mov r5, fp |
| 36 | add r6, sp, #(6 * 4) |
| 37 | mov r7, lr |
| 38 | stmia r0!, {r2, r3, r4, r5, r6, r7} |
| 39 | |
| 40 | mov r0, ip |
| 41 | bl __sigjmp_save |
| 42 | pop {r3, r4, r5, r6, r7, pc} |
| 43 | |
| 44 | #else |
| 45 | __sigsetjmp: |
| 46 | /* Save registers */ |
| 47 | mov ip, r0 |
| 48 | #if defined(__thumb2__) |
| 49 | stmia ip!, {v1-v6, sl, fp} |
| 50 | mov r2, sp |
| 51 | stmia ip!, {r2, lr} |
| 52 | #else |
| 53 | /* Save registers */ |
| 54 | stmia ip!, {v1-v6, sl, fp, sp, lr} |
| 55 | #endif |
| 56 | #if defined __UCLIBC_HAS_FLOATS__ && ! defined __UCLIBC_HAS_SOFT_FLOAT__ |
| 57 | # ifdef __VFP_FP__ |
| 58 | /* Store the VFP registers. */ |
| 59 | /* Following instruction is fstmiax ip!, {d8-d15}. */ |
| 60 | stc p11, cr8, [r12], #68 |
| 61 | /* Store the floating-point status register. */ |
| 62 | /* Following instruction is fmrx r2, fpscr. */ |
| 63 | mrc p10, 7, r2, cr1, cr0, 0 |
| 64 | str r2, [ip], #4 |
| 65 | # elif defined __MAVERICK__ |
| 66 | cfstrd mvd4, [ip], #8 ; nop |
| 67 | cfstrd mvd5, [ip], #8 ; nop |
| 68 | cfstrd mvd6, [ip], #8 ; nop |
| 69 | cfstrd mvd7, [ip], #8 ; nop |
| 70 | cfstrd mvd8, [ip], #8 ; nop |
| 71 | cfstrd mvd9, [ip], #8 ; nop |
| 72 | cfstrd mvd10, [ip], #8 ; nop |
| 73 | cfstrd mvd11, [ip], #8 ; nop |
| 74 | cfstrd mvd12, [ip], #8 ; nop |
| 75 | cfstrd mvd13, [ip], #8 ; nop |
| 76 | cfstrd mvd14, [ip], #8 ; nop |
| 77 | cfstrd mvd15, [ip], #8 |
| 78 | # else |
| 79 | sfmea f4, 4, [ip]! |
| 80 | # endif |
| 81 | #endif |
| 82 | #ifdef __IWMMXT__ |
| 83 | /* Save the call-preserved iWMMXt registers. */ |
| 84 | /* Following instructions are wstrd wr10, [ip], #8 (etc.) */ |
| 85 | stcl p1, cr10, [r12], #8 |
| 86 | stcl p1, cr11, [r12], #8 |
| 87 | stcl p1, cr12, [r12], #8 |
| 88 | stcl p1, cr13, [r12], #8 |
| 89 | stcl p1, cr14, [r12], #8 |
| 90 | stcl p1, cr15, [r12], #8 |
| 91 | #endif |
| 92 | |
| 93 | /* Make a tail call to __sigjmp_save; it takes the same args. */ |
| 94 | #ifdef __PIC__ |
| 95 | B __sigjmp_save(PLT) |
| 96 | #else |
| 97 | B __sigjmp_save |
| 98 | #endif |
| 99 | #endif |
| 100 | |
| 101 | .size __sigsetjmp,.-__sigsetjmp |