Back to index

glibc  2.9
user.h
Go to the documentation of this file.
00001 /* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_USER_H
00020 #define _SYS_USER_H  1
00021 
00022 #include <sgidefs.h>
00023 
00024 /* The whole purpose of this file is for GDB and GDB only.  Don't read
00025    too much into it.  Don't use it for anything other than GDB unless
00026    you know what you are doing.  */
00027 
00028 /* #include <asm/reg.h> */
00029 /* Instead of including the kernel header, that will vary depending on
00030    whether the 32- or the 64-bit kernel is installed, we paste its
00031    contents here.  Note that the fact that the file is inline here,
00032    instead of included separately, doesn't change in any way the
00033    licensing status of a program that includes user.h.  Since this is
00034    for gdb alone, and gdb is GPLed, no surprises here.  */
00035 #if _MIPS_SIM == _ABIO32
00036 /*
00037  * Various register offset definitions for debuggers, core file
00038  * examiners and whatnot.
00039  *
00040  * This file is subject to the terms and conditions of the GNU General Public
00041  * License.  See the file "COPYING" in the main directory of this archive
00042  * for more details.
00043  *
00044  * Copyright (C) 1995, 1999 by Ralf Baechle
00045  */
00046 #ifndef __ASM_MIPS_REG_H
00047 #define __ASM_MIPS_REG_H
00048 
00049 /*
00050  * This defines/structures correspond to the register layout on stack -
00051  * if the order here is changed, it needs to be updated in
00052  * include/asm-mips/stackframe.h
00053  */
00054 #define EF_REG0                    6
00055 #define EF_REG1                    7
00056 #define EF_REG2                    8
00057 #define EF_REG3                    9
00058 #define EF_REG4                    10
00059 #define EF_REG5                    11
00060 #define EF_REG6                    12
00061 #define EF_REG7                    13
00062 #define EF_REG8                    14
00063 #define EF_REG9                    15
00064 #define EF_REG10            16
00065 #define EF_REG11            17
00066 #define EF_REG12            18
00067 #define EF_REG13            19
00068 #define EF_REG14            20
00069 #define EF_REG15            21
00070 #define EF_REG16            22
00071 #define EF_REG17            23
00072 #define EF_REG18            24
00073 #define EF_REG19            25
00074 #define EF_REG20            26
00075 #define EF_REG21            27
00076 #define EF_REG22            28
00077 #define EF_REG23            29
00078 #define EF_REG24            30
00079 #define EF_REG25            31
00080 /*
00081  * k0/k1 unsaved
00082  */
00083 #define EF_REG28            34
00084 #define EF_REG29            35
00085 #define EF_REG30            36
00086 #define EF_REG31            37
00087 
00088 /*
00089  * Saved special registers
00090  */
00091 #define EF_LO               38
00092 #define EF_HI               39
00093 
00094 #define EF_CP0_EPC          40
00095 #define EF_CP0_BADVADDR            41
00096 #define EF_CP0_STATUS              42
00097 #define EF_CP0_CAUSE        43
00098 
00099 #define EF_SIZE                    180    /* size in bytes */
00100 
00101 #endif /* __ASM_MIPS_REG_H */
00102 
00103 #else /* _MIPS_SIM != _ABIO32 */
00104 
00105 /*
00106  * Various register offset definitions for debuggers, core file
00107  * examiners and whatnot.
00108  *
00109  * This file is subject to the terms and conditions of the GNU General Public
00110  * License.  See the file "COPYING" in the main directory of this archive
00111  * for more details.
00112  *
00113  * Copyright (C) 1995, 1999 Ralf Baechle
00114  * Copyright (C) 1995, 1999 Silicon Graphics
00115  */
00116 #ifndef _ASM_REG_H
00117 #define _ASM_REG_H
00118 
00119 /*
00120  * This defines/structures correspond to the register layout on stack -
00121  * if the order here is changed, it needs to be updated in
00122  * include/asm-mips/stackframe.h
00123  */
00124 #define EF_REG0                     0
00125 #define EF_REG1                     1
00126 #define EF_REG2                     2
00127 #define EF_REG3                     3
00128 #define EF_REG4                     4
00129 #define EF_REG5                     5
00130 #define EF_REG6                     6
00131 #define EF_REG7                     7
00132 #define EF_REG8                     8
00133 #define EF_REG9                     9
00134 #define EF_REG10            10
00135 #define EF_REG11            11
00136 #define EF_REG12            12
00137 #define EF_REG13            13
00138 #define EF_REG14            14
00139 #define EF_REG15            15
00140 #define EF_REG16            16
00141 #define EF_REG17            17
00142 #define EF_REG18            18
00143 #define EF_REG19            19
00144 #define EF_REG20            20
00145 #define EF_REG21            21
00146 #define EF_REG22            22
00147 #define EF_REG23            23
00148 #define EF_REG24            24
00149 #define EF_REG25            25
00150 /*
00151  * k0/k1 unsaved
00152  */
00153 #define EF_REG28            28
00154 #define EF_REG29            29
00155 #define EF_REG30            30
00156 #define EF_REG31            31
00157 
00158 /*
00159  * Saved special registers
00160  */
00161 #define EF_LO               32
00162 #define EF_HI               33
00163 
00164 #define EF_CP0_EPC          34
00165 #define EF_CP0_BADVADDR            35
00166 #define EF_CP0_STATUS              36
00167 #define EF_CP0_CAUSE        37
00168 
00169 #define EF_SIZE                    304    /* size in bytes */
00170 
00171 #endif /* _ASM_REG_H */
00172 
00173 #endif /* _MIPS_SIM != _ABIO32 */
00174 
00175 #if _MIPS_SIM == _ABIO32
00176 
00177 struct user
00178 {
00179   unsigned long      regs[EF_SIZE/4+64];  /* integer and fp regs */
00180   size_t      u_tsize;             /* text size (pages) */
00181   size_t      u_dsize;             /* data size (pages) */
00182   size_t      u_ssize;             /* stack size (pages) */
00183   unsigned long      start_code;          /* text starting address */
00184   unsigned long      start_data;          /* data starting address */
00185   unsigned long      start_stack;         /* stack starting address */
00186   long int    signal;                     /* signal causing core dump */
00187   void*              u_ar0;               /* help gdb find registers */
00188   unsigned long      magic;               /* identifies a core file */
00189   char        u_comm[32];          /* user command name */
00190 };
00191 
00192 #else
00193 
00194 struct user {
00195   __extension__ unsigned long      regs[EF_SIZE/8+64]; /* integer and fp regs */
00196   __extension__ unsigned long      u_tsize;      /* text size (pages) */
00197   __extension__ unsigned long      u_dsize;      /* data size (pages) */
00198   __extension__ unsigned long      u_ssize;      /* stack size (pages) */
00199   __extension__ unsigned long long start_code;   /* text starting address */
00200   __extension__ unsigned long long start_data;   /* data starting address */
00201   __extension__ unsigned long long start_stack;  /* stack starting address */
00202   __extension__ long long   signal;              /* signal causing core dump */
00203   __extension__ unsigned long long u_ar0; /* help gdb find registers */
00204   __extension__ unsigned long long magic; /* identifies a core file */
00205   char        u_comm[32];          /* user command name */
00206 };
00207 
00208 #endif
00209 
00210 #define PAGE_SHIFT          12
00211 #define PAGE_SIZE           (1UL << PAGE_SHIFT)
00212 #define PAGE_MASK           (~(PAGE_SIZE-1))
00213 #define NBPG                PAGE_SIZE
00214 #define UPAGES                     1
00215 #define HOST_TEXT_START_ADDR       (u.start_code)
00216 #define HOST_DATA_START_ADDR       (u.start_data)
00217 #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
00218 
00219 #endif /* _SYS_USER_H */