1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
/* registers.h: register frame declarations
*
* Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
/*
* notes:
*
* (1) that the members of all these structures are carefully aligned to permit
* usage of STD/STDF instructions
*
* (2) if you change these structures, you must change the code in
* arch/frvnommu/kernel/{break.S,entry.S,switch_to.S,gdb-stub.c}
*
*
* the kernel stack space block looks like this:
*
* +0x2000 +----------------------
* | union {
* | struct frv_frame0 {
* | struct user_context {
* | struct user_int_regs
* | struct user_fpmedia_regs
* | }
* | struct frv_debug_regs
* | }
* | struct pt_regs [user exception]
* | }
* +---------------------- <-- __kernel_frame0_ptr (maybe GR28)
* |
* | kernel stack
* |
* |......................
* | struct pt_regs [kernel exception]
* |...................... <-- __kernel_frame0_ptr (maybe GR28)
* |
* | kernel stack
* |
* |...................... <-- stack pointer (GR1)
* |
* | unused stack space
* |
* +----------------------
* | struct thread_info
* +0x0000 +---------------------- <-- __current_thread_info (GR15);
*
* note that GR28 points to the current exception frame
*/
#ifndef _ASM_REGISTERS_H
#define _ASM_REGISTERS_H
#ifndef __ASSEMBLY__
#define __OFFSET(X,N) ((X)+(N)*4)
#define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx
#else
#define __OFFSET(X,N) ((X)+(N)*4)
#define __OFFSETC(X,N) ((X)+(N))
#endif
/*****************************************************************************/
/*
* Exception/Interrupt frame
* - held on kernel stack
* - 8-byte aligned on stack (old SP is saved in frame)
* - GR0 is fixed 0, so we don't save it
*/
#ifndef __ASSEMBLY__
struct pt_regs {
unsigned long psr; /* Processor Status Register */
unsigned long isr; /* Integer Status Register */
unsigned long ccr; /* Condition Code Register */
unsigned long cccr; /* Condition Code for Conditional Insns Register */
unsigned long lr; /* Link Register */
unsigned long lcr; /* Loop Count Register */
unsigned long pc; /* Program Counter Register */
unsigned long __status; /* exception status */
unsigned long syscallno; /* syscall number or -1 */
unsigned long orig_gr8; /* original syscall arg #1 */
unsigned long gner0;
unsigned long gner1;
unsigned long long iacc0;
unsigned long tbr; /* GR0 is fixed zero, so we use this for TBR */
unsigned long sp; /* GR1: USP/KSP */
unsigned long fp; /* GR2: FP */
unsigned long gr3;
unsigned long gr4;
unsigned long gr5;
unsigned long gr6;
unsigned long gr7; /* syscall number */
unsigned long gr8; /* 1st syscall param; syscall return */
unsigned long gr9; /* 2nd syscall param */
unsigned long gr10; /* 3rd syscall param */
unsigned long gr11; /* 4th syscall param */
unsigned long gr12; /* 5th syscall param */
unsigned long gr13; /* 6th syscall param */
unsigned long gr14;
unsigned long gr15;
unsigned long gr16; /* GP pointer */
unsigned long gr17; /* small data */
unsigned long gr18; /* PIC/PID */
unsigned long gr19;
unsigned long gr20;
unsigned long gr21;
unsigned long gr22;
unsigned long gr23;
unsigned long gr24;
unsigned long gr25;
unsigned long gr26;
unsigned long gr27;
struct pt_regs *next_frame; /* GR28 - next exception frame */
unsigned long gr29; /* GR29 - OS reserved */
unsigned long gr30; /* GR30 - OS reserved */
unsigned long gr31; /* GR31 - OS reserved */
} __attribute__((aligned(8)));
#endif
#define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */
#define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */
#define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */
#define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */
#define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */
#define REG_GR(R) __OFFSET(REG_GR0, (R))
#define REG_SP REG_GR(1)
#define REG_FP REG_GR(2)
#define REG_PREV_FRAME REG_GR(28) /* previous exception frame pointer (old gr28 value) */
#define REG_CURR_TASK REG_GR(29) /* current task */
/*****************************************************************************/
/*
* debugging registers
*/
#ifndef __ASSEMBLY__
struct frv_debug_regs
{
unsigned long dcr;
unsigned long ibar[4] __attribute__((aligned(8)));
unsigned long dbar[4] __attribute__((aligned(8)));
unsigned long dbdr[4][4] __attribute__((aligned(8)));
unsigned long dbmr[4][4] __attribute__((aligned(8)));
} __attribute__((aligned(8)));
#endif
/*****************************************************************************/
/*
* userspace registers
*/
#ifndef __ASSEMBLY__
struct user_int_regs
{
/* integer registers
* - up to gr[31] mirror pt_regs
* - total size must be multiple of 8 bytes
*/
unsigned long psr; /* Processor Status Register */
unsigned long isr; /* Integer Status Register */
unsigned long ccr; /* Condition Code Register */
unsigned long cccr; /* Condition Code for Conditional Insns Register */
unsigned long lr; /* Link Register */
unsigned long lcr; /* Loop Count Register */
unsigned long pc; /* Program Counter Register */
unsigned long __status; /* exception status */
unsigned long syscallno; /* syscall number or -1 */
unsigned long orig_gr8; /* original syscall arg #1 */
unsigned long gner[2];
unsigned long long iacc[1];
union {
unsigned long tbr;
unsigned long gr[64];
};
};
struct user_fpmedia_regs
{
/* FP/Media registers */
unsigned long fr[64];
unsigned long fner[2];
unsigned long msr[2];
unsigned long acc[8];
unsigned char accg[8];
unsigned long fsr[1];
};
struct user_context
{
struct user_int_regs i;
struct user_fpmedia_regs f;
/* we provide a context extension so that we can save the regs for CPUs that
* implement many more of Fujitsu's lavish register spec
*/
void *extension;
} __attribute__((aligned(8)));
struct frv_frame0 {
union {
struct pt_regs regs;
struct user_context uc;
};
struct frv_debug_regs debug;
} __attribute__((aligned(32)));
#endif
#define __INT_GR(R) __OFFSET(__INT_GR0, (R))
#define __FPMEDIA_FR(R) __OFFSET(__FPMEDIA_FR0, (R))
#define __FPMEDIA_FNER(R) __OFFSET(__FPMEDIA_FNER0, (R))
#define __FPMEDIA_MSR(R) __OFFSET(__FPMEDIA_MSR0, (R))
#define __FPMEDIA_ACC(R) __OFFSET(__FPMEDIA_ACC0, (R))
#define __FPMEDIA_ACCG(R) __OFFSETC(__FPMEDIA_ACCG0, (R))
#define __FPMEDIA_FSR(R) __OFFSET(__FPMEDIA_FSR0, (R))
#define __THREAD_GR(R) __OFFSET(__THREAD_GR16, (R) - 16)
#endif /* _ASM_REGISTERS_H */
|