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 #include <linux/sched.h>
2 #include <asm/thread_info.h>
3 
4 /*
5  * Generate definitions needed by assembly language modules.
6  * This code generates raw asm output which is post-processed to extract
7  * and format the required data.
8  */
9 
10 #define DEFINE(sym, val) \
11  asm volatile("\n->" #sym " %0 " #val : : "i" (val))
12 
13 #define BLANK() asm volatile("\n->" : : )
14 
15 #if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32)
16 #error One of ARCH v10 and ARCH v32 must be true!
17 #endif
18 
19 int main(void)
20 {
21 #define ENTRY(entry) DEFINE(PT_ ## entry, offsetof(struct pt_regs, entry))
22  ENTRY(orig_r10);
23  ENTRY(r13);
24  ENTRY(r12);
25  ENTRY(r11);
26  ENTRY(r10);
27  ENTRY(r9);
28 #ifdef CONFIG_ETRAX_ARCH_V32
29  ENTRY(acr);
30  ENTRY(srs);
31 #endif
32  ENTRY(mof);
33 #ifdef CONFIG_ETRAX_ARCH_V10
34  ENTRY(dccr);
35 #else
36  ENTRY(ccs);
37 #endif
38  ENTRY(srp);
39  BLANK();
40 #undef ENTRY
41 #define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
42  ENTRY(task);
43  ENTRY(flags);
45  BLANK();
46 #undef ENTRY
47 #define ENTRY(entry) DEFINE(THREAD_ ## entry, offsetof(struct thread_struct, entry))
48  ENTRY(ksp);
49  ENTRY(usp);
50 #ifdef CONFIG_ETRAX_ARCH_V10
51  ENTRY(dccr);
52 #else
53  ENTRY(ccs);
54 #endif
55  BLANK();
56 #undef ENTRY
57 #define ENTRY(entry) DEFINE(TASK_ ## entry, offsetof(struct task_struct, entry))
58  ENTRY(pid);
59  BLANK();
62  return 0;
63 }