|
Packit Service |
82fcde |
/* Save current context.
|
|
Packit Service |
82fcde |
Copyright (C) 2015-2018 Free Software Foundation, Inc.
|
|
Packit Service |
82fcde |
This file is part of the GNU C Library.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit Service |
82fcde |
modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License as published by the Free Software Foundation; either
|
|
Packit Service |
82fcde |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit Service |
82fcde |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
82fcde |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
82fcde |
Lesser General Public License for more details.
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
82fcde |
License along with the GNU C Library; if not, see
|
|
Packit Service |
82fcde |
<http://www.gnu.org/licenses/>. */
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#include <sysdep.h>
|
|
Packit Service |
82fcde |
#include "ucontext_i.h"
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* int getcontext (ucontext_t *ucp)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
Returns 0 on success -1 and errno on failure.
|
|
Packit Service |
82fcde |
*/
|
|
Packit Service |
82fcde |
.text
|
|
Packit Service |
82fcde |
ENTRY(__getcontext)
|
|
Packit Service |
82fcde |
stw r16, (UCONTEXT_MCONTEXT + 16*4)(r4)
|
|
Packit Service |
82fcde |
stw r17, (UCONTEXT_MCONTEXT + 17*4)(r4)
|
|
Packit Service |
82fcde |
stw r18, (UCONTEXT_MCONTEXT + 18*4)(r4)
|
|
Packit Service |
82fcde |
stw r19, (UCONTEXT_MCONTEXT + 19*4)(r4)
|
|
Packit Service |
82fcde |
stw r20, (UCONTEXT_MCONTEXT + 20*4)(r4)
|
|
Packit Service |
82fcde |
stw r21, (UCONTEXT_MCONTEXT + 21*4)(r4)
|
|
Packit Service |
82fcde |
stw r22, (UCONTEXT_MCONTEXT + 22*4)(r4)
|
|
Packit Service |
82fcde |
stw ra, (UCONTEXT_MCONTEXT + 24*4)(r4)
|
|
Packit Service |
82fcde |
stw fp, (UCONTEXT_MCONTEXT + 25*4)(r4)
|
|
Packit Service |
82fcde |
stw gp, (UCONTEXT_MCONTEXT + 26*4)(r4)
|
|
Packit Service |
82fcde |
/* Store return address at place for EA. */
|
|
Packit Service |
82fcde |
stw ra, (UCONTEXT_MCONTEXT + 28*4)(r4)
|
|
Packit Service |
82fcde |
stw sp, (UCONTEXT_MCONTEXT + 29*4)(r4)
|
|
Packit Service |
82fcde |
/* Store zero for return success. */
|
|
Packit Service |
82fcde |
stw zero, (UCONTEXT_MCONTEXT + 2*4)(r4)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Store value "1" at uc_flags to recognize as getcontext created. */
|
|
Packit Service |
82fcde |
movi r2, 1
|
|
Packit Service |
82fcde |
stw r2, UCONTEXT_FLAGS(r4)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Store MCONTEXT_VERSION at first word of mcontext_t. */
|
|
Packit Service |
82fcde |
movi r2, MCONTEXT_VERSION
|
|
Packit Service |
82fcde |
stw r2, UCONTEXT_MCONTEXT(r4)
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
/* Get signal mask. */
|
|
Packit Service |
82fcde |
/* rt_sigprocmask (SIG_BLOCK, NULL, &ucp->uc_sigmask, _NSIG8) */
|
|
Packit Service |
82fcde |
movi r7, _NSIG8
|
|
Packit Service |
82fcde |
addi r6, r4, UCONTEXT_SIGMASK
|
|
Packit Service |
82fcde |
mov r5, zero
|
|
Packit Service |
82fcde |
movi r4, SIG_BLOCK
|
|
Packit Service |
82fcde |
movi r2, SYS_ify (rt_sigprocmask)
|
|
Packit Service |
82fcde |
trap
|
|
Packit Service |
82fcde |
bne r7, zero, SYSCALL_ERROR_LABEL
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
mov r2, zero
|
|
Packit Service |
82fcde |
ret
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
PSEUDO_END(__getcontext)
|
|
Packit Service |
82fcde |
weak_alias(__getcontext, getcontext)
|