18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * arch/xtensa/kernel/asm-offsets.c 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Generates definitions from c-type structures used by assembly sources. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 78c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 88c2ecf20Sopenharmony_ci * for more details. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Copyright (C) 2005 Tensilica Inc. 118c2ecf20Sopenharmony_ci * 128c2ecf20Sopenharmony_ci * Chris Zankel <chris@zankel.net> 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include <asm/processor.h> 168c2ecf20Sopenharmony_ci#include <asm/coprocessor.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <linux/types.h> 198c2ecf20Sopenharmony_ci#include <linux/stddef.h> 208c2ecf20Sopenharmony_ci#include <linux/thread_info.h> 218c2ecf20Sopenharmony_ci#include <linux/ptrace.h> 228c2ecf20Sopenharmony_ci#include <linux/mm.h> 238c2ecf20Sopenharmony_ci#include <linux/kbuild.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#include <asm/ptrace.h> 268c2ecf20Sopenharmony_ci#include <asm/traps.h> 278c2ecf20Sopenharmony_ci#include <linux/uaccess.h> 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciint main(void) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci /* struct pt_regs */ 328c2ecf20Sopenharmony_ci DEFINE(PT_PC, offsetof (struct pt_regs, pc)); 338c2ecf20Sopenharmony_ci DEFINE(PT_PS, offsetof (struct pt_regs, ps)); 348c2ecf20Sopenharmony_ci DEFINE(PT_DEPC, offsetof (struct pt_regs, depc)); 358c2ecf20Sopenharmony_ci DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause)); 368c2ecf20Sopenharmony_ci DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr)); 378c2ecf20Sopenharmony_ci DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause)); 388c2ecf20Sopenharmony_ci DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask)); 398c2ecf20Sopenharmony_ci DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg)); 408c2ecf20Sopenharmony_ci DEFINE(PT_LEND, offsetof (struct pt_regs, lend)); 418c2ecf20Sopenharmony_ci DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount)); 428c2ecf20Sopenharmony_ci DEFINE(PT_SAR, offsetof (struct pt_regs, sar)); 438c2ecf20Sopenharmony_ci DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel)); 448c2ecf20Sopenharmony_ci DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall)); 458c2ecf20Sopenharmony_ci DEFINE(PT_SCOMPARE1, offsetof(struct pt_regs, scompare1)); 468c2ecf20Sopenharmony_ci DEFINE(PT_THREADPTR, offsetof(struct pt_regs, threadptr)); 478c2ecf20Sopenharmony_ci DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0])); 488c2ecf20Sopenharmony_ci DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0])); 498c2ecf20Sopenharmony_ci DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1])); 508c2ecf20Sopenharmony_ci DEFINE(PT_AREG2, offsetof (struct pt_regs, areg[2])); 518c2ecf20Sopenharmony_ci DEFINE(PT_AREG3, offsetof (struct pt_regs, areg[3])); 528c2ecf20Sopenharmony_ci DEFINE(PT_AREG4, offsetof (struct pt_regs, areg[4])); 538c2ecf20Sopenharmony_ci DEFINE(PT_AREG5, offsetof (struct pt_regs, areg[5])); 548c2ecf20Sopenharmony_ci DEFINE(PT_AREG6, offsetof (struct pt_regs, areg[6])); 558c2ecf20Sopenharmony_ci DEFINE(PT_AREG7, offsetof (struct pt_regs, areg[7])); 568c2ecf20Sopenharmony_ci DEFINE(PT_AREG8, offsetof (struct pt_regs, areg[8])); 578c2ecf20Sopenharmony_ci DEFINE(PT_AREG9, offsetof (struct pt_regs, areg[9])); 588c2ecf20Sopenharmony_ci DEFINE(PT_AREG10, offsetof (struct pt_regs, areg[10])); 598c2ecf20Sopenharmony_ci DEFINE(PT_AREG11, offsetof (struct pt_regs, areg[11])); 608c2ecf20Sopenharmony_ci DEFINE(PT_AREG12, offsetof (struct pt_regs, areg[12])); 618c2ecf20Sopenharmony_ci DEFINE(PT_AREG13, offsetof (struct pt_regs, areg[13])); 628c2ecf20Sopenharmony_ci DEFINE(PT_AREG14, offsetof (struct pt_regs, areg[14])); 638c2ecf20Sopenharmony_ci DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15])); 648c2ecf20Sopenharmony_ci DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase)); 658c2ecf20Sopenharmony_ci DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart)); 668c2ecf20Sopenharmony_ci DEFINE(PT_SIZE, sizeof(struct pt_regs)); 678c2ecf20Sopenharmony_ci DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS])); 688c2ecf20Sopenharmony_ci DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS])); 698c2ecf20Sopenharmony_ci DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt)); 708c2ecf20Sopenharmony_ci DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t)); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci /* struct task_struct */ 738c2ecf20Sopenharmony_ci DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace)); 748c2ecf20Sopenharmony_ci DEFINE(TASK_MM, offsetof (struct task_struct, mm)); 758c2ecf20Sopenharmony_ci DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm)); 768c2ecf20Sopenharmony_ci DEFINE(TASK_PID, offsetof (struct task_struct, pid)); 778c2ecf20Sopenharmony_ci DEFINE(TASK_THREAD, offsetof (struct task_struct, thread)); 788c2ecf20Sopenharmony_ci DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack)); 798c2ecf20Sopenharmony_ci#ifdef CONFIG_STACKPROTECTOR 808c2ecf20Sopenharmony_ci DEFINE(TASK_STACK_CANARY, offsetof(struct task_struct, stack_canary)); 818c2ecf20Sopenharmony_ci#endif 828c2ecf20Sopenharmony_ci DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct)); 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci /* offsets in thread_info struct */ 858c2ecf20Sopenharmony_ci OFFSET(TI_TASK, thread_info, task); 868c2ecf20Sopenharmony_ci OFFSET(TI_FLAGS, thread_info, flags); 878c2ecf20Sopenharmony_ci OFFSET(TI_STSTUS, thread_info, status); 888c2ecf20Sopenharmony_ci OFFSET(TI_CPU, thread_info, cpu); 898c2ecf20Sopenharmony_ci OFFSET(TI_PRE_COUNT, thread_info, preempt_count); 908c2ecf20Sopenharmony_ci OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci /* struct thread_info (offset from start_struct) */ 938c2ecf20Sopenharmony_ci DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra)); 948c2ecf20Sopenharmony_ci DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp)); 958c2ecf20Sopenharmony_ci DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable)); 968c2ecf20Sopenharmony_ci#if XCHAL_HAVE_EXCLUSIVE 978c2ecf20Sopenharmony_ci DEFINE(THREAD_ATOMCTL8, offsetof (struct thread_info, atomctl8)); 988c2ecf20Sopenharmony_ci#endif 998c2ecf20Sopenharmony_ci#if XTENSA_HAVE_COPROCESSORS 1008c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0)); 1018c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1)); 1028c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2)); 1038c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3)); 1048c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4)); 1058c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5)); 1068c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6)); 1078c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7)); 1088c2ecf20Sopenharmony_ci#endif 1098c2ecf20Sopenharmony_ci DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user)); 1108c2ecf20Sopenharmony_ci DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t)); 1118c2ecf20Sopenharmony_ci DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, \ 1128c2ecf20Sopenharmony_ci thread.current_ds)); 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci /* struct mm_struct */ 1158c2ecf20Sopenharmony_ci DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users)); 1168c2ecf20Sopenharmony_ci DEFINE(MM_PGD, offsetof (struct mm_struct, pgd)); 1178c2ecf20Sopenharmony_ci DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context)); 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci /* struct page */ 1208c2ecf20Sopenharmony_ci DEFINE(PAGE_FLAGS, offsetof(struct page, flags)); 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci /* constants */ 1238c2ecf20Sopenharmony_ci DEFINE(_CLONE_VM, CLONE_VM); 1248c2ecf20Sopenharmony_ci DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED); 1258c2ecf20Sopenharmony_ci DEFINE(PG_ARCH_1, PG_arch_1); 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci /* struct debug_table */ 1288c2ecf20Sopenharmony_ci DEFINE(DT_DEBUG_EXCEPTION, 1298c2ecf20Sopenharmony_ci offsetof(struct debug_table, debug_exception)); 1308c2ecf20Sopenharmony_ci DEFINE(DT_DEBUG_SAVE, offsetof(struct debug_table, debug_save)); 1318c2ecf20Sopenharmony_ci#ifdef CONFIG_HAVE_HW_BREAKPOINT 1328c2ecf20Sopenharmony_ci DEFINE(DT_DBREAKC_SAVE, offsetof(struct debug_table, dbreakc_save)); 1338c2ecf20Sopenharmony_ci DEFINE(DT_ICOUNT_SAVE, offsetof(struct debug_table, icount_save)); 1348c2ecf20Sopenharmony_ci DEFINE(DT_ICOUNT_LEVEL_SAVE, 1358c2ecf20Sopenharmony_ci offsetof(struct debug_table, icount_level_save)); 1368c2ecf20Sopenharmony_ci#endif 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci /* struct exc_table */ 1398c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_KSTK, offsetof(struct exc_table, kstk)); 1408c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_DOUBLE_SAVE, offsetof(struct exc_table, double_save)); 1418c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_FIXUP, offsetof(struct exc_table, fixup)); 1428c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_PARAM, offsetof(struct exc_table, fixup_param)); 1438c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_FAST_USER, 1448c2ecf20Sopenharmony_ci offsetof(struct exc_table, fast_user_handler)); 1458c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_FAST_KERNEL, 1468c2ecf20Sopenharmony_ci offsetof(struct exc_table, fast_kernel_handler)); 1478c2ecf20Sopenharmony_ci DEFINE(EXC_TABLE_DEFAULT, offsetof(struct exc_table, default_handler)); 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci return 0; 1508c2ecf20Sopenharmony_ci} 151