1 /* Save current context.
2 Copyright (C) 2022-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
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.
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/>. */
19 #include "ucontext-macros.h"
21 /* int getcontext (ucontext_t *ucp) */
25 SAVE_INT_REG (ra, 1, a0)
26 SAVE_INT_REG (sp, 3, a0)
27 SAVE_INT_REG (zero, 4, a0) /* return 0 by overwriting a0. */
28 SAVE_INT_REG (x, 21, a0)
29 SAVE_INT_REG (fp, 22, a0)
30 SAVE_INT_REG (s0, 23, a0)
31 SAVE_INT_REG (s1, 24, a0)
32 SAVE_INT_REG (s2, 25, a0)
33 SAVE_INT_REG (s3, 26, a0)
34 SAVE_INT_REG (s4, 27, a0)
35 SAVE_INT_REG (s5, 28, a0)
36 SAVE_INT_REG (s6, 29, a0)
37 SAVE_INT_REG (s7, 30, a0)
38 SAVE_INT_REG (s8, 31, a0)
39 st.d ra, a0, MCONTEXT_PC
41 /* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
43 li.d a2, UCONTEXT_SIGMASK
48 li.d a7, SYS_ify (rt_sigprocmask)
57 PSEUDO_END (__getcontext)
59 weak_alias (__getcontext, getcontext)