Subversion Repositories HelenOS-historic

Rev

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

Rev Author Line No. Line
200 palkovsky 1
#include <stdio.h>
2
 
3
 
4
typedef long long __u64;
5
typedef __u64 pri_t;
6
 
7
#define __amd64_TYPES_H__
288 jermar 8
#include "../../arch/amd64/include/context.h"
200 palkovsky 9
 
318 jermar 10
#define FILENAME "../../arch/amd64/include/context_offset.h"
200 palkovsky 11
 
12
int main(void)
13
{
288 jermar 14
    FILE *f;
15
    struct context ctx;
16
    struct context *pctx = &ctx;
200 palkovsky 17
 
288 jermar 18
    f = fopen(FILENAME,"w");
19
    if (!f) {
20
        perror(FILENAME);
21
        return 1;
22
    }
200 palkovsky 23
 
288 jermar 24
    fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__);   
25
 
26
    fprintf(f,"#define OFFSET_SP  0x%x\n",((int)&pctx->sp) - (int )pctx);
27
    fprintf(f,"#define OFFSET_PC  0x%x\n",((int)&pctx->pc) - (int )pctx);
28
    fprintf(f,"#define OFFSET_RBX 0x%x\n",((int)&pctx->rbx) - (int )pctx);
29
    fprintf(f,"#define OFFSET_RBP 0x%x\n",((int)&pctx->rbp) - (int )pctx);
30
    fprintf(f,"#define OFFSET_R12 0x%x\n",((int)&pctx->r12) - (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_PRI 0x%x\n",((int)&pctx->pri) - (int )pctx);
35
    fclose(f);
36
 
37
    return 0;
200 palkovsky 38
}