1  /* Copyright (C) 2002-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_USER_H
      19  #define _SYS_USER_H	1
      20  
      21  #include <sgidefs.h>
      22  #include <stddef.h>
      23  
      24  /* The whole purpose of this file is for GDB and GDB only.  Don't read
      25     too much into it.  Don't use it for anything other than GDB unless
      26     you know what you are doing.  */
      27  
      28  /* #include <asm/reg.h> */
      29  /* Instead of including the kernel header, that will vary depending on
      30     whether the 32- or the 64-bit kernel is installed, we paste its
      31     contents here.  Note that the fact that the file is inline here,
      32     instead of included separately, doesn't change in any way the
      33     licensing status of a program that includes user.h.  Since this is
      34     for gdb alone, and gdb is GPLed, no surprises here.  */
      35  #if _MIPS_SIM == _ABIO32
      36  /*
      37   * Various register offset definitions for debuggers, core file
      38   * examiners and whatnot.
      39   *
      40   * This file is subject to the terms and conditions of the GNU General Public
      41   * License.  See the file "COPYING" in the main directory of this archive
      42   * for more details.
      43   *
      44   * Copyright (C) 1995, 1999 by Ralf Baechle
      45   */
      46  #ifndef __ASM_MIPS_REG_H
      47  #define __ASM_MIPS_REG_H
      48  
      49  /*
      50   * This defines/structures correspond to the register layout on stack -
      51   * if the order here is changed, it needs to be updated in
      52   * include/asm-mips/stackframe.h
      53   */
      54  #define EF_REG0			6
      55  #define EF_REG1			7
      56  #define EF_REG2			8
      57  #define EF_REG3			9
      58  #define EF_REG4			10
      59  #define EF_REG5			11
      60  #define EF_REG6			12
      61  #define EF_REG7			13
      62  #define EF_REG8			14
      63  #define EF_REG9			15
      64  #define EF_REG10		16
      65  #define EF_REG11		17
      66  #define EF_REG12		18
      67  #define EF_REG13		19
      68  #define EF_REG14		20
      69  #define EF_REG15		21
      70  #define EF_REG16		22
      71  #define EF_REG17		23
      72  #define EF_REG18		24
      73  #define EF_REG19		25
      74  #define EF_REG20		26
      75  #define EF_REG21		27
      76  #define EF_REG22		28
      77  #define EF_REG23		29
      78  #define EF_REG24		30
      79  #define EF_REG25		31
      80  /*
      81   * k0/k1 unsaved
      82   */
      83  #define EF_REG28		34
      84  #define EF_REG29		35
      85  #define EF_REG30		36
      86  #define EF_REG31		37
      87  
      88  /*
      89   * Saved special registers
      90   */
      91  #define EF_LO			38
      92  #define EF_HI			39
      93  
      94  #define EF_CP0_EPC		40
      95  #define EF_CP0_BADVADDR		41
      96  #define EF_CP0_STATUS		42
      97  #define EF_CP0_CAUSE		43
      98  
      99  #define EF_SIZE			180	/* size in bytes */
     100  
     101  #endif /* __ASM_MIPS_REG_H */
     102  
     103  #else /* _MIPS_SIM != _ABIO32 */
     104  
     105  /*
     106   * Various register offset definitions for debuggers, core file
     107   * examiners and whatnot.
     108   *
     109   * This file is subject to the terms and conditions of the GNU General Public
     110   * License.  See the file "COPYING" in the main directory of this archive
     111   * for more details.
     112   *
     113   * Copyright (C) 1995, 1999 Ralf Baechle
     114   * Copyright (C) 1995, 1999 Silicon Graphics
     115   */
     116  #ifndef _ASM_REG_H
     117  #define _ASM_REG_H
     118  
     119  /*
     120   * This defines/structures correspond to the register layout on stack -
     121   * if the order here is changed, it needs to be updated in
     122   * include/asm-mips/stackframe.h
     123   */
     124  #define EF_REG0			 0
     125  #define EF_REG1			 1
     126  #define EF_REG2			 2
     127  #define EF_REG3			 3
     128  #define EF_REG4			 4
     129  #define EF_REG5			 5
     130  #define EF_REG6			 6
     131  #define EF_REG7			 7
     132  #define EF_REG8			 8
     133  #define EF_REG9			 9
     134  #define EF_REG10		10
     135  #define EF_REG11		11
     136  #define EF_REG12		12
     137  #define EF_REG13		13
     138  #define EF_REG14		14
     139  #define EF_REG15		15
     140  #define EF_REG16		16
     141  #define EF_REG17		17
     142  #define EF_REG18		18
     143  #define EF_REG19		19
     144  #define EF_REG20		20
     145  #define EF_REG21		21
     146  #define EF_REG22		22
     147  #define EF_REG23		23
     148  #define EF_REG24		24
     149  #define EF_REG25		25
     150  /*
     151   * k0/k1 unsaved
     152   */
     153  #define EF_REG28		28
     154  #define EF_REG29		29
     155  #define EF_REG30		30
     156  #define EF_REG31		31
     157  
     158  /*
     159   * Saved special registers
     160   */
     161  #define EF_LO			32
     162  #define EF_HI			33
     163  
     164  #define EF_CP0_EPC		34
     165  #define EF_CP0_BADVADDR		35
     166  #define EF_CP0_STATUS		36
     167  #define EF_CP0_CAUSE		37
     168  
     169  #define EF_SIZE			304	/* size in bytes */
     170  
     171  #endif /* _ASM_REG_H */
     172  
     173  #endif /* _MIPS_SIM != _ABIO32 */
     174  
     175  #if _MIPS_SIM == _ABIO32
     176  
     177  struct user
     178  {
     179    unsigned long	regs[EF_SIZE/4+64];	/* integer and fp regs */
     180    size_t	u_tsize;		/* text size (pages) */
     181    size_t	u_dsize;		/* data size (pages) */
     182    size_t	u_ssize;		/* stack size (pages) */
     183    unsigned long	start_code;		/* text starting address */
     184    unsigned long	start_data;		/* data starting address */
     185    unsigned long	start_stack;		/* stack starting address */
     186    long int	signal;			/* signal causing core dump */
     187    void*		u_ar0;			/* help gdb find registers */
     188    unsigned long	magic;			/* identifies a core file */
     189    char		u_comm[32];		/* user command name */
     190  };
     191  
     192  #else
     193  
     194  struct user {
     195    __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
     196    __extension__ unsigned long	u_tsize;	/* text size (pages) */
     197    __extension__ unsigned long	u_dsize;	/* data size (pages) */
     198    __extension__ unsigned long	u_ssize;	/* stack size (pages) */
     199    __extension__ unsigned long long start_code;	/* text starting address */
     200    __extension__ unsigned long long start_data;	/* data starting address */
     201    __extension__ unsigned long long start_stack;	/* stack starting address */
     202    __extension__ long long	signal;		/* signal causing core dump */
     203    __extension__ unsigned long long u_ar0;	/* help gdb find registers */
     204    __extension__ unsigned long long magic;	/* identifies a core file */
     205    char		u_comm[32];		/* user command name */
     206  };
     207  
     208  #endif
     209  
     210  #endif	/* _SYS_USER_H */