2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / sparc / sparc64 / getcontext.S
blobe6f5b55d6f0edbc84032a6f48dab4723bc05ac89
1 /* Copyright (C) 1997, 2001 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3    Contributed by Richard Henderson (rth@tamu.edu).
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, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
20 #include <sysdep.h>
21 #include "ucontext_i.h"
23 /* int getcontext(ucontext_t *); */
25 ENTRY(__getcontext)
27         ldx     [%o0 + UC_LINK], %o1    /* Preserve uc_link field, the
28                                            trap clears it.  */
29         ta      0x6e
31         ldx     [%o0 + UC_M_PC], %o2
32         ldx     [%o0 + UC_M_NPC], %o3
33         ldx     [%o0 + __UC_SIGMASK], %o4
34         stx     %o1, [%o0 + UC_LINK]
35         add     %o2, 2f - 1b, %o2
36         stx     %o2, [%o0 + UC_M_PC]
37         add     %o3, 2f - 1b, %o3
38         stx     %o3, [%o0 + UC_M_NPC]
39 #if SIGMASK_WORDS == 16
40         stx     %o4, [%o0 + UC_SIGMASK]
41         stx     %g0, [%o0 + UC_SIGMASK + 8]
42         stx     %g0, [%o0 + UC_SIGMASK + 16]
43         stx     %g0, [%o0 + UC_SIGMASK + 24]
44         stx     %g0, [%o0 + UC_SIGMASK + 32]
45         stx     %g0, [%o0 + UC_SIGMASK + 40]
46         stx     %g0, [%o0 + UC_SIGMASK + 48]
47         stx     %g0, [%o0 + UC_SIGMASK + 56]
48         stx     %g0, [%o0 + UC_SIGMASK + 64]
49         stx     %g0, [%o0 + UC_SIGMASK + 72]
50         stx     %g0, [%o0 + UC_SIGMASK + 80]
51         stx     %g0, [%o0 + UC_SIGMASK + 88]
52         stx     %g0, [%o0 + UC_SIGMASK + 96]
53         stx     %g0, [%o0 + UC_SIGMASK + 104]
54         stx     %g0, [%o0 + UC_SIGMASK + 112]
55         stx     %g0, [%o0 + UC_SIGMASK + 120]
56 #else
57 # error Adjust __getcontext
58 #endif
60         retl
61          clr    %o0
63 END(__getcontext)
65 weak_alias (__getcontext, getcontext)