1 /* Modify saved context.
3 Copyright (C) 2009-2015 Free Software Foundation, Inc.
5 This file is part of the GNU C Library.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, see
19 <http://www.gnu.org/licenses/>. */
23 #include "ucontext_i.h"
24 #include "ucontext-internal.h"
26 /* int swapcontext (ucontext_t *oucp, const ucontext_t *ucp) */
30 /* Set the value returned when swapcontext() returns in this context. */
31 str xzr, [x0, oX0 + 0 * SZREG]
33 stp x18, x19, [x0, oX0 + 18 * SZREG]
34 stp x20, x21, [x0, oX0 + 20 * SZREG]
35 stp x22, x23, [x0, oX0 + 22 * SZREG]
36 stp x24, x25, [x0, oX0 + 24 * SZREG]
37 stp x26, x27, [x0, oX0 + 26 * SZREG]
38 stp x28, x29, [x0, oX0 + 28 * SZREG]
39 str x30, [x0, oX0 + 30 * SZREG]
44 /* Figure out where to place the first context extension
46 add x2, x0, #oEXTENSION
48 /* Write the context extension fpsimd header. */
49 mov w3, #(FPSIMD_MAGIC & 0xffff)
50 movk w3, #(FPSIMD_MAGIC >> 16), lsl #16
51 str w3, [x2, #oHEAD + oMAGIC]
52 mov w3, #FPSIMD_CONTEXT_SIZE
53 str w3, [x2, #oHEAD + oSIZE]
55 /* Fill in the FP SIMD context. */
56 add x3, x2, #oV0 + 8 * SZVREG
57 stp d8, d9, [x3], #2 * SZVREG
58 stp d10, d11, [x3], #2 * SZVREG
59 stp d12, d13, [x3], #2 * SZVREG
60 stp d14, d15, [x3], #2 * SZVREG
65 str w4, [x3, #oFPSR - oFPSR]
68 str w4, [x3, #oFPCR - oFPSR]
70 /* Write the termination context extension header. */
71 add x2, x2, #FPSIMD_CONTEXT_SIZE
73 str xzr, [x2, #oHEAD + oMAGIC]
74 str xzr, [x2, #oHEAD + oSIZE]
79 /* rt_sigprocmask (SIG_SETMASK, &ucp->uc_sigmask, &oucp->uc_sigmask,
81 /* Grab the signal mask */
82 /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
83 add x2, x0, #UCONTEXT_SIGMASK
87 mov x8, SYS_ify (rt_sigprocmask)
93 bl JUMPTARGET (__setcontext)
98 b C_SYMBOL_NAME(__syscall_error)
99 PSEUDO_END (__swapcontext)
100 weak_alias (__swapcontext, swapcontext)