1633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
2633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * This file is subject to the terms and conditions of the GNU General Public
3633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * License.  See the file "COPYING" in the main directory of this archive
4633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * for more details.
5633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *
6633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
7633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
8633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#ifndef _ASM_USER_H
9633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define _ASM_USER_H
10633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
11633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/page.h>
12633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#include <asm/reg.h>
13633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
1422e2427e42fffbd75325c615729f46644c08f028Raghu Gandham#define EF_SIZE 180
15633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham/*
16633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * Core file format: The core file is written in such a way that gdb
17633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * can understand it and provide useful information to the user (under
18633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * linux we use the `trad-core' bfd, NOT the irix-core).  The file
19633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham * contents are as follows:
20633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *
21633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *  upage: 1 page consisting of a user struct that tells gdb
22633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	what is present in the file.  Directly after this is a
23633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	copy of the task_struct, which is currently not used by gdb,
24633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	but it may come in handy at some point.  All of the registers
25633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	are stored as part of the upage.  The upage should always be
26633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	only one page long.
27633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *  data: The data segment follows next.  We use current->end_text to
28633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	current->brk to pick up all of the user variables, plus any memory
29633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	that may have been sbrk'ed.  No attempt is made to determine if a
30633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	page is demand-zero or if a page is totally unused, we just cover
31633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	the entire range.  All of the addresses are rounded in such a way
32633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	that an integral number of pages is written.
33633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *  stack: We need the stack information in order to get a meaningful
34633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	backtrace.  We need to write the data from usp to
35633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	current->start_stack, so we round each of these in order to be able
36633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham *	to write an integer number of pages.
37633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham */
38633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandhamstruct user {
39633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	regs[EF_SIZE /		/* integer and fp regs */
40633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham			sizeof(unsigned long) + 64];
41633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	size_t		u_tsize;		/* text size (pages) */
42633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	size_t		u_dsize;		/* data size (pages) */
43633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	size_t		u_ssize;		/* stack size (pages) */
44633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	start_code;		/* text starting address */
45633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	start_data;		/* data starting address */
46633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	start_stack;		/* stack starting address */
47633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	long int	signal;			/* signal causing core dump */
48633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	u_ar0;			/* help gdb find registers */
49633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	unsigned long	magic;			/* identifies a core file */
50633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham	char		u_comm[32];		/* user command name */
51633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham};
52633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
53633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define NBPG			PAGE_SIZE
54633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define UPAGES			1
55633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HOST_TEXT_START_ADDR	(u.start_code)
56633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HOST_DATA_START_ADDR	(u.start_data)
57633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
58633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham
59633c3473533ad9f2cca069b22cc5d95cd4e3510bRaghu Gandham#endif /* _ASM_USER_H */
60