source: rtems/c/src/exec/score/tools/hppa1.1/genoffsets.c @ ac7d5ef0

4.104.114.84.95
Last change on this file since ac7d5ef0 was ac7d5ef0, checked in by Joel Sherrill <joel.sherrill@…>, on 05/11/95 at 17:39:37

Initial revision

  • Property mode set to 100644
File size: 5.8 KB
RevLine 
[ac7d5ef0]1/*
2 *      @(#)genoffsets.c        1.3 - 95/03/15
3 *
4 *
5 *  genoffsets.c
6 *
7 *  This file generates the offsets.h for the HP PA-RISC port of RTEMS.
8 *
9 *  NOTE:  It only prints the offset for structures actually used
10 *         by the assembly code.
11 *
12 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  This material may be reproduced by or for the U.S. Government pursuant
16 *  to the copyright license under the clause at DFARS 252.227-7013.  This
17 *  notice must appear in all copies of this file and its derivatives.
18 *
19 *  $Id$
20 *
21 */
22
23#include <stdio.h>
24
25#include <rtems/system.h>
26
27int main(
28  int argc,
29  char **argv
30)
31{
32  unsigned int size;
33
34  /*
35   * Print the file header
36   */
37
38printf(
39  "/*  offsets.h\n"
40  " *\n"
41  " *  This include file contains the offsets of elements in the\n"
42  " *  C data structures used by the assembly language code for the\n"
43  " *  HP PA-RISC 1.1 port of RTEMS.\n"
44  " *\n"
45  " *  NOTE:  THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
46  " *         DO NOT EDIT THIS BY HAND!!!!\n"
47  " *\n"
48  " *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
49  " *  On-Line Applications Research Corporation (OAR).\n"
50  " *  All rights assigned to U.S. Government, 1994.\n"
51  " *\n"
52  " *  This material may be reproduced by or for the U.S. Government pursuant\n"
53  " *  to the copyright license under the clause at DFARS 252.227-7013.  This\n"
54  " *  notice must appear in all copies of this file and its derivatives.\n"
55  " */\n"
56  "\n"
57  "#ifndef __OFFSETS_h\n"
58  "#define __OFFSETS_h\n"
59  "\n"
60);
61
62/*
63 *  Offsets of elements in the Context_control structure.
64 */
65
66#define PRINT_IT( STRING, TYPE, FIELD ) \
67  printf( "#define\t%s\t0x%p\t\t/* %d */\n", \
68          STRING, \
69          &((TYPE)0)->FIELD, \
70          (int) &((TYPE)0)->FIELD );
71
72#define PRINT_SIZE( STRING, item ) \
73  printf( "#define\t%s\t%d\t\t/* 0x%x */\n", \
74          STRING, \
75          sizeof(item), \
76          sizeof(item) );
77
78#define PRINT_COMMENT( STRING ) \
79  printf(       \
80    "\n"        \
81    "/*\n"      \
82    " * " STRING "\n" \
83    " */\n"     \
84    "\n"        \
85  );
86
87  PRINT_COMMENT("Context_Control information");
88
89  PRINT_IT( "FLAGS_OFFSET", Context_Control *, flags );
90  PRINT_IT( "R1_OFFSET", Context_Control *, gr1 );
91  PRINT_IT( "R2_OFFSET", Context_Control *, gr2 );
92  PRINT_IT( "R3_OFFSET", Context_Control *, gr3 );
93  PRINT_IT( "R4_OFFSET", Context_Control *, gr4 );
94  PRINT_IT( "R5_OFFSET", Context_Control *, gr5 );
95  PRINT_IT( "R6_OFFSET", Context_Control *, gr6 );
96  PRINT_IT( "R7_OFFSET", Context_Control *, gr7 );
97  PRINT_IT( "R8_OFFSET", Context_Control *, gr8 );
98  PRINT_IT( "R9_OFFSET", Context_Control *, gr9 );
99  PRINT_IT( "R10_OFFSET", Context_Control *, gr10 );
100  PRINT_IT( "R11_OFFSET", Context_Control *, gr11 );
101  PRINT_IT( "R12_OFFSET", Context_Control *, gr12 );
102  PRINT_IT( "R13_OFFSET", Context_Control *, gr13 );
103  PRINT_IT( "R14_OFFSET", Context_Control *, gr14 );
104  PRINT_IT( "R15_OFFSET", Context_Control *, gr15 );
105  PRINT_IT( "R16_OFFSET", Context_Control *, gr16 );
106  PRINT_IT( "R17_OFFSET", Context_Control *, gr17 );
107  PRINT_IT( "R18_OFFSET", Context_Control *, gr18 );
108  PRINT_IT( "R19_OFFSET", Context_Control *, gr19 );
109  PRINT_IT( "R20_OFFSET", Context_Control *, gr20 );
110  PRINT_IT( "R21_OFFSET", Context_Control *, gr21 );
111  PRINT_IT( "R22_OFFSET", Context_Control *, gr22 );
112  PRINT_IT( "R23_OFFSET", Context_Control *, gr23 );
113  PRINT_IT( "R24_OFFSET", Context_Control *, gr24 );
114  PRINT_IT( "R25_OFFSET", Context_Control *, gr25 );
115  PRINT_IT( "R26_OFFSET", Context_Control *, gr26 );
116  PRINT_IT( "R27_OFFSET", Context_Control *, gr27 );
117  PRINT_IT( "R28_OFFSET", Context_Control *, gr28 );
118  PRINT_IT( "R29_OFFSET", Context_Control *, gr29 );
119  PRINT_IT( "R30_OFFSET", Context_Control *, sp );
120  PRINT_IT( "R31_OFFSET", Context_Control *, gr31 );
121
122  /*
123   * And common aliases for the above
124   */
125
126  PRINT_COMMENT("Common aliases for above");
127
128  PRINT_IT( "RP_OFFSET",   Context_Control *, gr2 );
129  PRINT_IT( "ARG3_OFFSET", Context_Control *, gr23 );
130  PRINT_IT( "ARG2_OFFSET", Context_Control *, gr24 );
131  PRINT_IT( "ARG1_OFFSET", Context_Control *, gr25 );
132  PRINT_IT( "ARG0_OFFSET", Context_Control *, gr26 );
133  PRINT_IT( "SP_OFFSET",   Context_Control *, sp );
134  PRINT_IT( "DP_OFFSET",   Context_Control *, gr27 );
135  PRINT_IT( "RET0_OFFSET", Context_Control *, gr28 );
136  PRINT_IT( "RET1_OFFSET", Context_Control *, gr29 );
137
138  PRINT_SIZE("CPU_CONTEXT_SIZE", Context_Control);
139
140  PRINT_COMMENT("Context_Control_fp information");
141
142  PRINT_SIZE("CPU_CONTEXT_FP_SIZE", Context_Control_fp);
143
144  /*
145   *  And the control registers
146   */
147
148  PRINT_COMMENT("Control register portion of context");
149
150  PRINT_IT( "SAR_OFFSET", Context_Control *, sar );
151  PRINT_IT( "IPSW_OFFSET", Context_Control *, ipsw );
152  PRINT_IT( "IIR_OFFSET", Context_Control *, iir );
153  PRINT_IT( "IOR_OFFSET", Context_Control *, ior );
154  PRINT_IT( "ISR_OFFSET", Context_Control *, isr );
155  PRINT_IT( "PCOQFRONT_OFFSET", Context_Control *, pcoqfront );
156  PRINT_IT( "PCOQBACK_OFFSET", Context_Control *, pcoqback );
157  PRINT_IT( "PCSQFRONT_OFFSET", Context_Control *, pcsqfront );
158  PRINT_IT( "PCSQBACK_OFFSET", Context_Control *, pcsqback );
159  PRINT_IT( "ITIMER_OFFSET", Context_Control *, itimer );
160
161  /*
162   *  Full interrupt frame (integer + float)
163   */
164  PRINT_COMMENT("Interrupt frame information");
165
166  PRINT_IT( "INTEGER_CONTEXT_OFFSET", CPU_Interrupt_frame *, Integer );
167  PRINT_IT( "FP_CONTEXT_OFFSET", CPU_Interrupt_frame *, Floating_Point );
168  size = sizeof( CPU_Interrupt_frame );
169
170  if ( size % CPU_STACK_ALIGNMENT )
171    size += CPU_STACK_ALIGNMENT - (size % CPU_STACK_ALIGNMENT);
172
173  printf( "#define\tCPU_INTERRUPT_FRAME_SIZE\t%d\t\t/* 0x%x */\n", size, size );
174
175#undef PRINT_IT
176#undef PRINT_SIZE
177#undef PRINT_COMMENT
178
179  /*
180   *  Print the end of file stuff
181   */
182
183   printf(
184    "\n"
185    "#endif    /* __OFFSETS_h  */\n"
186    "\n"
187    "/* end of include file */\n"
188  );
189
190  return 0;
191}
Note: See TracBrowser for help on using the repository browser.