1 /* Install given context.
2 Copyright (C) 2012-2019 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/>. */
21 #include "ucontext_i.h"
24 /* Load address of the context data structure. */
27 /* Get the current signal mask. Note that we preserve D2/D3 in case
28 the system call fails and we return from the function with an
31 cfi_adjust_cfa_offset (4)
32 cfi_rel_offset (%d3, 0)
34 cfi_adjust_cfa_offset (4)
35 cfi_rel_offset (%d2, 0)
37 lea oSIGMASK(%a0), %a1
39 move.l #SIG_SETMASK, %d1
40 move.l #__NR_sigprocmask, %d0
42 cmp.l #-4095, %d0 /* Check %d0 for error. */
45 cfi_adjust_cfa_offset (-4)
48 cfi_adjust_cfa_offset (-4)
50 jra SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
52 0: /* Load the new stack pointer. */
55 cfi_offset (%d2, oGREGS+2*4)
56 cfi_offset (%d3, oGREGS+3*4)
57 cfi_offset (%d4, oGREGS+4*4)
58 cfi_offset (%d5, oGREGS+5*4)
59 cfi_offset (%d6, oGREGS+6*4)
60 cfi_offset (%d7, oGREGS+7*4)
61 cfi_offset (%a2, oGREGS+10*4)
62 cfi_offset (%a3, oGREGS+11*4)
63 cfi_offset (%a4, oGREGS+12*4)
64 cfi_offset (%a5, oGREGS+13*4)
65 cfi_offset (%a6, oGREGS+14*4)
66 cfi_offset (%fp2, oFP2+0*12)
67 cfi_offset (%fp3, oFP2+1*12)
68 cfi_offset (%fp4, oFP2+2*12)
69 cfi_offset (%fp5, oFP2+3*12)
70 cfi_offset (%fp6, oFP2+4*12)
71 cfi_offset (%fp7, oFP2+5*12)
74 /* Load the values of all the preserved registers (except SP). */
75 movem.l oGREGS+2*4(%a0), %d2-%d7
76 movem.l oGREGS+10*4(%a0), %a2-%a6
77 fmovem.l oFPREGS(%a0), %fpsr/%fpcr/%fpiar
78 fmovem.x oFP2(%a0), %fp2-%fp7
81 /* Fetch the address to return to. */
84 /* End FDE here, we fall into another context. */
87 cfi_register (%pc, %a1)
92 PSEUDO_END(__setcontext)
94 weak_alias (__setcontext, setcontext)