blob: 1915c7c889ba7dbc7b94e87b85d7551d93eb92b2 [file] [log] [blame]
Chris Zankel5a0015d2005-06-23 22:01:16 -07001/*
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 <chris@zankel.net>
13 */
14
15#include <asm/processor.h>
Chris Zankel4573e392010-05-02 01:05:13 -070016#include <asm/coprocessor.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070017
18#include <linux/types.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070019#include <linux/stddef.h>
20#include <linux/thread_info.h>
21#include <linux/ptrace.h>
Chris Zankel66569202007-08-22 10:14:51 -070022#include <linux/mm.h>
Christoph Lameter0fcfbb12008-04-29 01:04:00 -070023#include <linux/kbuild.h>
Chris Zankel66569202007-08-22 10:14:51 -070024
Chris Zankel5a0015d2005-06-23 22:01:16 -070025#include <asm/ptrace.h>
Chris Zankel5a0015d2005-06-23 22:01:16 -070026#include <asm/uaccess.h>
27
Chris Zankel5a0015d2005-06-23 22:01:16 -070028int main(void)
29{
30 /* struct pt_regs */
31 DEFINE(PT_PC, offsetof (struct pt_regs, pc));
32 DEFINE(PT_PS, offsetof (struct pt_regs, ps));
33 DEFINE(PT_DEPC, offsetof (struct pt_regs, depc));
34 DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause));
35 DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr));
36 DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause));
37 DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask));
38 DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg));
39 DEFINE(PT_LEND, offsetof (struct pt_regs, lend));
40 DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount));
41 DEFINE(PT_SAR, offsetof (struct pt_regs, sar));
Chris Zankel29c4dfd2007-05-31 17:49:32 -070042 DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel));
Chris Zankel5a0015d2005-06-23 22:01:16 -070043 DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall));
Max Filippov733536b2012-11-15 06:25:48 +040044 DEFINE(PT_SCOMPARE1, offsetof(struct pt_regs, scompare1));
Chris Zankelc50842d2013-02-23 19:35:57 -080045 DEFINE(PT_THREADPTR, offsetof(struct pt_regs, threadptr));
Chris Zankel5a0015d2005-06-23 22:01:16 -070046 DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0]));
47 DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0]));
48 DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1]));
49 DEFINE(PT_AREG2, offsetof (struct pt_regs, areg[2]));
50 DEFINE(PT_AREG3, offsetof (struct pt_regs, areg[3]));
51 DEFINE(PT_AREG4, offsetof (struct pt_regs, areg[4]));
52 DEFINE(PT_AREG5, offsetof (struct pt_regs, areg[5]));
53 DEFINE(PT_AREG6, offsetof (struct pt_regs, areg[6]));
54 DEFINE(PT_AREG7, offsetof (struct pt_regs, areg[7]));
55 DEFINE(PT_AREG8, offsetof (struct pt_regs, areg[8]));
56 DEFINE(PT_AREG9, offsetof (struct pt_regs, areg[9]));
57 DEFINE(PT_AREG10, offsetof (struct pt_regs, areg[10]));
58 DEFINE(PT_AREG11, offsetof (struct pt_regs, areg[11]));
59 DEFINE(PT_AREG12, offsetof (struct pt_regs, areg[12]));
60 DEFINE(PT_AREG13, offsetof (struct pt_regs, areg[13]));
61 DEFINE(PT_AREG14, offsetof (struct pt_regs, areg[14]));
62 DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15]));
63 DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase));
64 DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart));
65 DEFINE(PT_SIZE, sizeof(struct pt_regs));
66 DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
67 DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
Chris Zankelc658eac2008-02-12 13:17:07 -080068 DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
69 DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t));
Chris Zankel5a0015d2005-06-23 22:01:16 -070070
71 /* struct task_struct */
72 DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace));
73 DEFINE(TASK_MM, offsetof (struct task_struct, mm));
74 DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm));
75 DEFINE(TASK_PID, offsetof (struct task_struct, pid));
76 DEFINE(TASK_THREAD, offsetof (struct task_struct, thread));
Roman Zippelf7e42172007-05-09 02:35:17 -070077 DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack));
Chris Zankel5a0015d2005-06-23 22:01:16 -070078 DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct));
Chris Zankel5a0015d2005-06-23 22:01:16 -070079
80 /* struct thread_info (offset from start_struct) */
81 DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
82 DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
Chris Zankelc658eac2008-02-12 13:17:07 -080083 DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
84#if XTENSA_HAVE_COPROCESSORS
85 DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp));
86 DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp));
87 DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp));
88 DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp));
89 DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp));
90 DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp));
91 DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp));
92 DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp));
93#endif
94 DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
95 DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
Chris Zankelc4c45942012-11-28 16:53:51 -080096 DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, \
97 thread.current_ds));
Chris Zankel5a0015d2005-06-23 22:01:16 -070098
99 /* struct mm_struct */
100 DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users));
101 DEFINE(MM_PGD, offsetof (struct mm_struct, pgd));
102 DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context));
Chris Zankel66569202007-08-22 10:14:51 -0700103
104 /* struct page */
105 DEFINE(PAGE_FLAGS, offsetof(struct page, flags));
Chris Zankelfc4fb2a2006-12-10 02:18:52 -0800106
107 /* constants */
108 DEFINE(_CLONE_VM, CLONE_VM);
109 DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED);
Chris Zankel66569202007-08-22 10:14:51 -0700110 DEFINE(PG_ARCH_1, PG_arch_1);
Chris Zankelfc4fb2a2006-12-10 02:18:52 -0800111
Chris Zankel5a0015d2005-06-23 22:01:16 -0700112 return 0;
113}