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