asm-offsets.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * This program is used to generate definitions needed by
  4. * assembly language modules.
  5. *
  6. * We use the technique used in the OSF Mach kernel code:
  7. * generate asm statements containing #defines,
  8. * compile this file to assembler, and then extract the
  9. * #defines from the assembly-language output.
  10. */
  11. #define ASM_OFFSETS_C
  12. #include <linux/stddef.h>
  13. #include <linux/sched.h>
  14. #include <linux/kernel_stat.h>
  15. #include <linux/kbuild.h>
  16. #include <asm/bootinfo.h>
  17. #include <asm/irq.h>
  18. #include <asm/amigahw.h>
  19. #include <linux/font.h>
  20. int main(void)
  21. {
  22. /* offsets into the task struct */
  23. DEFINE(TASK_THREAD, offsetof(struct task_struct, thread));
  24. DEFINE(TASK_MM, offsetof(struct task_struct, mm));
  25. DEFINE(TASK_STACK, offsetof(struct task_struct, stack));
  26. /* offsets into the thread struct */
  27. DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
  28. DEFINE(THREAD_USP, offsetof(struct thread_struct, usp));
  29. DEFINE(THREAD_SR, offsetof(struct thread_struct, sr));
  30. DEFINE(THREAD_FS, offsetof(struct thread_struct, fs));
  31. DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp));
  32. DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0));
  33. DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp));
  34. DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl));
  35. DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate));
  36. /* offsets into the thread_info struct */
  37. DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count));
  38. DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags));
  39. /* offsets into the pt_regs */
  40. DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0));
  41. DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0));
  42. DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1));
  43. DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2));
  44. DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3));
  45. DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4));
  46. DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5));
  47. DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0));
  48. DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1));
  49. DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2));
  50. DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc));
  51. DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr));
  52. /* bitfields are a bit difficult */
  53. #ifdef CONFIG_COLDFIRE
  54. DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2);
  55. #else
  56. DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4);
  57. #endif
  58. /* offsets into the irq_cpustat_t struct */
  59. DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending));
  60. /* signal defines */
  61. DEFINE(LSIGSEGV, SIGSEGV);
  62. DEFINE(LSEGV_MAPERR, SEGV_MAPERR);
  63. DEFINE(LSIGTRAP, SIGTRAP);
  64. DEFINE(LTRAP_TRACE, TRAP_TRACE);
  65. #ifdef CONFIG_MMU
  66. /* offsets into the bi_record struct */
  67. DEFINE(BIR_TAG, offsetof(struct bi_record, tag));
  68. DEFINE(BIR_SIZE, offsetof(struct bi_record, size));
  69. DEFINE(BIR_DATA, offsetof(struct bi_record, data));
  70. /* offsets into the font_desc struct */
  71. DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx));
  72. DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name));
  73. DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width));
  74. DEFINE(FONT_DESC_HEIGHT, offsetof(struct font_desc, height));
  75. DEFINE(FONT_DESC_DATA, offsetof(struct font_desc, data));
  76. DEFINE(FONT_DESC_PREF, offsetof(struct font_desc, pref));
  77. /* offsets into the custom struct */
  78. DEFINE(CUSTOMBASE, &amiga_custom);
  79. DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar));
  80. DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr));
  81. DEFINE(C_INTENA, offsetof(struct CUSTOM, intena));
  82. DEFINE(C_INTREQ, offsetof(struct CUSTOM, intreq));
  83. DEFINE(C_SERDATR, offsetof(struct CUSTOM, serdatr));
  84. DEFINE(C_SERDAT, offsetof(struct CUSTOM, serdat));
  85. DEFINE(C_SERPER, offsetof(struct CUSTOM, serper));
  86. DEFINE(CIAABASE, &ciaa);
  87. DEFINE(CIABBASE, &ciab);
  88. DEFINE(C_PRA, offsetof(struct CIA, pra));
  89. DEFINE(ZTWOBASE, zTwoBase);
  90. /* enum m68k_fixup_type */
  91. DEFINE(M68K_FIXUP_MEMOFFSET, m68k_fixup_memoffset);
  92. #endif
  93. return 0;
  94. }