asm-offsets.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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/uaccess.h>
  24. int main(void)
  25. {
  26. /* struct pt_regs */
  27. DEFINE(PT_PC, offsetof (struct pt_regs, pc));
  28. DEFINE(PT_PS, offsetof (struct pt_regs, ps));
  29. DEFINE(PT_DEPC, offsetof (struct pt_regs, depc));
  30. DEFINE(PT_EXCCAUSE, offsetof (struct pt_regs, exccause));
  31. DEFINE(PT_EXCVADDR, offsetof (struct pt_regs, excvaddr));
  32. DEFINE(PT_DEBUGCAUSE, offsetof (struct pt_regs, debugcause));
  33. DEFINE(PT_WMASK, offsetof (struct pt_regs, wmask));
  34. DEFINE(PT_LBEG, offsetof (struct pt_regs, lbeg));
  35. DEFINE(PT_LEND, offsetof (struct pt_regs, lend));
  36. DEFINE(PT_LCOUNT, offsetof (struct pt_regs, lcount));
  37. DEFINE(PT_SAR, offsetof (struct pt_regs, sar));
  38. DEFINE(PT_ICOUNTLEVEL, offsetof (struct pt_regs, icountlevel));
  39. DEFINE(PT_SYSCALL, offsetof (struct pt_regs, syscall));
  40. DEFINE(PT_AREG, offsetof (struct pt_regs, areg[0]));
  41. DEFINE(PT_AREG0, offsetof (struct pt_regs, areg[0]));
  42. DEFINE(PT_AREG1, offsetof (struct pt_regs, areg[1]));
  43. DEFINE(PT_AREG2, offsetof (struct pt_regs, areg[2]));
  44. DEFINE(PT_AREG3, offsetof (struct pt_regs, areg[3]));
  45. DEFINE(PT_AREG4, offsetof (struct pt_regs, areg[4]));
  46. DEFINE(PT_AREG5, offsetof (struct pt_regs, areg[5]));
  47. DEFINE(PT_AREG6, offsetof (struct pt_regs, areg[6]));
  48. DEFINE(PT_AREG7, offsetof (struct pt_regs, areg[7]));
  49. DEFINE(PT_AREG8, offsetof (struct pt_regs, areg[8]));
  50. DEFINE(PT_AREG9, offsetof (struct pt_regs, areg[9]));
  51. DEFINE(PT_AREG10, offsetof (struct pt_regs, areg[10]));
  52. DEFINE(PT_AREG11, offsetof (struct pt_regs, areg[11]));
  53. DEFINE(PT_AREG12, offsetof (struct pt_regs, areg[12]));
  54. DEFINE(PT_AREG13, offsetof (struct pt_regs, areg[13]));
  55. DEFINE(PT_AREG14, offsetof (struct pt_regs, areg[14]));
  56. DEFINE(PT_AREG15, offsetof (struct pt_regs, areg[15]));
  57. DEFINE(PT_WINDOWBASE, offsetof (struct pt_regs, windowbase));
  58. DEFINE(PT_WINDOWSTART, offsetof(struct pt_regs, windowstart));
  59. DEFINE(PT_SIZE, sizeof(struct pt_regs));
  60. DEFINE(PT_AREG_END, offsetof (struct pt_regs, areg[XCHAL_NUM_AREGS]));
  61. DEFINE(PT_USER_SIZE, offsetof(struct pt_regs, areg[XCHAL_NUM_AREGS]));
  62. DEFINE(PT_XTREGS_OPT, offsetof(struct pt_regs, xtregs_opt));
  63. DEFINE(XTREGS_OPT_SIZE, sizeof(xtregs_opt_t));
  64. /* struct task_struct */
  65. DEFINE(TASK_PTRACE, offsetof (struct task_struct, ptrace));
  66. DEFINE(TASK_MM, offsetof (struct task_struct, mm));
  67. DEFINE(TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm));
  68. DEFINE(TASK_PID, offsetof (struct task_struct, pid));
  69. DEFINE(TASK_THREAD, offsetof (struct task_struct, thread));
  70. DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack));
  71. DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct));
  72. /* struct thread_info (offset from start_struct) */
  73. DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
  74. DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));
  75. DEFINE(THREAD_CPENABLE, offsetof (struct thread_info, cpenable));
  76. #if XTENSA_HAVE_COPROCESSORS
  77. DEFINE(THREAD_XTREGS_CP0, offsetof (struct thread_info, xtregs_cp));
  78. DEFINE(THREAD_XTREGS_CP1, offsetof (struct thread_info, xtregs_cp));
  79. DEFINE(THREAD_XTREGS_CP2, offsetof (struct thread_info, xtregs_cp));
  80. DEFINE(THREAD_XTREGS_CP3, offsetof (struct thread_info, xtregs_cp));
  81. DEFINE(THREAD_XTREGS_CP4, offsetof (struct thread_info, xtregs_cp));
  82. DEFINE(THREAD_XTREGS_CP5, offsetof (struct thread_info, xtregs_cp));
  83. DEFINE(THREAD_XTREGS_CP6, offsetof (struct thread_info, xtregs_cp));
  84. DEFINE(THREAD_XTREGS_CP7, offsetof (struct thread_info, xtregs_cp));
  85. #endif
  86. DEFINE(THREAD_XTREGS_USER, offsetof (struct thread_info, xtregs_user));
  87. DEFINE(XTREGS_USER_SIZE, sizeof(xtregs_user_t));
  88. DEFINE(THREAD_CURRENT_DS, offsetof (struct task_struct, thread.current_ds));
  89. /* struct mm_struct */
  90. DEFINE(MM_USERS, offsetof(struct mm_struct, mm_users));
  91. DEFINE(MM_PGD, offsetof (struct mm_struct, pgd));
  92. DEFINE(MM_CONTEXT, offsetof (struct mm_struct, context));
  93. /* struct page */
  94. DEFINE(PAGE_FLAGS, offsetof(struct page, flags));
  95. /* constants */
  96. DEFINE(_CLONE_VM, CLONE_VM);
  97. DEFINE(_CLONE_UNTRACED, CLONE_UNTRACED);
  98. DEFINE(PG_ARCH_1, PG_arch_1);
  99. return 0;
  100. }