Subversion Repositories HelenOS-historic

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #include <stdio.h>
  2.  
  3. typedef unsigned int __u32;
  4. typedef __u32 ipl_t;
  5. typedef __u32 __address;
  6.  
  7. #define __ppc32_TYPES_H__
  8. #include "../../arch/ppc32/include/context.h"
  9.  
  10. #define FILENAME "../../arch/ppc32/include/context_offset.h"
  11.  
  12. int main(void)
  13. {
  14.     FILE *f;
  15.     struct context *pctx = NULL;
  16.    
  17.  
  18.     f = fopen(FILENAME,"w");
  19.     if (!f) {
  20.         perror(FILENAME);
  21.         return 1;
  22.     }
  23.  
  24.     fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__);   
  25.  
  26.     fprintf(f,"/* struct context */\n");
  27.  
  28.     fprintf(f,"#define OFFSET_SP   0x%x\n", ((int) &pctx->sp) - (int) pctx);
  29.     fprintf(f,"#define OFFSET_PC   0x%x\n", ((int) &pctx->pc) - (int) pctx);
  30.     fprintf(f,"#define OFFSET_R2   0x%x\n", ((int) &pctx->r2) - (int) pctx);
  31.     fprintf(f,"#define OFFSET_R13  0x%x\n", ((int) &pctx->r13) - (int) pctx);
  32.     fprintf(f,"#define OFFSET_R14  0x%x\n", ((int) &pctx->r14) - (int) pctx);
  33.     fprintf(f,"#define OFFSET_R15  0x%x\n", ((int) &pctx->r15) - (int) pctx);
  34.     fprintf(f,"#define OFFSET_R16  0x%x\n", ((int) &pctx->r16) - (int) pctx);
  35.     fprintf(f,"#define OFFSET_R17  0x%x\n", ((int) &pctx->r17) - (int) pctx);
  36.     fprintf(f,"#define OFFSET_R18  0x%x\n", ((int) &pctx->r18) - (int) pctx);
  37.     fprintf(f,"#define OFFSET_R19  0x%x\n", ((int) &pctx->r19) - (int) pctx);
  38.     fprintf(f,"#define OFFSET_R20  0x%x\n", ((int) &pctx->r20) - (int) pctx);
  39.     fprintf(f,"#define OFFSET_R21  0x%x\n", ((int) &pctx->r21) - (int) pctx);
  40.     fprintf(f,"#define OFFSET_R22  0x%x\n", ((int) &pctx->r22) - (int) pctx);
  41.     fprintf(f,"#define OFFSET_R23  0x%x\n", ((int) &pctx->r23) - (int) pctx);
  42.     fprintf(f,"#define OFFSET_R24  0x%x\n", ((int) &pctx->r24) - (int) pctx);
  43.     fprintf(f,"#define OFFSET_R25  0x%x\n", ((int) &pctx->r25) - (int) pctx);
  44.     fprintf(f,"#define OFFSET_R26  0x%x\n", ((int) &pctx->r26) - (int) pctx);
  45.     fprintf(f,"#define OFFSET_R27  0x%x\n", ((int) &pctx->r27) - (int) pctx);
  46.     fprintf(f,"#define OFFSET_R28  0x%x\n", ((int) &pctx->r28) - (int) pctx);
  47.     fprintf(f,"#define OFFSET_R29  0x%x\n", ((int) &pctx->r29) - (int) pctx);
  48.     fprintf(f,"#define OFFSET_R30  0x%x\n", ((int) &pctx->r30) - (int) pctx);
  49.     fprintf(f,"#define OFFSET_R31  0x%x\n", ((int) &pctx->r31) - (int) pctx);
  50.     fprintf(f,"#define OFFSET_CR   0x%x\n", ((int) &pctx->cr) - (int) pctx);
  51.  
  52.     fclose(f);
  53.  
  54.     return 0;
  55. }
  56.