Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 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 <chris@zankel.net> |
| 13 | */ |
| 14 | |
| 15 | #include <asm/processor.h> |
| 16 | |
| 17 | #include <linux/types.h> |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 18 | #include <linux/stddef.h> |
| 19 | #include <linux/thread_info.h> |
| 20 | #include <linux/ptrace.h> |
Chris Zankel | 6656920 | 2007-08-22 10:14:51 -0700 | [diff] [blame] | 21 | #include <linux/mm.h> |
Christoph Lameter | 0fcfbb1 | 2008-04-29 01:04:00 -0700 | [diff] [blame] | 22 | #include <linux/kbuild.h> |
Chris Zankel | 6656920 | 2007-08-22 10:14:51 -0700 | [diff] [blame] | 23 | |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 24 | #include <asm/ptrace.h> |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 25 | #include <asm/uaccess.h> |
| 26 | |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 27 | int main(void) |
| 28 | { |
| 29 | /* struct pt_regs */ |
| 30 | DEFINE(PT_PC, offsetof (struct pt_regs, pc)); |
| 31 | DEFINE(PT_PS, offsetof (struct pt_regs, ps)); |
| 32 | DEFINE(PT_DEPC, offsetof (struct pt_regs, depc)); |
| 33 | DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause)); |
| 34 | DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr)); |
| 35 | DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause)); |
| 36 | DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask)); |
| 37 | DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg)); |
| 38 | DEFINE(PT_LEND, offsetof (struct pt_regs, lend)); |
| 39 | DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount)); |
| 40 | DEFINE(PT_SAR, offsetof (struct pt_regs, sar)); |
Chris Zankel | 29c4dfd | 2007-05-31 17:49:32 -0700 | [diff] [blame] | 41 | DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 42 | DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall)); |
| 43 | DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0])); |
| 44 | DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0])); |
| 45 | DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1])); |
| 46 | DEFINE(PT_AREG2, offsetof (struct pt_regs, areg[2])); |
| 47 | DEFINE(PT_AREG3, offsetof (struct pt_regs, areg[3])); |
| 48 | DEFINE(PT_AREG4, offsetof (struct pt_regs, areg[4])); |
| 49 | DEFINE(PT_AREG5, offsetof (struct pt_regs, areg[5])); |
| 50 | DEFINE(PT_AREG6, offsetof (struct pt_regs, areg[6])); |
| 51 | DEFINE(PT_AREG7, offsetof (struct pt_regs, areg[7])); |
| 52 | DEFINE(PT_AREG8, offsetof (struct pt_regs, areg[8])); |
| 53 | DEFINE(PT_AREG9, offsetof (struct pt_regs, areg[9])); |
| 54 | DEFINE(PT_AREG10, offsetof (struct pt_regs, areg[10])); |
| 55 | DEFINE(PT_AREG11, offsetof (struct pt_regs, areg[11])); |
| 56 | DEFINE(PT_AREG12, offsetof (struct pt_regs, areg[12])); |
| 57 | DEFINE(PT_AREG13, offsetof (struct pt_regs, areg[13])); |
| 58 | DEFINE(PT_AREG14, offsetof (struct pt_regs, areg[14])); |
| 59 | DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15])); |
| 60 | DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase)); |
| 61 | DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart)); |
| 62 | DEFINE(PT_SIZE, sizeof(struct pt_regs)); |
| 63 | DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); |
| 64 | DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); |
Chris Zankel | c658eac | 2008-02-12 13:17:07 -0800 | [diff] [blame] | 65 | DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt)); |
| 66 | DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 67 | |
| 68 | /* struct task_struct */ |
| 69 | DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace)); |
| 70 | DEFINE(TASK_MM, offsetof (struct task_struct, mm)); |
| 71 | DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm)); |
| 72 | DEFINE(TASK_PID, offsetof (struct task_struct, pid)); |
| 73 | DEFINE(TASK_THREAD, offsetof (struct task_struct, thread)); |
Roman Zippel | f7e4217 | 2007-05-09 02:35:17 -0700 | [diff] [blame] | 74 | DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 75 | DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 76 | |
| 77 | /* struct thread_info (offset from start_struct) */ |
| 78 | DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra)); |
| 79 | DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); |
Chris Zankel | c658eac | 2008-02-12 13:17:07 -0800 | [diff] [blame] | 80 | DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable)); |
| 81 | #if XTENSA_HAVE_COPROCESSORS |
| 82 | DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp)); |
| 83 | DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp)); |
| 84 | DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp)); |
| 85 | DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp)); |
| 86 | DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp)); |
| 87 | DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp)); |
| 88 | DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp)); |
| 89 | DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp)); |
| 90 | #endif |
| 91 | DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user)); |
| 92 | DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 93 | DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds)); |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 94 | |
| 95 | /* struct mm_struct */ |
| 96 | DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users)); |
| 97 | DEFINE(MM_PGD, offsetof (struct mm_struct, pgd)); |
| 98 | DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context)); |
Chris Zankel | 6656920 | 2007-08-22 10:14:51 -0700 | [diff] [blame] | 99 | |
| 100 | /* struct page */ |
| 101 | DEFINE(PAGE_FLAGS, offsetof(struct page, flags)); |
Chris Zankel | fc4fb2a | 2006-12-10 02:18:52 -0800 | [diff] [blame] | 102 | |
| 103 | /* constants */ |
| 104 | DEFINE(_CLONE_VM, CLONE_VM); |
| 105 | DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED); |
Chris Zankel | 6656920 | 2007-08-22 10:14:51 -0700 | [diff] [blame] | 106 | DEFINE(PG_ARCH_1, PG_arch_1); |
Chris Zankel | fc4fb2a | 2006-12-10 02:18:52 -0800 | [diff] [blame] | 107 | |
Chris Zankel | 5a0015d | 2005-06-23 22:01:16 -0700 | [diff] [blame] | 108 | return 0; |
| 109 | } |
| 110 | |