Subversion Repositories HelenOS-historic

Rev

Rev 534 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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