asm-offsets.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
  4. */
  5. #include <linux/stddef.h>
  6. #include <linux/sched.h>
  7. #include <linux/kernel_stat.h>
  8. #include <linux/ptrace.h>
  9. #include <linux/hardirq.h>
  10. #include <linux/thread_info.h>
  11. #include <linux/kbuild.h>
  12. int main(void)
  13. {
  14. /* struct task_struct */
  15. OFFSET(TASK_THREAD, task_struct, thread);
  16. BLANK();
  17. /* struct thread_struct */
  18. OFFSET(THREAD_KSP, thread_struct, ksp);
  19. OFFSET(THREAD_KPSR, thread_struct, kpsr);
  20. BLANK();
  21. /* struct pt_regs */
  22. OFFSET(PT_ORIG_R2, pt_regs, orig_r2);
  23. OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
  24. OFFSET(PT_R1, pt_regs, r1);
  25. OFFSET(PT_R2, pt_regs, r2);
  26. OFFSET(PT_R3, pt_regs, r3);
  27. OFFSET(PT_R4, pt_regs, r4);
  28. OFFSET(PT_R5, pt_regs, r5);
  29. OFFSET(PT_R6, pt_regs, r6);
  30. OFFSET(PT_R7, pt_regs, r7);
  31. OFFSET(PT_R8, pt_regs, r8);
  32. OFFSET(PT_R9, pt_regs, r9);
  33. OFFSET(PT_R10, pt_regs, r10);
  34. OFFSET(PT_R11, pt_regs, r11);
  35. OFFSET(PT_R12, pt_regs, r12);
  36. OFFSET(PT_R13, pt_regs, r13);
  37. OFFSET(PT_R14, pt_regs, r14);
  38. OFFSET(PT_R15, pt_regs, r15);
  39. OFFSET(PT_EA, pt_regs, ea);
  40. OFFSET(PT_RA, pt_regs, ra);
  41. OFFSET(PT_FP, pt_regs, fp);
  42. OFFSET(PT_SP, pt_regs, sp);
  43. OFFSET(PT_GP, pt_regs, gp);
  44. OFFSET(PT_ESTATUS, pt_regs, estatus);
  45. DEFINE(PT_REGS_SIZE, sizeof(struct pt_regs));
  46. BLANK();
  47. /* struct switch_stack */
  48. OFFSET(SW_R16, switch_stack, r16);
  49. OFFSET(SW_R17, switch_stack, r17);
  50. OFFSET(SW_R18, switch_stack, r18);
  51. OFFSET(SW_R19, switch_stack, r19);
  52. OFFSET(SW_R20, switch_stack, r20);
  53. OFFSET(SW_R21, switch_stack, r21);
  54. OFFSET(SW_R22, switch_stack, r22);
  55. OFFSET(SW_R23, switch_stack, r23);
  56. OFFSET(SW_FP, switch_stack, fp);
  57. OFFSET(SW_GP, switch_stack, gp);
  58. OFFSET(SW_RA, switch_stack, ra);
  59. DEFINE(SWITCH_STACK_SIZE, sizeof(struct switch_stack));
  60. BLANK();
  61. /* struct thread_info */
  62. OFFSET(TI_FLAGS, thread_info, flags);
  63. OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count);
  64. BLANK();
  65. return 0;
  66. }