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  * 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, [email protected] and Carsten Langgaard, [email protected]
6  * Copyright (C) 2000 MIPS Technologies, Inc.
7  *
8  * Copyright (c) 2010-2011, 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_UGPGP, pt_regs, ugpgp);
48  OFFSET(_PT_R3130, pt_regs, r3130);
49  OFFSET(_PT_R2928, pt_regs, r2928);
50  OFFSET(_PT_R2726, pt_regs, r2726);
51  OFFSET(_PT_R2524, pt_regs, r2524);
52  OFFSET(_PT_R2322, pt_regs, r2322);
53  OFFSET(_PT_R2120, pt_regs, r2120);
54  OFFSET(_PT_R1918, pt_regs, r1918);
55  OFFSET(_PT_R1716, pt_regs, r1716);
56  OFFSET(_PT_R1514, pt_regs, r1514);
57  OFFSET(_PT_R1312, pt_regs, r1312);
58  OFFSET(_PT_R1110, pt_regs, r1110);
59  OFFSET(_PT_R0908, pt_regs, r0908);
60  OFFSET(_PT_R0706, pt_regs, r0706);
61  OFFSET(_PT_R0504, pt_regs, r0504);
62  OFFSET(_PT_R0302, pt_regs, r0302);
63  OFFSET(_PT_R0100, pt_regs, r0100);
64  OFFSET(_PT_LC0SA0, pt_regs, lc0sa0);
65  OFFSET(_PT_LC1SA1, pt_regs, lc1sa1);
66  OFFSET(_PT_M1M0, pt_regs, m1m0);
67  OFFSET(_PT_PREDSUSR, pt_regs, predsusr);
68  OFFSET(_PT_EVREC, pt_regs, hvmer);
69  OFFSET(_PT_ER_VMEL, pt_regs, hvmer.vmel);
70  OFFSET(_PT_ER_VMEST, pt_regs, hvmer.vmest);
71  OFFSET(_PT_ER_VMPSP, pt_regs, hvmer.vmpsp);
72  OFFSET(_PT_ER_VMBADVA, pt_regs, hvmer.vmbadva);
73  DEFINE(_PT_REGS_SIZE, sizeof(struct pt_regs));
74  BLANK();
75 
76  COMMENT("Hexagon thread_info definitions");
77  OFFSET(_THREAD_INFO_FLAGS, thread_info, flags);
78  OFFSET(_THREAD_INFO_PT_REGS, thread_info, regs);
79  OFFSET(_THREAD_INFO_SP, thread_info, sp);
80  DEFINE(_THREAD_SIZE, THREAD_SIZE);
81  BLANK();
82 
83  COMMENT("Hexagon hexagon_switch_stack definitions");
84  OFFSET(_SWITCH_R1716, hexagon_switch_stack, r1716);
85  OFFSET(_SWITCH_R1918, hexagon_switch_stack, r1918);
86  OFFSET(_SWITCH_R2120, hexagon_switch_stack, r2120);
87  OFFSET(_SWITCH_R2322, hexagon_switch_stack, r2322);
88 
89  OFFSET(_SWITCH_R2524, hexagon_switch_stack, r2524);
90  OFFSET(_SWITCH_R2726, hexagon_switch_stack, r2726);
91  OFFSET(_SWITCH_FP, hexagon_switch_stack, fp);
92  OFFSET(_SWITCH_LR, hexagon_switch_stack, lr);
93  DEFINE(_SWITCH_STACK_SIZE, sizeof(struct hexagon_switch_stack));
94  BLANK();
95 
96  COMMENT("Hexagon task_struct definitions");
97  OFFSET(_TASK_THREAD_INFO, task_struct, stack);
98  OFFSET(_TASK_STRUCT_THREAD, task_struct, thread);
99 
100  COMMENT("Hexagon thread_struct definitions");
101  OFFSET(_THREAD_STRUCT_SWITCH_SP, thread_struct, switch_sp);
102 
103  return 0;
104 }