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