(root)/
glibc-2.38/
sysdeps/
unix/
sysv/
linux/
sparc/
sparc64/
sigcontextinfo.h
       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  #ifndef _SIGCONTEXTINFO_H
      19  #define _SIGCONTEXTINFO_H
      20  
      21  #include <bits/types/siginfo_t.h>
      22  
      23  /* The sparc64 kernel signal frame for SA_SIGINFO is defined as:
      24  
      25     struct rt_signal_frame
      26     {
      27       struct sparc_stackf ss;
      28       siginfo_t info;
      29       struct pt_regs regs;
      30       __siginfo_fpu_t *fpu_save;
      31       stack_t stack;
      32       sigset_t mask;
      33       __siginfo_rwin_t *rwin_save;
      34     };
      35  
      36     Unlike other architectures, sparc64 passe the siginfo_t INFO pointer
      37     as the third argument to a sa_sigaction handler with SA_SIGINFO enabled.  */
      38  
      39  #ifndef STACK_BIAS
      40  #define STACK_BIAS 2047
      41  #endif
      42  
      43  struct pt_regs
      44  {
      45    unsigned long int u_regs[16];
      46    unsigned long int tstate;
      47    unsigned long int tpc;
      48    unsigned long int tnpc;
      49    unsigned int y;
      50    unsigned int magic;
      51  };
      52  
      53  static inline uintptr_t
      54  sigcontext_get_pc (const siginfo_t *ctx)
      55  {
      56    struct pt_regs *regs = (struct pt_regs*) ((siginfo_t *)(ctx) + 1);
      57    return regs->tpc;
      58  }
      59  
      60  #endif