Subversion Repositories HelenOS-historic

Rev

Rev 532 | 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 __mips32_TYPES_H__
  8. #include "../../arch/mips32/include/context.h"
  9. #include "../../arch/mips32/include/exception.h"
  10.  
  11. #define FILENAME "../../arch/mips32/include/context_offset.h"
  12.  
  13. int main(void)
  14. {
  15.     FILE *f;
  16.     struct context *pctx = NULL;
  17.     struct exception_regdump *edmp = NULL;
  18.    
  19.  
  20.     f = fopen(FILENAME,"w");
  21.     if (!f) {
  22.         perror(FILENAME);
  23.         return 1;
  24.     }
  25.  
  26.     fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__);   
  27.  
  28.     fprintf(f,"/* struct context */\n");
  29.  
  30.     fprintf(f,"#define OFFSET_SP  0x%x\n",((int)&pctx->sp) - (int )pctx);
  31.     fprintf(f,"#define OFFSET_PC  0x%x\n",((int)&pctx->pc) - (int )pctx);
  32.     fprintf(f,"#define OFFSET_S0  0x%x\n",((int)&pctx->s0) - (int )pctx);
  33.     fprintf(f,"#define OFFSET_S1  0x%x\n",((int)&pctx->s1) - (int )pctx);
  34.     fprintf(f,"#define OFFSET_S2  0x%x\n",((int)&pctx->s2) - (int )pctx);
  35.     fprintf(f,"#define OFFSET_S3  0x%x\n",((int)&pctx->s3) - (int )pctx);
  36.     fprintf(f,"#define OFFSET_S4  0x%x\n",((int)&pctx->s4) - (int )pctx);
  37.     fprintf(f,"#define OFFSET_S5  0x%x\n",((int)&pctx->s5) - (int )pctx);
  38.     fprintf(f,"#define OFFSET_S6  0x%x\n",((int)&pctx->s6) - (int )pctx);
  39.     fprintf(f,"#define OFFSET_S7  0x%x\n",((int)&pctx->s7) - (int )pctx);
  40.     fprintf(f,"#define OFFSET_S8  0x%x\n",((int)&pctx->s8) - (int )pctx);
  41.     fprintf(f,"#define OFFSET_GP  0x%x\n",((int)&pctx->gp) - (int )pctx);
  42.  
  43.     fprintf(f,"\n\n/* struct register_dump */\n");
  44.     fprintf(f,"#define EOFFSET_AT  0x%x\n",((int)&edmp->at) - (int )edmp);
  45.     fprintf(f,"#define EOFFSET_V0  0x%x\n",((int)&edmp->v0) - (int )edmp);
  46.     fprintf(f,"#define EOFFSET_V1  0x%x\n",((int)&edmp->v1) - (int )edmp);
  47.     fprintf(f,"#define EOFFSET_A0  0x%x\n",((int)&edmp->a0) - (int )edmp);
  48.     fprintf(f,"#define EOFFSET_A1  0x%x\n",((int)&edmp->a1) - (int )edmp);
  49.     fprintf(f,"#define EOFFSET_A2  0x%x\n",((int)&edmp->a2) - (int )edmp);
  50.     fprintf(f,"#define EOFFSET_A3  0x%x\n",((int)&edmp->a3) - (int )edmp);
  51.     fprintf(f,"#define EOFFSET_T0  0x%x\n",((int)&edmp->t0) - (int )edmp);
  52.     fprintf(f,"#define EOFFSET_T1  0x%x\n",((int)&edmp->t1) - (int )edmp);
  53.     fprintf(f,"#define EOFFSET_T2  0x%x\n",((int)&edmp->t2) - (int )edmp);
  54.     fprintf(f,"#define EOFFSET_T3  0x%x\n",((int)&edmp->t3) - (int )edmp);
  55.     fprintf(f,"#define EOFFSET_T4  0x%x\n",((int)&edmp->t4) - (int )edmp);
  56.     fprintf(f,"#define EOFFSET_T5  0x%x\n",((int)&edmp->t5) - (int )edmp);
  57.     fprintf(f,"#define EOFFSET_T6  0x%x\n",((int)&edmp->t6) - (int )edmp);
  58.     fprintf(f,"#define EOFFSET_T7  0x%x\n",((int)&edmp->t7) - (int )edmp);
  59.     fprintf(f,"#define EOFFSET_S0  0x%x\n",((int)&edmp->s0) - (int )edmp);
  60.     fprintf(f,"#define EOFFSET_S1  0x%x\n",((int)&edmp->s1) - (int )edmp);
  61.     fprintf(f,"#define EOFFSET_S2  0x%x\n",((int)&edmp->s2) - (int )edmp);
  62.     fprintf(f,"#define EOFFSET_S3  0x%x\n",((int)&edmp->s3) - (int )edmp);
  63.     fprintf(f,"#define EOFFSET_S4  0x%x\n",((int)&edmp->s4) - (int )edmp);
  64.     fprintf(f,"#define EOFFSET_S5  0x%x\n",((int)&edmp->s5) - (int )edmp);
  65.     fprintf(f,"#define EOFFSET_S6  0x%x\n",((int)&edmp->s6) - (int )edmp);
  66.     fprintf(f,"#define EOFFSET_S7  0x%x\n",((int)&edmp->s7) - (int )edmp);
  67.     fprintf(f,"#define EOFFSET_T8  0x%x\n",((int)&edmp->t8) - (int )edmp);
  68.     fprintf(f,"#define EOFFSET_T9  0x%x\n",((int)&edmp->t9) - (int )edmp);
  69.     fprintf(f,"#define EOFFSET_GP  0x%x\n",((int)&edmp->gp) - (int )edmp);
  70.     fprintf(f,"#define EOFFSET_SP  0x%x\n",((int)&edmp->sp) - (int )edmp);
  71.     fprintf(f,"#define EOFFSET_S8  0x%x\n",((int)&edmp->s8) - (int )edmp);
  72.     fprintf(f,"#define EOFFSET_RA  0x%x\n",((int)&edmp->ra) - (int )edmp);
  73.     fprintf(f,"#define EOFFSET_LO  0x%x\n",((int)&edmp->lo) - (int )edmp);
  74.     fprintf(f,"#define EOFFSET_HI  0x%x\n",((int)&edmp->hi) - (int )edmp);
  75.     fprintf(f,"#define EOFFSET_STATUS  0x%x\n",((int)&edmp->status) - (int )edmp);
  76.     fprintf(f,"#define EOFFSET_EPC  0x%x\n",((int)&edmp->epc) - (int )edmp);
  77.  
  78.     fprintf(f,"#define REGISTER_SPACE  %d\n",sizeof(*edmp));
  79.  
  80.     fclose(f);
  81.  
  82.     return 0;
  83. }
  84.