master
 1/* Copyright (C) 1998-2025 Free Software Foundation, Inc.
 2
 3   This file is part of the GNU C Library.
 4
 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.
 9
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.
14
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/>.  */
18
19/* System V/AArch64 ABI compliant context switching support.  */
20
21#ifndef _SYS_UCONTEXT_H
22#define _SYS_UCONTEXT_H	1
23
24#include <features.h>
25
26#include <bits/types/sigset_t.h>
27#include <bits/types/stack_t.h>
28
29#ifdef __USE_MISC
30# define __ctx(fld) fld
31#else
32# define __ctx(fld) __ ## fld
33#endif
34
35#ifdef __USE_MISC
36# include <sys/procfs.h>
37
38
39typedef elf_greg_t greg_t;
40
41/* Container for all general registers.  */
42typedef elf_gregset_t gregset_t;
43
44/* Structure to describe FPU registers.  */
45typedef elf_fpregset_t	fpregset_t;
46#endif
47
48/* Context to describe whole processor state.  This only describes
49   the core registers; coprocessor registers get saved elsewhere
50   (e.g. in uc_regspace, or somewhere unspecified on the stack
51   during non-RT signal handlers).  */
52typedef struct
53  {
54    unsigned long long int __ctx(fault_address);
55    unsigned long long int __ctx(regs)[31];
56    unsigned long long int __ctx(sp);
57    unsigned long long int __ctx(pc);
58    unsigned long long int __ctx(pstate);
59    /* This field contains extension records for additional processor
60       state such as the FP/SIMD state.  It has to match the definition
61       of the corresponding field in the sigcontext struct, see the
62       arch/arm64/include/uapi/asm/sigcontext.h linux header for details.  */
63    unsigned char __reserved[4096] __attribute__ ((__aligned__ (16)));
64  } mcontext_t;
65
66/* Userlevel context.  */
67typedef struct ucontext_t
68  {
69    unsigned long __ctx(uc_flags);
70    struct ucontext_t *uc_link;
71    stack_t uc_stack;
72    sigset_t uc_sigmask;
73    mcontext_t uc_mcontext;
74  } ucontext_t;
75
76#undef __ctx
77
78#endif /* sys/ucontext.h */