1 /* Support functions for the unwinder.
2 Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
3 Contributed by Paul Brook
5 This file is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
10 In addition to the permissions in the GNU General Public License, the
11 Free Software Foundation gives you unlimited permission to link the
12 compiled version of this file into combinations with other programs,
13 and to distribute those combinations without any restriction coming
14 from the use of this file. (The General Public License restrictions
15 do apply in other respects; for example, they cover modification of
16 the file, and distribution when not linked into a combine
19 This file is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program; see the file COPYING. If not, write to
26 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
27 Boston, MA 02110-1301, USA. */
29 /* An executable stack is *not* required for these functions. */
30 #if defined(__ELF__) && defined(__linux__)
31 .section .note.GNU-stack,"",%progbits
37 #include "lib1funcs.asm"
41 EQUIV SYM (\name), SYM (__\name)
44 /* r0 points to a 16-word block. Upload these values to the actual core
46 ARM_FUNC_START restore_core_regs
47 /* We must use sp as the base register when restoring sp. Push the
48 last 3 registers onto the top of the current stack to achieve
51 ldmia r1, {r3, r4, r5} /* {sp, lr, pc}. */
52 #ifdef __INTERWORKING__
53 /* Restore pc into ip. */
55 stmfd sp!, {r2, r3, r4}
57 stmfd sp!, {r3, r4, r5}
59 /* Don't bother restoring ip. */
60 ldmia r0, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp}
61 /* Pop the three registers we pushed earlier. */
62 #ifdef __INTERWORKING__
63 ldmfd sp, {ip, sp, lr}
66 ldmfd sp, {sp, lr, pc}
68 FUNC_END restore_core_regs
69 UNPREFIX restore_core_regs
71 /* Load VFP registers d0-d15 from the address in r0.
72 Use this to load from FSTMX format. */
73 ARM_FUNC_START gnu_Unwind_Restore_VFP
74 /* Use the generic coprocessor form so that gas doesn't complain
75 on soft-float targets. */
76 ldc p11,cr0,[r0],{0x21} /* fldmiax r0, {d0-d15} */
79 /* Store VFP registers d0-d15 to the address in r0.
80 Use this to store in FSTMX format. */
81 ARM_FUNC_START gnu_Unwind_Save_VFP
82 /* Use the generic coprocessor form so that gas doesn't complain
83 on soft-float targets. */
84 stc p11,cr0,[r0],{0x21} /* fstmiax r0, {d0-d15} */
87 /* Load VFP registers d0-d15 from the address in r0.
88 Use this to load from FSTMD format. */
89 ARM_FUNC_START gnu_Unwind_Restore_VFP_D
90 ldc p11,cr0,[r0],{0x20} /* fldmiad r0, {d0-d15} */
93 /* Store VFP registers d0-d15 to the address in r0.
94 Use this to store in FLDMD format. */
95 ARM_FUNC_START gnu_Unwind_Save_VFP_D
96 stc p11,cr0,[r0],{0x20} /* fstmiad r0, {d0-d15} */
99 /* Load VFP registers d16-d31 from the address in r0.
100 Use this to load from FSTMD (=VSTM) format. Needs VFPv3. */
101 ARM_FUNC_START gnu_Unwind_Restore_VFP_D_16_to_31
102 ldcl p11,cr0,[r0],{0x20} /* vldm r0, {d16-d31} */
105 /* Store VFP registers d16-d31 to the address in r0.
106 Use this to store in FLDMD (=VLDM) format. Needs VFPv3. */
107 ARM_FUNC_START gnu_Unwind_Save_VFP_D_16_to_31
108 stcl p11,cr0,[r0],{0x20} /* vstm r0, {d16-d31} */
111 /* Wrappers to save core registers, then call the real routine. */
113 .macro UNWIND_WRAPPER name nargs
115 /* Create a phase2_vrs structure. */
116 /* Split reg push in two to ensure the correct value for sp. */
117 stmfd sp!, {sp, lr, pc}
118 stmfd sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip}
120 /* Demand-save flags, plus an extra word for alignment. */
124 /* Point r1 at the block. Pass r[0..nargs) unchanged. */
126 #if defined(__thumb__)
127 /* Switch back to thumb mode to avoid interworking hassle. */
133 bl SYM (__gnu\name) __PLT__
138 bl SYM (__gnu\name) __PLT__
147 UNWIND_WRAPPER _Unwind_RaiseException 1
148 UNWIND_WRAPPER _Unwind_Resume 1
149 UNWIND_WRAPPER _Unwind_Resume_or_Rethrow 1
150 UNWIND_WRAPPER _Unwind_ForcedUnwind 3
152 #endif /* __symbian__ */