1 /* Copyright (C) 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 #include <rtld-global-offsets.h>
21 #include "ucontext_i.h"
26 /* int getcontext (ucontext_t *ucp) */
29 /* No need to save r0-r3, d0-d7, or d16-d31. */
30 add r1, r0, #MCONTEXT_ARM_R4
33 /* Save R13 separately as Thumb can't STM it. */
34 str r13, [r0, #MCONTEXT_ARM_SP]
35 str r14, [r0, #MCONTEXT_ARM_LR]
37 str r14, [r0, #MCONTEXT_ARM_PC]
40 str r2, [r0, #MCONTEXT_ARM_R0]
42 /* Save ucontext_t * across the next call. */
45 /* __sigprocmask(SIG_BLOCK, NULL, &(ucontext->uc_sigmask)) */
48 add r2, r4, #UCONTEXT_SIGMASK
49 bl PLTJMP(__sigprocmask)
51 /* Store FP regs. Much of the FP code is copied from arm/setjmp.S. */
55 ldr r1, Lrtld_global_ro
58 ldr r2, [r2, #RTLD_GLOBAL_RO_DL_HWCAP_OFFSET]
64 add r0, r4, #UCONTEXT_REGSPACE
66 tst r2, #HWCAP_ARM_VFP
69 /* Store the VFP registers.
70 Don't use VFP instructions directly because this code
71 is used in non-VFP multilibs. */
72 /* Following instruction is vstmia r0!, {d8-d15}. */
73 stc p11, cr8, [r0], #64
74 /* Store the floating-point status register. */
75 /* Following instruction is vmrs r1, fpscr. */
76 mrc p10, 7, r1, cr1, cr0, 0
80 tst r2, #HWCAP_ARM_IWMMXT
83 /* Save the call-preserved iWMMXt registers. */
84 /* Following instructions are wstrd wr10, [r0], #8 (etc.) */
85 stcl p1, cr10, [r0], #8
86 stcl p1, cr11, [r0], #8
87 stcl p1, cr12, [r0], #8
88 stcl p1, cr13, [r0], #8
89 stcl p1, cr14, [r0], #8
90 stcl p1, cr15, [r0], #8
93 /* Restore the clobbered R4 and LR. */
94 ldr r14, [r4, #MCONTEXT_ARM_LR]
95 ldr r4, [r4, #MCONTEXT_ARM_R4]
104 1: .long _GLOBAL_OFFSET_TABLE_ - 0b - 8
106 .long C_SYMBOL_NAME(_rtld_global_ro)(GOT)
109 .long C_SYMBOL_NAME(_dl_hwcap)
113 weak_alias(__getcontext, getcontext)