Subversion Repositories HelenOS-historic

Rev

Rev 200 | Rev 318 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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