asm-offsets.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. #include <asm/processor.h>
  15. #include <asm/coprocessor.h>
  16. #include <linux/types.h>
  17. #include <linux/stddef.h>
  18. #include <linux/thread_info.h>
  19. #include <linux/ptrace.h>
  20. #include <linux/mm.h>
  21. #include <linux/kbuild.h>
  22. #include <asm/ptrace.h>
  23. #include <asm/traps.h>
  24. #include <linux/uaccess.h>
  25. int main(void)
  26. {
  27. /* struct pt_regs */
  28. DEFINE(PT_PC, offsetof (struct pt_regs, pc));
  29. DEFINE(PT_PS, offsetof (struct pt_regs, ps));
  30. DEFINE(PT_DEPC, offsetof (struct pt_regs, depc));
  31. DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause));
  32. DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr));
  33. DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause));
  34. DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask));
  35. DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg));
  36. DEFINE(PT_LEND, offsetof (struct pt_regs, lend));
  37. DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount));
  38. DEFINE(PT_SAR, offsetof (struct pt_regs, sar));
  39. DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel));
  40. DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall));
  41. DEFINE(PT_SCOMPARE1, offsetof(struct pt_regs, scompare1));
  42. DEFINE(PT_THREADPTR, offsetof(struct pt_regs, threadptr));
  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]));
  65. DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
  66. DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t));
  67. /* struct task_struct */
  68. DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace));
  69. DEFINE(TASK_MM, offsetof (struct task_struct, mm));
  70. DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm));
  71. DEFINE(TASK_PID, offsetof (struct task_struct, pid));
  72. DEFINE(TASK_THREAD, offsetof (struct task_struct, thread));
  73. DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack));
  74. #ifdef CONFIG_STACKPROTECTOR
  75. DEFINE(TASK_STACK_CANARY, offsetof(struct task_struct, stack_canary));
  76. #endif
  77. DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct));
  78. /* offsets in thread_info struct */
  79. OFFSET(TI_TASK, thread_info, task);
  80. OFFSET(TI_FLAGS, thread_info, flags);
  81. OFFSET(TI_STSTUS, thread_info, status);
  82. OFFSET(TI_CPU, thread_info, cpu);
  83. OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
  84. OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
  85. /* struct thread_info (offset from start_struct) */
  86. DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
  87. DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
  88. DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
  89. #if XCHAL_HAVE_EXCLUSIVE
  90. DEFINE(THREAD_ATOMCTL8, offsetof (struct thread_info, atomctl8));
  91. #endif
  92. #if XTENSA_HAVE_COPROCESSORS
  93. DEFINE(THREAD_XTREGS_CP0, offsetof(struct thread_info, xtregs_cp.cp0));
  94. DEFINE(THREAD_XTREGS_CP1, offsetof(struct thread_info, xtregs_cp.cp1));
  95. DEFINE(THREAD_XTREGS_CP2, offsetof(struct thread_info, xtregs_cp.cp2));
  96. DEFINE(THREAD_XTREGS_CP3, offsetof(struct thread_info, xtregs_cp.cp3));
  97. DEFINE(THREAD_XTREGS_CP4, offsetof(struct thread_info, xtregs_cp.cp4));
  98. DEFINE(THREAD_XTREGS_CP5, offsetof(struct thread_info, xtregs_cp.cp5));
  99. DEFINE(THREAD_XTREGS_CP6, offsetof(struct thread_info, xtregs_cp.cp6));
  100. DEFINE(THREAD_XTREGS_CP7, offsetof(struct thread_info, xtregs_cp.cp7));
  101. #endif
  102. DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
  103. DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
  104. DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, \
  105. thread.current_ds));
  106. /* struct mm_struct */
  107. DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users));
  108. DEFINE(MM_PGD, offsetof (struct mm_struct, pgd));
  109. DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context));
  110. /* struct page */
  111. DEFINE(PAGE_FLAGS, offsetof(struct page, flags));
  112. /* constants */
  113. DEFINE(_CLONE_VM, CLONE_VM);
  114. DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED);
  115. DEFINE(PG_ARCH_1, PG_arch_1);
  116. /* struct debug_table */
  117. DEFINE(DT_DEBUG_EXCEPTION,
  118. offsetof(struct debug_table, debug_exception));
  119. DEFINE(DT_DEBUG_SAVE, offsetof(struct debug_table, debug_save));
  120. #ifdef CONFIG_HAVE_HW_BREAKPOINT
  121. DEFINE(DT_DBREAKC_SAVE, offsetof(struct debug_table, dbreakc_save));
  122. DEFINE(DT_ICOUNT_SAVE, offsetof(struct debug_table, icount_save));
  123. DEFINE(DT_ICOUNT_LEVEL_SAVE,
  124. offsetof(struct debug_table, icount_level_save));
  125. #endif
  126. /* struct exc_table */
  127. DEFINE(EXC_TABLE_KSTK, offsetof(struct exc_table, kstk));
  128. DEFINE(EXC_TABLE_DOUBLE_SAVE, offsetof(struct exc_table, double_save));
  129. DEFINE(EXC_TABLE_FIXUP, offsetof(struct exc_table, fixup));
  130. DEFINE(EXC_TABLE_PARAM, offsetof(struct exc_table, fixup_param));
  131. DEFINE(EXC_TABLE_FAST_USER,
  132. offsetof(struct exc_table, fast_user_handler));
  133. DEFINE(EXC_TABLE_FAST_KERNEL,
  134. offsetof(struct exc_table, fast_kernel_handler));
  135. DEFINE(EXC_TABLE_DEFAULT, offsetof(struct exc_table, default_handler));
  136. return 0;
  137. }