2 #include <user-offsets.h>
4 #define SC_OFFSET(name, field) \
5 printf("#define " #name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\
8 #define SC_FP_OFFSET(name, field) \
9 printf("#define " #name \
10 "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
13 #define SC_FP_OFFSET_PTR(name, field, type) \
14 printf("#define " #name \
15 "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\
18 int main(int argc
, char **argv
)
20 SC_OFFSET(SC_IP
, eip
);
21 SC_OFFSET(SC_SP
, esp
);
28 SC_OFFSET(SC_EFLAGS
, eflags
);
29 SC_OFFSET(SC_EAX
, eax
);
30 SC_OFFSET(SC_EBX
, ebx
);
31 SC_OFFSET(SC_ECX
, ecx
);
32 SC_OFFSET(SC_EDX
, edx
);
33 SC_OFFSET(SC_EDI
, edi
);
34 SC_OFFSET(SC_ESI
, esi
);
35 SC_OFFSET(SC_EBP
, ebp
);
36 SC_OFFSET(SC_TRAPNO
, trapno
);
37 SC_OFFSET(SC_ERR
, err
);
38 SC_OFFSET(SC_CR2
, cr2
);
39 SC_OFFSET(SC_FPSTATE
, fpstate
);
40 SC_OFFSET(SC_SIGMASK
, oldmask
);
41 SC_FP_OFFSET(SC_FP_CW
, cw
);
42 SC_FP_OFFSET(SC_FP_SW
, sw
);
43 SC_FP_OFFSET(SC_FP_TAG
, tag
);
44 SC_FP_OFFSET(SC_FP_IPOFF
, ipoff
);
45 SC_FP_OFFSET(SC_FP_CSSEL
, cssel
);
46 SC_FP_OFFSET(SC_FP_DATAOFF
, dataoff
);
47 SC_FP_OFFSET(SC_FP_DATASEL
, datasel
);
48 SC_FP_OFFSET_PTR(SC_FP_ST
, _st
, "struct _fpstate");
49 SC_FP_OFFSET_PTR(SC_FXSR_ENV
, _fxsr_env
, "void");