xref: /openbmc/linux/arch/nios2/kernel/asm-offsets.c (revision 0da85d1e)
1 /*
2  * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
19 #include <linux/stddef.h>
20 #include <linux/sched.h>
21 #include <linux/kernel_stat.h>
22 #include <linux/ptrace.h>
23 #include <linux/hardirq.h>
24 #include <linux/thread_info.h>
25 #include <linux/kbuild.h>
26 
27 int main(void)
28 {
29 	/* struct task_struct */
30 	OFFSET(TASK_THREAD, task_struct, thread);
31 	BLANK();
32 
33 	/* struct thread_struct */
34 	OFFSET(THREAD_KSP, thread_struct, ksp);
35 	OFFSET(THREAD_KPSR, thread_struct, kpsr);
36 	BLANK();
37 
38 	/* struct pt_regs */
39 	OFFSET(PT_ORIG_R2, pt_regs, orig_r2);
40 	OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
41 
42 	OFFSET(PT_R1, pt_regs, r1);
43 	OFFSET(PT_R2, pt_regs, r2);
44 	OFFSET(PT_R3, pt_regs, r3);
45 	OFFSET(PT_R4, pt_regs, r4);
46 	OFFSET(PT_R5, pt_regs, r5);
47 	OFFSET(PT_R6, pt_regs, r6);
48 	OFFSET(PT_R7, pt_regs, r7);
49 	OFFSET(PT_R8, pt_regs, r8);
50 	OFFSET(PT_R9, pt_regs, r9);
51 	OFFSET(PT_R10, pt_regs, r10);
52 	OFFSET(PT_R11, pt_regs, r11);
53 	OFFSET(PT_R12, pt_regs, r12);
54 	OFFSET(PT_R13, pt_regs, r13);
55 	OFFSET(PT_R14, pt_regs, r14);
56 	OFFSET(PT_R15, pt_regs, r15);
57 	OFFSET(PT_EA, pt_regs, ea);
58 	OFFSET(PT_RA, pt_regs, ra);
59 	OFFSET(PT_FP, pt_regs, fp);
60 	OFFSET(PT_SP, pt_regs, sp);
61 	OFFSET(PT_GP, pt_regs, gp);
62 	OFFSET(PT_ESTATUS, pt_regs, estatus);
63 	DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
64 	BLANK();
65 
66 	/* struct switch_stack */
67 	OFFSET(SW_R16, switch_stack, r16);
68 	OFFSET(SW_R17, switch_stack, r17);
69 	OFFSET(SW_R18, switch_stack, r18);
70 	OFFSET(SW_R19, switch_stack, r19);
71 	OFFSET(SW_R20, switch_stack, r20);
72 	OFFSET(SW_R21, switch_stack, r21);
73 	OFFSET(SW_R22, switch_stack, r22);
74 	OFFSET(SW_R23, switch_stack, r23);
75 	OFFSET(SW_FP, switch_stack, fp);
76 	OFFSET(SW_GP, switch_stack, gp);
77 	OFFSET(SW_RA, switch_stack, ra);
78 	DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
79 	BLANK();
80 
81 	/* struct thread_info */
82 	OFFSET(TI_FLAGS, thread_info, flags);
83 	OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
84 	BLANK();
85 
86 	return 0;
87 }
88