1#ifndef __ASM_CRIS_USER_H
2#define __ASM_CRIS_USER_H
3
4#include <linux/types.h>
5#include <asm/ptrace.h>
6#include <asm/page.h>
7
8/*
9 * Core file format: The core file is written in such a way that gdb
10 * can understand it and provide useful information to the user (under
11 * linux we use the `trad-core' bfd).  The file contents are as follows:
12 *
13 *  upage: 1 page consisting of a user struct that tells gdb
14 *	what is present in the file.  Directly after this is a
15 *	copy of the task_struct, which is currently not used by gdb,
16 *	but it may come in handy at some point.  All of the registers
17 *	are stored as part of the upage.  The upage should always be
18 *	only one page long.
19 *  data: The data segment follows next.  We use current->end_text to
20 *	current->brk to pick up all of the user variables, plus any memory
21 *	that may have been sbrk'ed.  No attempt is made to determine if a
22 *	page is demand-zero or if a page is totally unused, we just cover
23 *	the entire range.  All of the addresses are rounded in such a way
24 *	that an integral number of pages is written.
25 *  stack: We need the stack information in order to get a meaningful
26 *	backtrace.  We need to write the data from usp to
27 *	current->start_stack, so we round each of these in order to be able
28 *	to write an integer number of pages.
29 */
30
31/* User mode registers, used for core dumps. In order to keep ELF_NGREG
32   sensible we let all registers be 32 bits. The csr registers are included
33   for future use. */
34struct user_regs_struct {
35        unsigned long r0;       /* General registers. */
36        unsigned long r1;
37        unsigned long r2;
38        unsigned long r3;
39        unsigned long r4;
40        unsigned long r5;
41        unsigned long r6;
42        unsigned long r7;
43        unsigned long r8;
44        unsigned long r9;
45        unsigned long r10;
46        unsigned long r11;
47        unsigned long r12;
48        unsigned long r13;
49        unsigned long sp;       /* Stack pointer. */
50        unsigned long pc;       /* Program counter. */
51        unsigned long p0;       /* Constant zero (only 8 bits). */
52        unsigned long vr;       /* Version register (only 8 bits). */
53        unsigned long p2;       /* Reserved. */
54        unsigned long p3;       /* Reserved. */
55        unsigned long p4;       /* Constant zero (only 16 bits). */
56        unsigned long ccr;      /* Condition code register (only 16 bits). */
57        unsigned long p6;       /* Reserved. */
58        unsigned long mof;      /* Multiply overflow register. */
59        unsigned long p8;       /* Constant zero. */
60        unsigned long ibr;      /* Not accessible. */
61        unsigned long irp;      /* Not accessible. */
62        unsigned long srp;      /* Subroutine return pointer. */
63        unsigned long bar;      /* Not accessible. */
64        unsigned long dccr;     /* Dword condition code register. */
65        unsigned long brp;      /* Not accessible. */
66        unsigned long usp;      /* User-mode stack pointer. Same as sp when
67                                   in user mode. */
68        unsigned long csrinstr; /* Internal status registers. */
69        unsigned long csraddr;
70        unsigned long csrdata;
71};
72
73
74struct user {
75	struct user_regs_struct	regs;		/* entire machine state */
76	size_t		u_tsize;		/* text size (pages) */
77	size_t		u_dsize;		/* data size (pages) */
78	size_t		u_ssize;		/* stack size (pages) */
79	unsigned long	start_code;		/* text starting address */
80	unsigned long	start_data;		/* data starting address */
81	unsigned long	start_stack;		/* stack starting address */
82	long int	signal;			/* signal causing core dump */
83	struct regs *	u_ar0;			/* help gdb find registers */
84	unsigned long	magic;			/* identifies a core file */
85	char		u_comm[32];		/* user command name */
86};
87
88#define NBPG			PAGE_SIZE
89#define UPAGES			1
90#define HOST_TEXT_START_ADDR	(u.start_code)
91#define HOST_DATA_START_ADDR	(u.start_data)
92#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
93
94#endif /* __ASM_CRIS_USER_H */
95