|
Packit |
6c4009 |
/* Save current context.
|
|
Packit |
6c4009 |
Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
|
Packit |
6c4009 |
This file is part of the GNU C Library.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is free software; you can redistribute it and/or
|
|
Packit |
6c4009 |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License as published by the Free Software Foundation; either
|
|
Packit |
6c4009 |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
The GNU C Library is distributed in the hope that it will be useful,
|
|
Packit |
6c4009 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6c4009 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6c4009 |
Lesser General Public License for more details.
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6c4009 |
License along with the GNU C Library; if not, see
|
|
Packit |
6c4009 |
<http://www.gnu.org/licenses/>. */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <sysdep.h>
|
|
Packit |
6c4009 |
#include <rtld-global-offsets.h>
|
|
Packit |
6c4009 |
#include <shlib-compat.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __ASSEMBLY__
|
|
Packit |
6c4009 |
#include <asm/ptrace.h>
|
|
Packit |
6c4009 |
#include "ucontext_i.h"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#define __CONTEXT_FUNC_NAME __getcontext
|
|
Packit |
6c4009 |
#define __CONTEXT_ENABLE_FPRS 1
|
|
Packit |
6c4009 |
#define __CONTEXT_ENABLE_VRS 1
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/* Size of ucontext in GLIBC_2.3.4 and later. */
|
|
Packit |
6c4009 |
#define _UC_SIZE_2_3_4 1184
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.section ".text";
|
|
Packit |
6c4009 |
ENTRY (__getcontext)
|
|
Packit |
6c4009 |
li r4,0
|
|
Packit |
6c4009 |
li r5,_UC_SIZE_2_3_4;
|
|
Packit |
6c4009 |
DO_CALL (SYS_ify (swapcontext));
|
|
Packit |
6c4009 |
bso- cr0,1f
|
|
Packit |
6c4009 |
/* the kernel does not set the return code for the success case */
|
|
Packit |
6c4009 |
li r3,0
|
|
Packit |
6c4009 |
blr
|
|
Packit |
6c4009 |
1:
|
|
Packit |
6c4009 |
b __syscall_error@local
|
|
Packit |
6c4009 |
END(__getcontext)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
versioned_symbol (libc, __getcontext, getcontext, GLIBC_2_3_4)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
|
Packit |
6c4009 |
compat_text_section
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# undef __CONTEXT_FUNC_NAME
|
|
Packit |
6c4009 |
# define __CONTEXT_FUNC_NAME __novec_getcontext
|
|
Packit |
6c4009 |
# undef __CONTEXT_ENABLE_VRS
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# include "getcontext-common.S"
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
.previous
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
compat_symbol (libc, __novec_getcontext, getcontext, GLIBC_2_3_3)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_3_3)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
# define _ERRNO_H 1
|
|
Packit |
6c4009 |
# include <bits/errno.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
compat_text_section
|
|
Packit |
6c4009 |
ENTRY (__getcontext_stub)
|
|
Packit |
6c4009 |
li r3,ENOSYS
|
|
Packit |
6c4009 |
b __syscall_error@local
|
|
Packit |
6c4009 |
END (__getcontext_stub)
|
|
Packit |
6c4009 |
.previous
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
compat_symbol (libc, __getcontext_stub, getcontext, GLIBC_2_1)
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#endif
|