xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame^] | 1 | /* _Unwind_Resume wrapper for ARM EABI. |
| 2 | Copyright (C) 2015-2016 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 License as |
| 7 | published by the Free Software Foundation; either version 2.1 of the |
| 8 | 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 | <http://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <sysdep.h> |
| 20 | |
| 21 | /* This is just implementing exactly what the C version does. |
| 22 | We do it in assembly just to ensure that we get an unmolested tail |
| 23 | call to the libgcc function, which is necessary for the ARM unwinder. */ |
| 24 | |
| 25 | ENTRY (_Unwind_Resume) |
| 26 | LDR_HIDDEN (ip, ip, __libgcc_s_resume, 0) |
| 27 | cmp ip, #0 |
| 28 | beq 1f |
| 29 | 0: PTR_DEMANGLE (ip, ip, r2, r3) |
| 30 | bx ip |
| 31 | |
| 32 | /* We need to save and restore LR (for our own return address) |
| 33 | and R0 (for the argument to _Unwind_Resume) around the call. */ |
| 34 | 1: push {r0, lr} |
| 35 | cfi_adjust_cfa_offset (8) |
| 36 | cfi_rel_offset (r0, 0) |
| 37 | cfi_rel_offset (lr, 4) |
| 38 | bl __libgcc_s_init |
| 39 | pop {r0, lr} |
| 40 | cfi_adjust_cfa_offset (-8) |
| 41 | cfi_restore (r0) |
| 42 | cfi_restore (lr) |
| 43 | |
| 44 | LDR_HIDDEN (ip, ip, __libgcc_s_resume, 0) |
| 45 | b 0b |
| 46 | END (_Unwind_Resume) |