OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [tools/] [cpu/] [hppa1.1/] [genoffsets.c] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  genoffsets.c
3
 *
4
 *  This file generates the offsets.h for the HP PA-RISC port of RTEMS.
5
 *
6
 *  NOTE:  It only prints the offset for structures actually used
7
 *         by the assembly code.
8
 *
9
 *  COPYRIGHT (c) 1989-1999.
10
 *  On-Line Applications Research Corporation (OAR).
11
 *
12
 *  The license and distribution terms for this file may be
13
 *  found in the file LICENSE in this distribution or at
14
 *  http://www.OARcorp.com/rtems/license.html.
15
 *
16
 *  $Id: genoffsets.c,v 1.2 2001-09-27 12:02:53 chris Exp $
17
 */
18
 
19
#include <stdio.h>
20
 
21
#if defined(__hpux__) && defined(__hppa__)
22
#include <rtems/system.h>
23
#endif
24
 
25
void print_information( void );
26
 
27
int main(
28
  int argc,
29
  char **argv
30
)
31
{
32
#if defined(__hpux__) && defined(__hppa__)
33
  unsigned int size = 0;
34
#endif
35
 
36
  /*
37
   * Print the file header
38
   */
39
 
40
printf(
41
  "/*  offsets.h\n"
42
  " *\n"
43
  " *  This include file contains the offsets of elements in the\n"
44
  " *  C data structures used by the assembly language code for the\n"
45
  " *  HP PA-RISC 1.1 port of RTEMS.\n"
46
  " *\n"
47
  " *  NOTE:  THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
48
  " *         DO NOT EDIT THIS BY HAND!!!!\n"
49
  " *\n"
50
  " *  COPYRIGHT (c) 1989-1999.\n"
51
  " *  On-Line Applications Research Corporation (OAR).\n"
52
  " *\n"
53
  " *  The license and distribution terms for this file may be\n"
54
  " *  found in the file LICENSE in this distribution or at\n"
55
  " *  http://www.OARcorp.com/rtems/license.html.\n"
56
  " */\n"
57
  "\n"
58
  "#ifndef __OFFSETS_h\n"
59
  "#define __OFFSETS_h\n"
60
  "\n"
61
);
62
 
63
#define PRINT_IT( STRING, TYPE, FIELD ) \
64
  printf( "#define\t%s\t0x%p\t\t/* %d */\n", \
65
          STRING, \
66
          &((TYPE)0)->FIELD, \
67
          (int) &((TYPE)0)->FIELD );
68
 
69
#define PRINT_SIZE( STRING, item ) \
70
  printf( "#ifdef ASM\n#define\t%s\t%d\t\t/* 0x%x */\n#endif\n", \
71
          STRING, \
72
          sizeof(item), \
73
          sizeof(item) );
74
 
75
#define PRINT_COMMENT( STRING ) \
76
  printf(       \
77
    "\n"        \
78
    "/*\n"      \
79
    " * " STRING "\n" \
80
    " */\n"     \
81
    "\n"        \
82
  );
83
 
84
#if defined(__hpux__) && defined(__hppa__)
85
 
86
/*
87
 *  Offsets of elements in the Context_control structure.
88
 */
89
 
90
  PRINT_COMMENT("Context_Control information");
91
 
92
  PRINT_IT( "FLAGS_OFFSET", Context_Control *, flags );
93
  PRINT_IT( "R1_OFFSET", Context_Control *, gr1 );
94
  PRINT_IT( "R2_OFFSET", Context_Control *, gr2 );
95
  PRINT_IT( "R3_OFFSET", Context_Control *, gr3 );
96
  PRINT_IT( "R4_OFFSET", Context_Control *, gr4 );
97
  PRINT_IT( "R5_OFFSET", Context_Control *, gr5 );
98
  PRINT_IT( "R6_OFFSET", Context_Control *, gr6 );
99
  PRINT_IT( "R7_OFFSET", Context_Control *, gr7 );
100
  PRINT_IT( "R8_OFFSET", Context_Control *, gr8 );
101
  PRINT_IT( "R9_OFFSET", Context_Control *, gr9 );
102
  PRINT_IT( "R10_OFFSET", Context_Control *, gr10 );
103
  PRINT_IT( "R11_OFFSET", Context_Control *, gr11 );
104
  PRINT_IT( "R12_OFFSET", Context_Control *, gr12 );
105
  PRINT_IT( "R13_OFFSET", Context_Control *, gr13 );
106
  PRINT_IT( "R14_OFFSET", Context_Control *, gr14 );
107
  PRINT_IT( "R15_OFFSET", Context_Control *, gr15 );
108
  PRINT_IT( "R16_OFFSET", Context_Control *, gr16 );
109
  PRINT_IT( "R17_OFFSET", Context_Control *, gr17 );
110
  PRINT_IT( "R18_OFFSET", Context_Control *, gr18 );
111
  PRINT_IT( "R19_OFFSET", Context_Control *, gr19 );
112
  PRINT_IT( "R20_OFFSET", Context_Control *, gr20 );
113
  PRINT_IT( "R21_OFFSET", Context_Control *, gr21 );
114
  PRINT_IT( "R22_OFFSET", Context_Control *, gr22 );
115
  PRINT_IT( "R23_OFFSET", Context_Control *, gr23 );
116
  PRINT_IT( "R24_OFFSET", Context_Control *, gr24 );
117
  PRINT_IT( "R25_OFFSET", Context_Control *, gr25 );
118
  PRINT_IT( "R26_OFFSET", Context_Control *, gr26 );
119
  PRINT_IT( "R27_OFFSET", Context_Control *, gr27 );
120
  PRINT_IT( "R28_OFFSET", Context_Control *, gr28 );
121
  PRINT_IT( "R29_OFFSET", Context_Control *, gr29 );
122
  PRINT_IT( "R30_OFFSET", Context_Control *, sp );
123
  PRINT_IT( "R31_OFFSET", Context_Control *, gr31 );
124
 
125
  /*
126
   * And common aliases for the above
127
   */
128
 
129
  PRINT_COMMENT("Common aliases for above");
130
 
131
  PRINT_IT( "RP_OFFSET",   Context_Control *, gr2 );
132
  PRINT_IT( "ARG3_OFFSET", Context_Control *, gr23 );
133
  PRINT_IT( "ARG2_OFFSET", Context_Control *, gr24 );
134
  PRINT_IT( "ARG1_OFFSET", Context_Control *, gr25 );
135
  PRINT_IT( "ARG0_OFFSET", Context_Control *, gr26 );
136
  PRINT_IT( "SP_OFFSET",   Context_Control *, sp );
137
  PRINT_IT( "DP_OFFSET",   Context_Control *, gr27 );
138
  PRINT_IT( "RET0_OFFSET", Context_Control *, gr28 );
139
  PRINT_IT( "RET1_OFFSET", Context_Control *, gr29 );
140
 
141
  PRINT_SIZE("CPU_CONTEXT_SIZE", Context_Control);
142
 
143
  PRINT_COMMENT("Context_Control_fp information");
144
 
145
  PRINT_IT( "FR0_OFFSET", Context_Control_fp *, fr0 );
146
  PRINT_IT( "FR1_OFFSET", Context_Control_fp *, fr1 );
147
  PRINT_IT( "FR2_OFFSET", Context_Control_fp *, fr2 );
148
  PRINT_IT( "FR3_OFFSET", Context_Control_fp *, fr3 );
149
  PRINT_IT( "FR4_OFFSET", Context_Control_fp *, fr4 );
150
  PRINT_IT( "FR5_OFFSET", Context_Control_fp *, fr5 );
151
  PRINT_IT( "FR6_OFFSET", Context_Control_fp *, fr6 );
152
  PRINT_IT( "FR7_OFFSET", Context_Control_fp *, fr7 );
153
  PRINT_IT( "FR8_OFFSET", Context_Control_fp *, fr8 );
154
  PRINT_IT( "FR9_OFFSET", Context_Control_fp *, fr9 );
155
  PRINT_IT( "FR10_OFFSET", Context_Control_fp *, fr10 );
156
  PRINT_IT( "FR11_OFFSET", Context_Control_fp *, fr11 );
157
  PRINT_IT( "FR12_OFFSET", Context_Control_fp *, fr12 );
158
  PRINT_IT( "FR13_OFFSET", Context_Control_fp *, fr13 );
159
  PRINT_IT( "FR14_OFFSET", Context_Control_fp *, fr14 );
160
  PRINT_IT( "FR15_OFFSET", Context_Control_fp *, fr15 );
161
  PRINT_IT( "FR16_OFFSET", Context_Control_fp *, fr16 );
162
  PRINT_IT( "FR17_OFFSET", Context_Control_fp *, fr17 );
163
  PRINT_IT( "FR18_OFFSET", Context_Control_fp *, fr18 );
164
  PRINT_IT( "FR19_OFFSET", Context_Control_fp *, fr19 );
165
  PRINT_IT( "FR20_OFFSET", Context_Control_fp *, fr20 );
166
  PRINT_IT( "FR21_OFFSET", Context_Control_fp *, fr21 );
167
  PRINT_IT( "FR22_OFFSET", Context_Control_fp *, fr22 );
168
  PRINT_IT( "FR23_OFFSET", Context_Control_fp *, fr23 );
169
  PRINT_IT( "FR24_OFFSET", Context_Control_fp *, fr24 );
170
  PRINT_IT( "FR25_OFFSET", Context_Control_fp *, fr25 );
171
  PRINT_IT( "FR26_OFFSET", Context_Control_fp *, fr26 );
172
  PRINT_IT( "FR27_OFFSET", Context_Control_fp *, fr27 );
173
  PRINT_IT( "FR28_OFFSET", Context_Control_fp *, fr28 );
174
  PRINT_IT( "FR29_OFFSET", Context_Control_fp *, fr29 );
175
  PRINT_IT( "FR30_OFFSET", Context_Control_fp *, fr30 );
176
  PRINT_IT( "FR31_OFFSET", Context_Control_fp *, fr31 );
177
 
178
  PRINT_SIZE("CPU_CONTEXT_FP_SIZE", Context_Control_fp);
179
 
180
  /*
181
   *  And the control registers
182
   */
183
 
184
  PRINT_COMMENT("Control register portion of context");
185
 
186
  PRINT_IT( "SAR_OFFSET", Context_Control *, sar );
187
  PRINT_IT( "IPSW_OFFSET", Context_Control *, ipsw );
188
  PRINT_IT( "IIR_OFFSET", Context_Control *, iir );
189
  PRINT_IT( "IOR_OFFSET", Context_Control *, ior );
190
  PRINT_IT( "ISR_OFFSET", Context_Control *, isr );
191
  PRINT_IT( "PCOQFRONT_OFFSET", Context_Control *, pcoqfront );
192
  PRINT_IT( "PCOQBACK_OFFSET", Context_Control *, pcoqback );
193
  PRINT_IT( "PCSQFRONT_OFFSET", Context_Control *, pcsqfront );
194
  PRINT_IT( "PCSQBACK_OFFSET", Context_Control *, pcsqback );
195
  PRINT_IT( "ITIMER_OFFSET", Context_Control *, itimer );
196
 
197
  /*
198
   *  Full interrupt frame (integer + float)
199
   */
200
  PRINT_COMMENT("Interrupt frame information");
201
 
202
  PRINT_IT( "INTEGER_CONTEXT_OFFSET", CPU_Interrupt_frame *, Integer );
203
  PRINT_IT( "FP_CONTEXT_OFFSET", CPU_Interrupt_frame *, Floating_Point );
204
  size = sizeof( CPU_Interrupt_frame );
205
 
206
  if ( size % CPU_STACK_ALIGNMENT )
207
    size += CPU_STACK_ALIGNMENT - (size % CPU_STACK_ALIGNMENT);
208
 
209
  printf( "#define\tCPU_INTERRUPT_FRAME_SIZE\t%d\t\t/* 0x%x */\n", size, size );
210
 
211
#else
212
 
213
  print_information();
214
 
215
#endif
216
 
217
#undef PRINT_IT
218
#undef PRINT_SIZE
219
#undef PRINT_COMMENT
220
 
221
  /*
222
   *  Print the end of file stuff
223
   */
224
 
225
   printf(
226
    "\n"
227
    "#endif    /* __OFFSETS_h  */\n"
228
    "\n"
229
    "/* end of include file */\n"
230
  );
231
 
232
  return 0;
233
}
234
 
235
void print_information( void )
236
{
237
 
238
#define PRINT_IT( STRING, NUMBER ) \
239
  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
240
          STRING, \
241
          NUMBER, \
242
          NUMBER );
243
 
244
#define PRINT_SIZE( STRING, NUMBER ) \
245
  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
246
          STRING, \
247
          NUMBER, \
248
          NUMBER );
249
 
250
#define PRINT_COMMENT( STRING ) \
251
  printf(       \
252
    "\n"        \
253
    "/*\n"      \
254
    " * " STRING "\n" \
255
    " */\n"     \
256
    "\n"        \
257
  );
258
 
259
/*
260
 *  Offsets of elements in the Context_control structure.
261
 */
262
 
263
  PRINT_COMMENT("Context_Control information");
264
 
265
  PRINT_IT( "FLAGS_OFFSET",  0x00 );
266
  PRINT_IT( "R1_OFFSET",     0x04 );
267
  PRINT_IT( "R2_OFFSET",     0x08 );
268
  PRINT_IT( "R3_OFFSET",     0x0c );
269
  PRINT_IT( "R4_OFFSET",     0x00 );
270
  PRINT_IT( "R5_OFFSET",     0x14 );
271
  PRINT_IT( "R6_OFFSET",     0x18 );
272
  PRINT_IT( "R7_OFFSET",     0x1c );
273
  PRINT_IT( "R8_OFFSET",     0x20 );
274
  PRINT_IT( "R9_OFFSET",     0x24 );
275
  PRINT_IT( "R10_OFFSET",    0x28 );
276
  PRINT_IT( "R11_OFFSET",    0x2c );
277
  PRINT_IT( "R12_OFFSET",    0x30 );
278
  PRINT_IT( "R13_OFFSET",    0x34 );
279
  PRINT_IT( "R14_OFFSET",    0x38 );
280
  PRINT_IT( "R15_OFFSET",    0x3c );
281
  PRINT_IT( "R16_OFFSET",    0x40 );
282
  PRINT_IT( "R17_OFFSET",    0x44 );
283
  PRINT_IT( "R18_OFFSET",    0x48 );
284
  PRINT_IT( "R19_OFFSET",    0x4c );
285
  PRINT_IT( "R20_OFFSET",    0x50 );
286
  PRINT_IT( "R21_OFFSET",    0x54 );
287
  PRINT_IT( "R22_OFFSET",    0x58 );
288
  PRINT_IT( "R23_OFFSET",    0x5c );
289
  PRINT_IT( "R24_OFFSET",    0x60 );
290
  PRINT_IT( "R25_OFFSET",    0x64 );
291
  PRINT_IT( "R26_OFFSET",    0x68 );
292
  PRINT_IT( "R27_OFFSET",    0x6c );
293
  PRINT_IT( "R28_OFFSET",    0x70 );
294
  PRINT_IT( "R29_OFFSET",    0x74 );
295
  PRINT_IT( "R30_OFFSET",    0x78 );
296
  PRINT_IT( "R31_OFFSET",    0x7c );
297
 
298
  /*
299
   * And common aliases for the above
300
   */
301
 
302
  PRINT_COMMENT("Common aliases for above");
303
 
304
  PRINT_IT( "RP_OFFSET",   0x08 );
305
  PRINT_IT( "ARG3_OFFSET", 0x5c );
306
  PRINT_IT( "ARG2_OFFSET", 0x60 );
307
  PRINT_IT( "ARG1_OFFSET", 0x64 );
308
  PRINT_IT( "ARG0_OFFSET", 0x68 );
309
  PRINT_IT( "SP_OFFSET",   0x78 );
310
  PRINT_IT( "DP_OFFSET",   0x6c );
311
  PRINT_IT( "RET0_OFFSET", 0x74 );
312
  PRINT_IT( "RET1_OFFSET", 0x74 );
313
 
314
  PRINT_SIZE("CPU_CONTEXT_SIZE", 168 );
315
 
316
  PRINT_COMMENT("Context_Control_fp information");
317
 
318
  PRINT_SIZE("CPU_CONTEXT_FP_SIZE", 256);
319
 
320
  /*
321
   *  And the control registers
322
   */
323
 
324
  PRINT_COMMENT("Control register portion of context");
325
 
326
  PRINT_IT( "SAR_OFFSET",        0x80 );
327
  PRINT_IT( "IPSW_OFFSET",       0x84 );
328
  PRINT_IT( "IIR_OFFSET",        0x88 );
329
  PRINT_IT( "IOR_OFFSET",        0x8c );
330
  PRINT_IT( "ISR_OFFSET",        0x90 );
331
  PRINT_IT( "PCOQFRONT_OFFSET",  0x94 );
332
  PRINT_IT( "PCOQBACK_OFFSET",   0x98 );
333
  PRINT_IT( "PCSQFRONT_OFFSET",  0x9c );
334
  PRINT_IT( "PCSQBACK_OFFSET",   0xa0 );
335
  PRINT_IT( "ITIMER_OFFSET",     0xa4 );
336
 
337
  /*
338
   *  Full interrupt frame (integer + float)
339
   */
340
 
341
  PRINT_COMMENT("Interrupt frame information");
342
 
343
  PRINT_IT( "INTEGER_CONTEXT_OFFSET",   0x00 );
344
  PRINT_IT( "FP_CONTEXT_OFFSET",        0xa8 );
345
  PRINT_SIZE( "CPU_INTERRUPT_FRAME_SIZE", 448 );
346
 
347
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.