aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux/mips/sys/user.h
blob: dc3ee837d3712b5dd31d9aa46cbb08e7890bf1ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _SYS_USER_H
#define _SYS_USER_H	1

#include <sgidefs.h>

/* The whole purpose of this file is for GDB and GDB only.  Don't read
   too much into it.  Don't use it for anything other than GDB unless
   you know what you are doing.  */

/* #include <asm/reg.h> */
/* Instead of including the kernel header, that will vary depending on
   whether the 32- or the 64-bit kernel is installed, we paste its
   contents here.  Note that the fact that the file is inline here,
   instead of included separately, doesn't change in any way the
   licensing status of a program that includes user.h.  Since this is
   for gdb alone, and gdb is GPLed, no surprises here.  */
#if _MIPS_SIM == _MIPS_SIM_ABI32
/*
 * Various register offset definitions for debuggers, core file
 * examiners and whatnot.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1995, 1999 by Ralf Baechle
 */
#ifndef __ASM_MIPS_REG_H
#define __ASM_MIPS_REG_H

/*
 * This defines/structures correspond to the register layout on stack -
 * if the order here is changed, it needs to be updated in
 * include/asm-mips/stackframe.h
 */
#define EF_REG0			6
#define EF_REG1			7
#define EF_REG2			8
#define EF_REG3			9
#define EF_REG4			10
#define EF_REG5			11
#define EF_REG6			12
#define EF_REG7			13
#define EF_REG8			14
#define EF_REG9			15
#define EF_REG10		16
#define EF_REG11		17
#define EF_REG12		18
#define EF_REG13		19
#define EF_REG14		20
#define EF_REG15		21
#define EF_REG16		22
#define EF_REG17		23
#define EF_REG18		24
#define EF_REG19		25
#define EF_REG20		26
#define EF_REG21		27
#define EF_REG22		28
#define EF_REG23		29
#define EF_REG24		30
#define EF_REG25		31
/*
 * k0/k1 unsaved
 */
#define EF_REG28		34
#define EF_REG29		35
#define EF_REG30		36
#define EF_REG31		37

/*
 * Saved special registers
 */
#define EF_LO			38
#define EF_HI			39

#define EF_CP0_EPC		40
#define EF_CP0_BADVADDR		41
#define EF_CP0_STATUS		42
#define EF_CP0_CAUSE		43

#define EF_SIZE			180	/* size in bytes */

#endif /* __ASM_MIPS_REG_H */

#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */

/*
 * Various register offset definitions for debuggers, core file
 * examiners and whatnot.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1995, 1999 Ralf Baechle
 * Copyright (C) 1995, 1999 Silicon Graphics
 */
#ifndef _ASM_REG_H
#define _ASM_REG_H

/*
 * This defines/structures correspond to the register layout on stack -
 * if the order here is changed, it needs to be updated in
 * include/asm-mips/stackframe.h
 */
#define EF_REG0			 0
#define EF_REG1			 1
#define EF_REG2			 2
#define EF_REG3			 3
#define EF_REG4			 4
#define EF_REG5			 5
#define EF_REG6			 6
#define EF_REG7			 7
#define EF_REG8			 8
#define EF_REG9			 9
#define EF_REG10		10
#define EF_REG11		11
#define EF_REG12		12
#define EF_REG13		13
#define EF_REG14		14
#define EF_REG15		15
#define EF_REG16		16
#define EF_REG17		17
#define EF_REG18		18
#define EF_REG19		19
#define EF_REG20		20
#define EF_REG21		21
#define EF_REG22		22
#define EF_REG23		23
#define EF_REG24		24
#define EF_REG25		25
/*
 * k0/k1 unsaved
 */
#define EF_REG28		28
#define EF_REG29		29
#define EF_REG30		30
#define EF_REG31		31

/*
 * Saved special registers
 */
#define EF_LO			32
#define EF_HI			33

#define EF_CP0_EPC		34
#define EF_CP0_BADVADDR		35
#define EF_CP0_STATUS		36
#define EF_CP0_CAUSE		37

#define EF_SIZE			304	/* size in bytes */

#endif /* _ASM_REG_H */

#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */

#if _MIPS_SIM == _MIPS_SIM_ABI32

struct user
{
  unsigned long	regs[EF_SIZE/4+64];	/* integer and fp regs */
  size_t	u_tsize;		/* text size (pages) */
  size_t	u_dsize;		/* data size (pages) */
  size_t	u_ssize;		/* stack size (pages) */
  unsigned long	start_code;		/* text starting address */
  unsigned long	start_data;		/* data starting address */
  unsigned long	start_stack;		/* stack starting address */
  long int	signal;			/* signal causing core dump */
  void*		u_ar0;			/* help gdb find registers */
  unsigned long	magic;			/* identifies a core file */
  char		u_comm[32];		/* user command name */
};

#else

struct user {
  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
  __extension__ unsigned long	u_tsize;	/* text size (pages) */
  __extension__ unsigned long	u_dsize;	/* data size (pages) */
  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
  __extension__ unsigned long long start_code;	/* text starting address */
  __extension__ unsigned long long start_data;	/* data starting address */
  __extension__ unsigned long long start_stack;	/* stack starting address */
  __extension__ long long	signal;		/* signal causing core dump */
  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
  __extension__ unsigned long long magic;	/* identifies a core file */
  char		u_comm[32];		/* user command name */
};

#endif

#define PAGE_SHIFT		12
#define PAGE_SIZE		(1UL << PAGE_SHIFT)
#define PAGE_MASK		(~(PAGE_SIZE-1))
#define NBPG			PAGE_SIZE
#define UPAGES			1
#define HOST_TEXT_START_ADDR	(u.start_code)
#define HOST_DATA_START_ADDR	(u.start_data)
#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)

#endif	/* _SYS_USER_H */