Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #include <stdio.h> |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 2 | #include <user-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
| 4 | #define SC_OFFSET(name, field) \ |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 5 | printf("#define " #name "(sc) *((unsigned long *) &(((char *) (sc))[%d]))\n",\ |
| 6 | name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | |
| 8 | #define SC_FP_OFFSET(name, field) \ |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 9 | printf("#define " #name \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | "(sc) *((unsigned long *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 11 | name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | #define SC_FP_OFFSET_PTR(name, field, type) \ |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 14 | printf("#define " #name \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | "(sc) ((" type " *) &(((char *) (SC_FPSTATE(sc)))[%d]))\n",\ |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 16 | name) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | int main(int argc, char **argv) |
| 19 | { |
Al Viro | 6bae32d | 2005-05-05 16:15:25 -0700 | [diff] [blame] | 20 | SC_OFFSET(SC_IP, eip); |
| 21 | SC_OFFSET(SC_SP, esp); |
| 22 | SC_OFFSET(SC_FS, fs); |
| 23 | SC_OFFSET(SC_GS, gs); |
| 24 | SC_OFFSET(SC_DS, ds); |
| 25 | SC_OFFSET(SC_ES, es); |
| 26 | SC_OFFSET(SC_SS, ss); |
| 27 | SC_OFFSET(SC_CS, cs); |
| 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"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | return(0); |
| 51 | } |