1  /* Copyright (C) 1998-2023 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  #ifndef _SYS_UCONTEXT_H
      19  #define _SYS_UCONTEXT_H	1
      20  
      21  #include <features.h>
      22  
      23  #include <bits/types/sigset_t.h>
      24  #include <bits/types/stack_t.h>
      25  
      26  
      27  #ifdef __USE_MISC
      28  # define __ctx(fld) fld
      29  #else
      30  # define __ctx(fld) __ ## fld
      31  #endif
      32  
      33  /* Type for general register.  */
      34  typedef long int greg_t;
      35  
      36  /* Number of general registers.  */
      37  #define __NGREG	33
      38  #ifdef __USE_MISC
      39  # define NGREG	__NGREG
      40  #endif
      41  
      42  /* Container for all general registers.  */
      43  typedef greg_t gregset_t[__NGREG];
      44  
      45  /* Type for floating-point register.  */
      46  typedef long int fpreg_t;
      47  
      48  /* Number of general registers.  */
      49  #define __NFPREG	32
      50  #ifdef __USE_MISC
      51  # define NFPREG	__NFPREG
      52  #endif
      53  
      54  /* Container for all general registers.  */
      55  typedef fpreg_t fpregset_t[__NFPREG];
      56  
      57  
      58  /* A machine context is exactly a sigcontext.  */
      59  typedef struct
      60    {
      61      long int __ctx(sc_onstack);
      62      long int __ctx(sc_mask);
      63      long int __ctx(sc_pc);
      64      long int __ctx(sc_ps);
      65      long int __ctx(sc_regs)[32];
      66      long int __ctx(sc_ownedfp);
      67      long int __ctx(sc_fpregs)[32];
      68      unsigned long int __ctx(sc_fpcr);
      69      unsigned long int __ctx(sc_fp_control);
      70      unsigned long int __glibc_reserved1, __glibc_reserved2;
      71      unsigned long int __ctx(sc_ssize);
      72      char *__ctx(sc_sbase);
      73      unsigned long int __ctx(sc_traparg_a0);
      74      unsigned long int __ctx(sc_traparg_a1);
      75      unsigned long int __ctx(sc_traparg_a2);
      76      unsigned long int __ctx(sc_fp_trap_pc);
      77      unsigned long int __ctx(sc_fp_trigger_sum);
      78      unsigned long int __ctx(sc_fp_trigger_inst);
      79    } mcontext_t;
      80  
      81  /* Userlevel context.  */
      82  typedef struct ucontext_t
      83    {
      84      unsigned long int __ctx(uc_flags);
      85      struct ucontext_t *uc_link;
      86      unsigned long __uc_osf_sigmask;
      87      stack_t uc_stack;
      88      mcontext_t uc_mcontext;
      89      sigset_t uc_sigmask;
      90    } ucontext_t;
      91  
      92  #undef __ctx
      93  
      94  #endif /* sys/ucontext.h */