| 1 | /* _Unwind_Resume wrapper for ARM EABI. |
| 2 | Copyright (C) 2015-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 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 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #include <sysdep.h> |
| 20 | |
| 21 | /* This is equivalent to the following C implementation: |
| 22 | |
| 23 | void |
| 24 | _Unwind_Resume (struct _Unwind_Exception *exc) |
| 25 | { |
| 26 | __unwind_link_get_resume () (exc); |
| 27 | } |
| 28 | |
| 29 | We do it in assembly just to ensure that we get an unmolested tail |
| 30 | call to the libgcc function, which is necessary for the ARM unwinder. */ |
| 31 | |
| 32 | ENTRY (_Unwind_Resume) |
| 33 | /* We need to save and restore LR (for our own return address) |
| 34 | and R0 (for the argument to _Unwind_Resume) around the call. */ |
| 35 | push {r0, lr} |
| 36 | cfi_adjust_cfa_offset (8) |
| 37 | cfi_rel_offset (r0, 0) |
| 38 | cfi_rel_offset (lr, 4) |
| 39 | bl __unwind_link_get_resume |
| 40 | mov r3, r0 |
| 41 | pop {r0, lr} |
| 42 | cfi_adjust_cfa_offset (-8) |
| 43 | cfi_restore (r4) |
| 44 | cfi_restore (lr) |
| 45 | bx r3 |
| 46 | END (_Unwind_Resume) |
| 47 | |