lfn
serial
ticket/834-toolchain-update
topic/msim-upgrade
topic/simplify-dev-export
Last change
on this file since 5bb8e45 was 4b2c872d, checked in by Jakub Jermar <jakub@…>, 20 years ago |
Create generic context_save() and context_restore().
These two functions are defined inline and only call context_save_arch() and context_restore_arch(), respectively.
The main purpose of this is to enable centralized commenting of these important and tricky functions.
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | #include <stdio.h>
|
---|
2 |
|
---|
3 |
|
---|
4 | typedef long long __u64;
|
---|
5 | typedef __u64 ipl_t;
|
---|
6 | typedef __u64 __address;
|
---|
7 |
|
---|
8 | #define __amd64_TYPES_H__
|
---|
9 | #include "../../arch/amd64/include/context.h"
|
---|
10 |
|
---|
11 | #define FILENAME "../../arch/amd64/include/context_offset.h"
|
---|
12 |
|
---|
13 | int main(void)
|
---|
14 | {
|
---|
15 | FILE *f;
|
---|
16 | struct context ctx;
|
---|
17 | struct context *pctx = &ctx;
|
---|
18 |
|
---|
19 | f = fopen(FILENAME,"w");
|
---|
20 | if (!f) {
|
---|
21 | perror(FILENAME);
|
---|
22 | return 1;
|
---|
23 | }
|
---|
24 |
|
---|
25 | fprintf(f, "/* This file is automatically generated by %s. */\n", __FILE__);
|
---|
26 |
|
---|
27 | fprintf(f,"#define OFFSET_SP 0x%x\n",((int)&pctx->sp) - (int )pctx);
|
---|
28 | fprintf(f,"#define OFFSET_PC 0x%x\n",((int)&pctx->pc) - (int )pctx);
|
---|
29 | fprintf(f,"#define OFFSET_RBX 0x%x\n",((int)&pctx->rbx) - (int )pctx);
|
---|
30 | fprintf(f,"#define OFFSET_RBP 0x%x\n",((int)&pctx->rbp) - (int )pctx);
|
---|
31 | fprintf(f,"#define OFFSET_R12 0x%x\n",((int)&pctx->r12) - (int )pctx);
|
---|
32 | fprintf(f,"#define OFFSET_R13 0x%x\n",((int)&pctx->r13) - (int )pctx);
|
---|
33 | fprintf(f,"#define OFFSET_R14 0x%x\n",((int)&pctx->r14) - (int )pctx);
|
---|
34 | fprintf(f,"#define OFFSET_R15 0x%x\n",((int)&pctx->r15) - (int )pctx);
|
---|
35 | fprintf(f,"#define OFFSET_IPL 0x%x\n",((int)&pctx->ipl) - (int )pctx);
|
---|
36 | fclose(f);
|
---|
37 |
|
---|
38 | return 0;
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.