1/* Copyright (C) 1997-2022 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 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. 8 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. 13 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 <https://www.gnu.org/licenses/>. */ 17 18#include <sysdep.h> 19#include "ucontext_i.h" 20 21/* int getcontext(ucontext_t *); */ 22 23ENTRY(__getcontext) 24 25 ldx [%o0 + UC_LINK], %o1 /* Preserve uc_link field, the 26 trap clears it. */ 27 ta 0x6e 281: 29 ldx [%o0 + UC_M_PC], %o2 30 ldx [%o0 + UC_M_NPC], %o3 31 ldx [%o0 + __UC_SIGMASK], %o4 32 stx %o1, [%o0 + UC_LINK] 33 add %o2, 2f - 1b, %o2 34 stx %o2, [%o0 + UC_M_PC] 35 add %o3, 2f - 1b, %o3 36 stx %o3, [%o0 + UC_M_NPC] 37#if SIGMASK_WORDS == 16 38 stx %o4, [%o0 + UC_SIGMASK] 39 stx %g0, [%o0 + UC_SIGMASK + 8] 40 stx %g0, [%o0 + UC_SIGMASK + 16] 41 stx %g0, [%o0 + UC_SIGMASK + 24] 42 stx %g0, [%o0 + UC_SIGMASK + 32] 43 stx %g0, [%o0 + UC_SIGMASK + 40] 44 stx %g0, [%o0 + UC_SIGMASK + 48] 45 stx %g0, [%o0 + UC_SIGMASK + 56] 46 stx %g0, [%o0 + UC_SIGMASK + 64] 47 stx %g0, [%o0 + UC_SIGMASK + 72] 48 stx %g0, [%o0 + UC_SIGMASK + 80] 49 stx %g0, [%o0 + UC_SIGMASK + 88] 50 stx %g0, [%o0 + UC_SIGMASK + 96] 51 stx %g0, [%o0 + UC_SIGMASK + 104] 52 stx %g0, [%o0 + UC_SIGMASK + 112] 53 stx %g0, [%o0 + UC_SIGMASK + 120] 54#else 55# error Adjust __getcontext 56#endif 572: 58 retl 59 clr %o0 60 61END(__getcontext) 62 63weak_alias (__getcontext, getcontext) 64