1  /* Copyright (C) 1999-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  /* Where is System V/SH ABI?  */
      19  
      20  #ifndef _SYS_UCONTEXT_H
      21  #define _SYS_UCONTEXT_H	1
      22  
      23  #include <features.h>
      24  
      25  #include <bits/types/sigset_t.h>
      26  #include <bits/types/stack_t.h>
      27  
      28  
      29  typedef int greg_t;
      30  
      31  /* Number of general registers.  */
      32  #define __NGREG	16
      33  #ifdef __USE_MISC
      34  # define NGREG	__NGREG
      35  #endif
      36  
      37  /* Container for all general registers.  */
      38  typedef greg_t gregset_t[__NGREG];
      39  
      40  #ifdef __USE_MISC
      41  /* Number of each register is the `gregset_t' array.  */
      42  enum
      43  {
      44    REG_R0 = 0,
      45  # define REG_R0	REG_R0
      46    REG_R1 = 1,
      47  # define REG_R1	REG_R1
      48    REG_R2 = 2,
      49  # define REG_R2	REG_R2
      50    REG_R3 = 3,
      51  # define REG_R3	REG_R3
      52    REG_R4 = 4,
      53  # define REG_R4	REG_R4
      54    REG_R5 = 5,
      55  # define REG_R5	REG_R5
      56    REG_R6 = 6,
      57  # define REG_R6	REG_R6
      58    REG_R7 = 7,
      59  # define REG_R7	REG_R7
      60    REG_R8 = 8,
      61  # define REG_R8	REG_R8
      62    REG_R9 = 9,
      63  # define REG_R9	REG_R9
      64    REG_R10 = 10,
      65  # define REG_R10	REG_R10
      66    REG_R11 = 11,
      67  # define REG_R11	REG_R11
      68    REG_R12 = 12,
      69  # define REG_R12	REG_R12
      70    REG_R13 = 13,
      71  # define REG_R13	REG_R13
      72    REG_R14 = 14,
      73  # define REG_R14	REG_R14
      74    REG_R15 = 15,
      75  # define REG_R15	REG_R15
      76  };
      77  #endif
      78  
      79  typedef int freg_t;
      80  
      81  /* Number of FPU registers.  */
      82  #define __NFPREG	16
      83  #ifdef __USE_MISC
      84  # define NFPREG	__NFPREG
      85  #endif
      86  
      87  /* Structure to describe FPU registers.  */
      88  typedef freg_t fpregset_t[__NFPREG];
      89  
      90  #ifdef __USE_MISC
      91  # define __ctx(fld) fld
      92  #else
      93  # define __ctx(fld) __ ## fld
      94  #endif
      95  
      96  /* Context to describe whole processor state.  */
      97  typedef struct
      98    {
      99      unsigned int __ctx(oldmask);
     100      gregset_t __ctx(gregs);
     101      unsigned int __ctx(pc);
     102      unsigned int __ctx(pr);
     103      unsigned int __ctx(sr);
     104      unsigned int __ctx(gbr);
     105      unsigned int __ctx(mach);
     106      unsigned int __ctx(macl);
     107      fpregset_t __ctx(fpregs);
     108      fpregset_t __ctx(xfpregs);
     109      unsigned int __ctx(fpscr);
     110      unsigned int __ctx(fpul);
     111      unsigned int __ctx(ownedfp);
     112    } mcontext_t;
     113  
     114  /* Userlevel context.  */
     115  typedef struct ucontext_t
     116    {
     117      unsigned long int __ctx(uc_flags);
     118      struct ucontext_t *uc_link;
     119      stack_t uc_stack;
     120      mcontext_t uc_mcontext;
     121      sigset_t uc_sigmask;
     122    } ucontext_t;
     123  
     124  #undef __ctx
     125  
     126  #endif /* sys/ucontext.h */