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