Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* user.h: FR-V core file format stuff |
2 | * | |
3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. | |
4 | * Written by David Howells (dhowells@redhat.com) | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU General Public License | |
8 | * as published by the Free Software Foundation; either version | |
9 | * 2 of the License, or (at your option) any later version. | |
10 | */ | |
11 | #ifndef _ASM_USER_H | |
12 | #define _ASM_USER_H | |
13 | ||
14 | #include <asm/page.h> | |
15 | #include <asm/registers.h> | |
16 | ||
17 | /* Core file format: The core file is written in such a way that gdb | |
18 | * can understand it and provide useful information to the user (under | |
19 | * linux we use the 'trad-core' bfd). There are quite a number of | |
20 | * obstacles to being able to view the contents of the floating point | |
21 | * registers, and until these are solved you will not be able to view | |
22 | * the contents of them. Actually, you can read in the core file and | |
23 | * look at the contents of the user struct to find out what the | |
24 | * floating point registers contain. | |
25 | * | |
26 | * The actual file contents are as follows: | |
27 | * UPAGE: | |
28 | * 1 page consisting of a user struct that tells gdb what is present | |
29 | * in the file. Directly after this is a copy of the task_struct, | |
30 | * which is currently not used by gdb, but it may come in useful at | |
31 | * some point. All of the registers are stored as part of the | |
32 | * upage. The upage should always be only one page. | |
33 | * | |
34 | * DATA: | |
35 | * The data area is stored. We use current->end_text to | |
36 | * current->brk to pick up all of the user variables, plus any | |
37 | * memory that may have been malloced. No attempt is made to | |
38 | * determine if a page is demand-zero or if a page is totally | |
39 | * unused, we just cover the entire range. All of the addresses are | |
40 | * rounded in such a way that an integral number of pages is | |
41 | * written. | |
42 | * | |
43 | * STACK: | |
44 | * We need the stack information in order to get a meaningful | |
45 | * backtrace. We need to write the data from (esp) to | |
46 | * current->start_stack, so we round each of these off in order to | |
47 | * be able to write an integer number of pages. The minimum core | |
48 | * file size is 3 pages, or 12288 bytes. | |
49 | */ | |
50 | ||
51 | /* When the kernel dumps core, it starts by dumping the user struct - | |
52 | * this will be used by gdb to figure out where the data and stack segments | |
53 | * are within the file, and what virtual addresses to use. | |
54 | */ | |
55 | struct user { | |
56 | /* We start with the registers, to mimic the way that "memory" is returned | |
57 | * from the ptrace(3,...) function. */ | |
58 | struct user_context regs; | |
59 | ||
60 | /* The rest of this junk is to help gdb figure out what goes where */ | |
61 | unsigned long u_tsize; /* Text segment size (pages). */ | |
62 | unsigned long u_dsize; /* Data segment size (pages). */ | |
63 | unsigned long u_ssize; /* Stack segment size (pages). */ | |
64 | unsigned long start_code; /* Starting virtual address of text. */ | |
65 | unsigned long start_stack; /* Starting virtual address of stack area. | |
66 | * This is actually the bottom of the stack, | |
67 | * the top of the stack is always found in the | |
68 | * esp register. */ | |
69 | long int signal; /* Signal that caused the core dump. */ | |
70 | ||
71 | unsigned long magic; /* To uniquely identify a core file */ | |
72 | char u_comm[32]; /* User command that was responsible */ | |
73 | }; | |
74 | ||
75 | #define NBPG PAGE_SIZE | |
76 | #define UPAGES 1 | |
77 | #define HOST_TEXT_START_ADDR (u.start_code) | |
78 | #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) | |
79 | ||
80 | #endif |