Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
asm-offsets.c
Go to the documentation of this file.
1 /*
2  * Generate definitions needed by assembly language modules.
3  * This code generates raw asm output which is post-processed
4  * to extract and format the required data.
5  */
6 
7 #include <linux/sched.h>
8 #include <linux/thread_info.h>
9 #include <asm/procinfo.h>
10 #include <linux/kbuild.h>
11 #include <linux/unistd.h>
12 
13 void foo(void)
14 {
15  OFFSET(REGS_A16, pt_regs, a16);
16  OFFSET(REGS_A17, pt_regs, a17);
17  OFFSET(REGS_A18, pt_regs, a18);
18  OFFSET(REGS_A19, pt_regs, a19);
19  OFFSET(REGS_A20, pt_regs, a20);
20  OFFSET(REGS_A21, pt_regs, a21);
21  OFFSET(REGS_A22, pt_regs, a22);
22  OFFSET(REGS_A23, pt_regs, a23);
23  OFFSET(REGS_A24, pt_regs, a24);
24  OFFSET(REGS_A25, pt_regs, a25);
25  OFFSET(REGS_A26, pt_regs, a26);
26  OFFSET(REGS_A27, pt_regs, a27);
27  OFFSET(REGS_A28, pt_regs, a28);
28  OFFSET(REGS_A29, pt_regs, a29);
29  OFFSET(REGS_A30, pt_regs, a30);
30  OFFSET(REGS_A31, pt_regs, a31);
31 
32  OFFSET(REGS_B16, pt_regs, b16);
33  OFFSET(REGS_B17, pt_regs, b17);
34  OFFSET(REGS_B18, pt_regs, b18);
35  OFFSET(REGS_B19, pt_regs, b19);
36  OFFSET(REGS_B20, pt_regs, b20);
37  OFFSET(REGS_B21, pt_regs, b21);
38  OFFSET(REGS_B22, pt_regs, b22);
39  OFFSET(REGS_B23, pt_regs, b23);
40  OFFSET(REGS_B24, pt_regs, b24);
41  OFFSET(REGS_B25, pt_regs, b25);
42  OFFSET(REGS_B26, pt_regs, b26);
43  OFFSET(REGS_B27, pt_regs, b27);
44  OFFSET(REGS_B28, pt_regs, b28);
45  OFFSET(REGS_B29, pt_regs, b29);
46  OFFSET(REGS_B30, pt_regs, b30);
47  OFFSET(REGS_B31, pt_regs, b31);
48 
49  OFFSET(REGS_A0, pt_regs, a0);
50  OFFSET(REGS_A1, pt_regs, a1);
51  OFFSET(REGS_A2, pt_regs, a2);
52  OFFSET(REGS_A3, pt_regs, a3);
53  OFFSET(REGS_A4, pt_regs, a4);
54  OFFSET(REGS_A5, pt_regs, a5);
55  OFFSET(REGS_A6, pt_regs, a6);
56  OFFSET(REGS_A7, pt_regs, a7);
57  OFFSET(REGS_A8, pt_regs, a8);
58  OFFSET(REGS_A9, pt_regs, a9);
59  OFFSET(REGS_A10, pt_regs, a10);
60  OFFSET(REGS_A11, pt_regs, a11);
61  OFFSET(REGS_A12, pt_regs, a12);
62  OFFSET(REGS_A13, pt_regs, a13);
63  OFFSET(REGS_A14, pt_regs, a14);
64  OFFSET(REGS_A15, pt_regs, a15);
65 
66  OFFSET(REGS_B0, pt_regs, b0);
67  OFFSET(REGS_B1, pt_regs, b1);
68  OFFSET(REGS_B2, pt_regs, b2);
69  OFFSET(REGS_B3, pt_regs, b3);
70  OFFSET(REGS_B4, pt_regs, b4);
71  OFFSET(REGS_B5, pt_regs, b5);
72  OFFSET(REGS_B6, pt_regs, b6);
73  OFFSET(REGS_B7, pt_regs, b7);
74  OFFSET(REGS_B8, pt_regs, b8);
75  OFFSET(REGS_B9, pt_regs, b9);
76  OFFSET(REGS_B10, pt_regs, b10);
77  OFFSET(REGS_B11, pt_regs, b11);
78  OFFSET(REGS_B12, pt_regs, b12);
79  OFFSET(REGS_B13, pt_regs, b13);
80  OFFSET(REGS_DP, pt_regs, dp);
82 
83  OFFSET(REGS_TSR, pt_regs, tsr);
84  OFFSET(REGS_ORIG_A4, pt_regs, orig_a4);
85 
86  DEFINE(REGS__END, sizeof(struct pt_regs));
87  BLANK();
88 
89  OFFSET(THREAD_PC, thread_struct, pc);
90  OFFSET(THREAD_B15_14, thread_struct, b15_14);
91  OFFSET(THREAD_A15_14, thread_struct, a15_14);
92  OFFSET(THREAD_B13_12, thread_struct, b13_12);
93  OFFSET(THREAD_A13_12, thread_struct, a13_12);
94  OFFSET(THREAD_B11_10, thread_struct, b11_10);
95  OFFSET(THREAD_A11_10, thread_struct, a11_10);
96  OFFSET(THREAD_RICL_ICL, thread_struct, ricl_icl);
97  BLANK();
98 
99  OFFSET(TASK_STATE, task_struct, state);
100  BLANK();
101 
102  OFFSET(THREAD_INFO_FLAGS, thread_info, flags);
103  OFFSET(THREAD_INFO_PREEMPT_COUNT, thread_info, preempt_count);
104  BLANK();
105 
106  /* These would be unneccessary if we ran asm files
107  * through the preprocessor.
108  */
110  DEFINE(KTHREAD_SHIFT, THREAD_SHIFT);
111  DEFINE(KTHREAD_START_SP, THREAD_START_SP);
112  DEFINE(ENOSYS_, ENOSYS);
113  DEFINE(NR_SYSCALLS_, __NR_syscalls);
114 
119 
122 }