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  /* The sparc32 kernel signal frame for SA_SIGINFO is defined as:
      22  
      23    struct rt_signal_frame32
      24    {
      25      struct sparc_stackf32 ss;
      26      compat_siginfo_t info;
      27      struct pt_regs32 regs;          <- void *ctx
      28      compat_sigset_t mask;
      29      u32 fpu_save;
      30      unsigned int insns[2];
      31      compat_stack_t stack;
      32      unsigned int extra_size;
      33      siginfo_extra_v8plus_t v8plus;
      34      u32 rwin_save;
      35    } __attribute__((aligned(8)));
      36  
      37    Unlike other architectures, sparc32 passes pt_regs32 REGS pointer as
      38    the third argument to a sa_sigaction handler with SA_SIGINFO enabled.  */
      39  
      40  struct pt_regs32
      41  {
      42    unsigned int psr;
      43    unsigned int pc;
      44    unsigned int npc;
      45    unsigned int y;
      46    unsigned int u_regs[16];
      47  };
      48  
      49  static inline uintptr_t
      50  sigcontext_get_pc (const struct pt_regs32 *ctx)
      51  {
      52    return ctx->pc;
      53  }
      54  
      55  #endif