xref: /openbmc/linux/arch/powerpc/include/asm/user.h (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2b8b572e1SStephen Rothwell #ifndef _ASM_POWERPC_USER_H
3b8b572e1SStephen Rothwell #define _ASM_POWERPC_USER_H
4b8b572e1SStephen Rothwell 
5b8b572e1SStephen Rothwell #include <asm/ptrace.h>
6b8b572e1SStephen Rothwell #include <asm/page.h>
7b8b572e1SStephen Rothwell 
8b8b572e1SStephen Rothwell /*
9b8b572e1SStephen Rothwell  * Adapted from <asm-alpha/user.h>
10b8b572e1SStephen Rothwell  *
11b8b572e1SStephen Rothwell  * Core file format: The core file is written in such a way that gdb
12b8b572e1SStephen Rothwell  * can understand it and provide useful information to the user (under
13b8b572e1SStephen Rothwell  * linux we use the `trad-core' bfd, NOT the osf-core).  The file contents
14b8b572e1SStephen Rothwell  * are as follows:
15b8b572e1SStephen Rothwell  *
16b8b572e1SStephen Rothwell  *  upage: 1 page consisting of a user struct that tells gdb
17b8b572e1SStephen Rothwell  *	what is present in the file.  Directly after this is a
18b8b572e1SStephen Rothwell  *	copy of the task_struct, which is currently not used by gdb,
19b8b572e1SStephen Rothwell  *	but it may come in handy at some point.  All of the registers
20b8b572e1SStephen Rothwell  *	are stored as part of the upage.  The upage should always be
21b8b572e1SStephen Rothwell  *	only one page long.
22b8b572e1SStephen Rothwell  *  data: The data segment follows next.  We use current->end_text to
23b8b572e1SStephen Rothwell  *	current->brk to pick up all of the user variables, plus any memory
24b8b572e1SStephen Rothwell  *	that may have been sbrk'ed.  No attempt is made to determine if a
25b8b572e1SStephen Rothwell  *	page is demand-zero or if a page is totally unused, we just cover
26b8b572e1SStephen Rothwell  *	the entire range.  All of the addresses are rounded in such a way
27b8b572e1SStephen Rothwell  *	that an integral number of pages is written.
28b8b572e1SStephen Rothwell  *  stack: We need the stack information in order to get a meaningful
29b8b572e1SStephen Rothwell  *	backtrace.  We need to write the data from usp to
30b8b572e1SStephen Rothwell  *	current->start_stack, so we round each of these in order to be able
31b8b572e1SStephen Rothwell  *	to write an integer number of pages.
32b8b572e1SStephen Rothwell  */
33b8b572e1SStephen Rothwell struct user {
34*6ce7bff0SMichael Ellerman 	struct user_pt_regs regs;		/* entire machine state */
35b8b572e1SStephen Rothwell 	size_t		u_tsize;		/* text size (pages) */
36b8b572e1SStephen Rothwell 	size_t		u_dsize;		/* data size (pages) */
37b8b572e1SStephen Rothwell 	size_t		u_ssize;		/* stack size (pages) */
38b8b572e1SStephen Rothwell 	unsigned long	start_code;		/* text starting address */
39b8b572e1SStephen Rothwell 	unsigned long	start_data;		/* data starting address */
40b8b572e1SStephen Rothwell 	unsigned long	start_stack;		/* stack starting address */
41b8b572e1SStephen Rothwell 	long int	signal;			/* signal causing core dump */
42b8b572e1SStephen Rothwell 	unsigned long	u_ar0;			/* help gdb find registers */
43b8b572e1SStephen Rothwell 	unsigned long	magic;			/* identifies a core file */
44b8b572e1SStephen Rothwell 	char		u_comm[32];		/* user command name */
45b8b572e1SStephen Rothwell };
46b8b572e1SStephen Rothwell 
47b8b572e1SStephen Rothwell #endif	/* _ASM_POWERPC_USER_H */
48