]>
Commit | Line | Data |
---|---|---|
5a0015d6 CZ |
1 | /* |
2 | * arch/xtensa/kernel/asm-offsets.c | |
3 | * | |
4 | * Generates definitions from c-type structures used by assembly sources. | |
5 | * | |
6 | * This file is subject to the terms and conditions of the GNU General Public | |
7 | * License. See the file "COPYING" in the main directory of this archive | |
8 | * for more details. | |
9 | * | |
10 | * Copyright (C) 2005 Tensilica Inc. | |
11 | * | |
12 | * Chris Zankel <[email protected]> | |
13 | */ | |
14 | ||
15 | #include <asm/processor.h> | |
4573e398 | 16 | #include <asm/coprocessor.h> |
5a0015d6 CZ |
17 | |
18 | #include <linux/types.h> | |
5a0015d6 CZ |
19 | #include <linux/stddef.h> |
20 | #include <linux/thread_info.h> | |
21 | #include <linux/ptrace.h> | |
6656920b | 22 | #include <linux/mm.h> |
0fcfbb1d | 23 | #include <linux/kbuild.h> |
6656920b | 24 | |
5a0015d6 | 25 | #include <asm/ptrace.h> |
6ec7026a | 26 | #include <asm/traps.h> |
7c0f6ba6 | 27 | #include <linux/uaccess.h> |
5a0015d6 | 28 | |
5a0015d6 CZ |
29 | int main(void) |
30 | { | |
31 | /* struct pt_regs */ | |
32 | DEFINE(PT_PC, offsetof (struct pt_regs, pc)); | |
33 | DEFINE(PT_PS, offsetof (struct pt_regs, ps)); | |
34 | DEFINE(PT_DEPC, offsetof (struct pt_regs, depc)); | |
35 | DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause)); | |
36 | DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr)); | |
37 | DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause)); | |
38 | DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask)); | |
39 | DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg)); | |
40 | DEFINE(PT_LEND, offsetof (struct pt_regs, lend)); | |
41 | DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount)); | |
42 | DEFINE(PT_SAR, offsetof (struct pt_regs, sar)); | |
29c4dfd9 | 43 | DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel)); |
5a0015d6 | 44 | DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall)); |
733536b8 | 45 | DEFINE(PT_SCOMPARE1, offsetof(struct pt_regs, scompare1)); |
c50842df | 46 | DEFINE(PT_THREADPTR, offsetof(struct pt_regs, threadptr)); |
5a0015d6 CZ |
47 | DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0])); |
48 | DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0])); | |
49 | DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1])); | |
50 | DEFINE(PT_AREG2, offsetof (struct pt_regs, areg[2])); | |
51 | DEFINE(PT_AREG3, offsetof (struct pt_regs, areg[3])); | |
52 | DEFINE(PT_AREG4, offsetof (struct pt_regs, areg[4])); | |
53 | DEFINE(PT_AREG5, offsetof (struct pt_regs, areg[5])); | |
54 | DEFINE(PT_AREG6, offsetof (struct pt_regs, areg[6])); | |
55 | DEFINE(PT_AREG7, offsetof (struct pt_regs, areg[7])); | |
56 | DEFINE(PT_AREG8, offsetof (struct pt_regs, areg[8])); | |
57 | DEFINE(PT_AREG9, offsetof (struct pt_regs, areg[9])); | |
58 | DEFINE(PT_AREG10, offsetof (struct pt_regs, areg[10])); | |
59 | DEFINE(PT_AREG11, offsetof (struct pt_regs, areg[11])); | |
60 | DEFINE(PT_AREG12, offsetof (struct pt_regs, areg[12])); | |
61 | DEFINE(PT_AREG13, offsetof (struct pt_regs, areg[13])); | |
62 | DEFINE(PT_AREG14, offsetof (struct pt_regs, areg[14])); | |
63 | DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15])); | |
64 | DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase)); | |
65 | DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart)); | |
66 | DEFINE(PT_SIZE, sizeof(struct pt_regs)); | |
67 | DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); | |
68 | DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); | |
c658eac6 CZ |
69 | DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt)); |
70 | DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t)); | |
5a0015d6 CZ |
71 | |
72 | /* struct task_struct */ | |
73 | DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace)); | |
74 | DEFINE(TASK_MM, offsetof (struct task_struct, mm)); | |
75 | DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm)); | |
76 | DEFINE(TASK_PID, offsetof (struct task_struct, pid)); | |
77 | DEFINE(TASK_THREAD, offsetof (struct task_struct, thread)); | |
f7e4217b | 78 | DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack)); |
050e9baa | 79 | #ifdef CONFIG_STACKPROTECTOR |
40d1a07b MF |
80 | DEFINE(TASK_STACK_CANARY, offsetof(struct task_struct, stack_canary)); |
81 | #endif | |
5a0015d6 | 82 | DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct)); |
5a0015d6 | 83 | |
cb418fdb RW |
84 | /* offsets in thread_info struct */ |
85 | OFFSET(TI_TASK, thread_info, task); | |
86 | OFFSET(TI_FLAGS, thread_info, flags); | |
87 | OFFSET(TI_STSTUS, thread_info, status); | |
88 | OFFSET(TI_CPU, thread_info, cpu); | |
89 | OFFSET(TI_PRE_COUNT, thread_info, preempt_count); | |
90 | OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); | |
91 | ||
5a0015d6 CZ |
92 | /* struct thread_info (offset from start_struct) */ |
93 | DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra)); | |
94 | DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); | |
c658eac6 CZ |
95 | DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable)); |
96 | #if XTENSA_HAVE_COPROCESSORS | |
03bc996a MF |
97 | DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0)); |
98 | DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1)); | |
99 | DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2)); | |
100 | DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3)); | |
101 | DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4)); | |
102 | DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5)); | |
103 | DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6)); | |
104 | DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7)); | |
c658eac6 CZ |
105 | #endif |
106 | DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user)); | |
107 | DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t)); | |
c4c4594b CZ |
108 | DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, \ |
109 | thread.current_ds)); | |
5a0015d6 CZ |
110 | |
111 | /* struct mm_struct */ | |
112 | DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users)); | |
113 | DEFINE(MM_PGD, offsetof (struct mm_struct, pgd)); | |
114 | DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context)); | |
6656920b CZ |
115 | |
116 | /* struct page */ | |
117 | DEFINE(PAGE_FLAGS, offsetof(struct page, flags)); | |
fc4fb2ad CZ |
118 | |
119 | /* constants */ | |
120 | DEFINE(_CLONE_VM, CLONE_VM); | |
121 | DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED); | |
6656920b | 122 | DEFINE(PG_ARCH_1, PG_arch_1); |
fc4fb2ad | 123 | |
6ec7026a MF |
124 | /* struct debug_table */ |
125 | DEFINE(DT_DEBUG_EXCEPTION, | |
126 | offsetof(struct debug_table, debug_exception)); | |
127 | DEFINE(DT_DEBUG_SAVE, offsetof(struct debug_table, debug_save)); | |
c91e02bd MF |
128 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
129 | DEFINE(DT_DBREAKC_SAVE, offsetof(struct debug_table, dbreakc_save)); | |
130 | DEFINE(DT_ICOUNT_SAVE, offsetof(struct debug_table, icount_save)); | |
131 | DEFINE(DT_ICOUNT_LEVEL_SAVE, | |
132 | offsetof(struct debug_table, icount_level_save)); | |
133 | #endif | |
6ec7026a | 134 | |
f21a79ca MF |
135 | /* struct exc_table */ |
136 | DEFINE(EXC_TABLE_KSTK, offsetof(struct exc_table, kstk)); | |
137 | DEFINE(EXC_TABLE_DOUBLE_SAVE, offsetof(struct exc_table, double_save)); | |
138 | DEFINE(EXC_TABLE_FIXUP, offsetof(struct exc_table, fixup)); | |
139 | DEFINE(EXC_TABLE_PARAM, offsetof(struct exc_table, fixup_param)); | |
140 | DEFINE(EXC_TABLE_SYSCALL_SAVE, | |
141 | offsetof(struct exc_table, syscall_save)); | |
142 | DEFINE(EXC_TABLE_FAST_USER, | |
143 | offsetof(struct exc_table, fast_user_handler)); | |
144 | DEFINE(EXC_TABLE_FAST_KERNEL, | |
145 | offsetof(struct exc_table, fast_kernel_handler)); | |
146 | DEFINE(EXC_TABLE_DEFAULT, offsetof(struct exc_table, default_handler)); | |
147 | ||
5a0015d6 CZ |
148 | return 0; |
149 | } |