1 /*
2  * Copyright (C) 1996 David S. Miller
3  * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003 Ralf Baechle
4  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
5  * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
6  * Copyright (C) 2000 MIPS Technologies, Inc.
7  *
8  * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 and
12  * only version 2 as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22  * 02110-1301, USA.
23  */
24 
25 #include <linux/compat.h>
26 #include <linux/types.h>
27 #include <linux/sched.h>
28 #include <linux/mm.h>
29 #include <linux/interrupt.h>
30 #include <linux/kbuild.h>
31 #include <asm/ptrace.h>
32 #include <asm/processor.h>
33 
34 /*  This file is used to produce asm/linkerscript constants from header
35     files typically used in c.  Specifically, it generates asm-offsets.h  */
36 
37 int main(void)
38 {
39 	COMMENT("This is a comment.");
40 	/*  might get these from somewhere else.  */
41 	DEFINE(_PAGE_SIZE, PAGE_SIZE);
42 	DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
43 	BLANK();
44 
45 	COMMENT("Hexagon pt_regs definitions");
46 	OFFSET(_PT_SYSCALL_NR, pt_regs, syscall_nr);
47 	OFFSET(_PT_GPUGP, pt_regs, gpugp);
48 	OFFSET(_PT_CS1CS0, pt_regs, cs1cs0);
49 	OFFSET(_PT_R3130, pt_regs, r3130);
50 	OFFSET(_PT_R2928, pt_regs, r2928);
51 	OFFSET(_PT_R2726, pt_regs, r2726);
52 	OFFSET(_PT_R2524, pt_regs, r2524);
53 	OFFSET(_PT_R2322, pt_regs, r2322);
54 	OFFSET(_PT_R2120, pt_regs, r2120);
55 	OFFSET(_PT_R1918, pt_regs, r1918);
56 	OFFSET(_PT_R1716, pt_regs, r1716);
57 	OFFSET(_PT_R1514, pt_regs, r1514);
58 	OFFSET(_PT_R1312, pt_regs, r1312);
59 	OFFSET(_PT_R1110, pt_regs, r1110);
60 	OFFSET(_PT_R0908, pt_regs, r0908);
61 	OFFSET(_PT_R0706, pt_regs, r0706);
62 	OFFSET(_PT_R0504, pt_regs, r0504);
63 	OFFSET(_PT_R0302, pt_regs, r0302);
64 	OFFSET(_PT_R0100, pt_regs, r0100);
65 	OFFSET(_PT_LC0SA0, pt_regs, lc0sa0);
66 	OFFSET(_PT_LC1SA1, pt_regs, lc1sa1);
67 	OFFSET(_PT_M1M0, pt_regs, m1m0);
68 	OFFSET(_PT_PREDSUSR, pt_regs, predsusr);
69 	OFFSET(_PT_EVREC, pt_regs, hvmer);
70 	OFFSET(_PT_ER_VMEL, pt_regs, hvmer.vmel);
71 	OFFSET(_PT_ER_VMEST, pt_regs, hvmer.vmest);
72 	OFFSET(_PT_ER_VMPSP, pt_regs, hvmer.vmpsp);
73 	OFFSET(_PT_ER_VMBADVA, pt_regs, hvmer.vmbadva);
74 	DEFINE(_PT_REGS_SIZE, sizeof(struct pt_regs));
75 	BLANK();
76 
77 	COMMENT("Hexagon thread_info definitions");
78 	OFFSET(_THREAD_INFO_FLAGS, thread_info, flags);
79 	OFFSET(_THREAD_INFO_PT_REGS, thread_info, regs);
80 	OFFSET(_THREAD_INFO_SP, thread_info, sp);
81 	DEFINE(_THREAD_SIZE, THREAD_SIZE);
82 	BLANK();
83 
84 	COMMENT("Hexagon hexagon_switch_stack definitions");
85 	OFFSET(_SWITCH_R1716, hexagon_switch_stack, r1716);
86 	OFFSET(_SWITCH_R1918, hexagon_switch_stack, r1918);
87 	OFFSET(_SWITCH_R2120, hexagon_switch_stack, r2120);
88 	OFFSET(_SWITCH_R2322, hexagon_switch_stack, r2322);
89 
90 	OFFSET(_SWITCH_R2524, hexagon_switch_stack, r2524);
91 	OFFSET(_SWITCH_R2726, hexagon_switch_stack, r2726);
92 	OFFSET(_SWITCH_FP, hexagon_switch_stack, fp);
93 	OFFSET(_SWITCH_LR, hexagon_switch_stack, lr);
94 	DEFINE(_SWITCH_STACK_SIZE, sizeof(struct hexagon_switch_stack));
95 	BLANK();
96 
97 	COMMENT("Hexagon task_struct definitions");
98 	OFFSET(_TASK_THREAD_INFO, task_struct, stack);
99 	OFFSET(_TASK_STRUCT_THREAD, task_struct, thread);
100 
101 	COMMENT("Hexagon thread_struct definitions");
102 	OFFSET(_THREAD_STRUCT_SWITCH_SP, thread_struct, switch_sp);
103 
104 	return 0;
105 }
106