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