asm-offsets.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. */
  18. #include <linux/stddef.h>
  19. #include <linux/sched.h>
  20. #include <linux/kernel_stat.h>
  21. #include <linux/ptrace.h>
  22. #include <linux/hardirq.h>
  23. #include <linux/thread_info.h>
  24. #include <linux/kbuild.h>
  25. int main(void)
  26. {
  27. /* struct task_struct */
  28. OFFSET(TASK_THREAD, task_struct, thread);
  29. BLANK();
  30. /* struct thread_struct */
  31. OFFSET(THREAD_KSP, thread_struct, ksp);
  32. OFFSET(THREAD_KPSR, thread_struct, kpsr);
  33. BLANK();
  34. /* struct pt_regs */
  35. OFFSET(PT_ORIG_R2, pt_regs, orig_r2);
  36. OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
  37. OFFSET(PT_R1, pt_regs, r1);
  38. OFFSET(PT_R2, pt_regs, r2);
  39. OFFSET(PT_R3, pt_regs, r3);
  40. OFFSET(PT_R4, pt_regs, r4);
  41. OFFSET(PT_R5, pt_regs, r5);
  42. OFFSET(PT_R6, pt_regs, r6);
  43. OFFSET(PT_R7, pt_regs, r7);
  44. OFFSET(PT_R8, pt_regs, r8);
  45. OFFSET(PT_R9, pt_regs, r9);
  46. OFFSET(PT_R10, pt_regs, r10);
  47. OFFSET(PT_R11, pt_regs, r11);
  48. OFFSET(PT_R12, pt_regs, r12);
  49. OFFSET(PT_R13, pt_regs, r13);
  50. OFFSET(PT_R14, pt_regs, r14);
  51. OFFSET(PT_R15, pt_regs, r15);
  52. OFFSET(PT_EA, pt_regs, ea);
  53. OFFSET(PT_RA, pt_regs, ra);
  54. OFFSET(PT_FP, pt_regs, fp);
  55. OFFSET(PT_SP, pt_regs, sp);
  56. OFFSET(PT_GP, pt_regs, gp);
  57. OFFSET(PT_ESTATUS, pt_regs, estatus);
  58. DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
  59. BLANK();
  60. /* struct switch_stack */
  61. OFFSET(SW_R16, switch_stack, r16);
  62. OFFSET(SW_R17, switch_stack, r17);
  63. OFFSET(SW_R18, switch_stack, r18);
  64. OFFSET(SW_R19, switch_stack, r19);
  65. OFFSET(SW_R20, switch_stack, r20);
  66. OFFSET(SW_R21, switch_stack, r21);
  67. OFFSET(SW_R22, switch_stack, r22);
  68. OFFSET(SW_R23, switch_stack, r23);
  69. OFFSET(SW_FP, switch_stack, fp);
  70. OFFSET(SW_GP, switch_stack, gp);
  71. OFFSET(SW_RA, switch_stack, ra);
  72. DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
  73. BLANK();
  74. /* struct thread_info */
  75. OFFSET(TI_FLAGS, thread_info, flags);
  76. OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
  77. BLANK();
  78. return 0;
  79. }