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