Rev 288 | Go to most recent revision | Details | 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__ |
||
8 | #include "../include/context.h" |
||
9 | |||
10 | #define FILENAME "context_offset.h" |
||
11 | |||
12 | int main(void) |
||
13 | { |
||
14 | FILE *f; |
||
15 | struct context ctx; |
||
16 | struct context *pctx = &ctx; |
||
17 | |||
18 | f = fopen(FILENAME,"w"); |
||
19 | if (!f) { |
||
20 | perror(FILENAME); |
||
21 | return 1; |
||
22 | } |
||
23 | |||
24 | 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); |
||
26 | 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); |
||
28 | 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); |
||
30 | 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); |
||
32 | fprintf(f,"#define OFFSET_PRI 0x%x\n",((int)&pctx->pri) - (int )pctx); |
||
33 | fclose(f); |
||
34 | |||
35 | return 0; |
||
36 | } |