asm-offsets.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Generate definitions needed by assembly language modules.
  3. * This code generates raw asm output which is post-processed to extract
  4. * and format the required data.
  5. */
  6. #include <linux/crypto.h>
  7. #include <linux/sched.h>
  8. #include <linux/stddef.h>
  9. #include <linux/errno.h>
  10. #include <linux/hardirq.h>
  11. #include <linux/suspend.h>
  12. #include <asm/pda.h>
  13. #include <asm/processor.h>
  14. #include <asm/segment.h>
  15. #include <asm/thread_info.h>
  16. #include <asm/ia32.h>
  17. #define DEFINE(sym, val) \
  18. asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  19. #define BLANK() asm volatile("\n->" : : )
  20. int main(void)
  21. {
  22. #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
  23. ENTRY(state);
  24. ENTRY(flags);
  25. ENTRY(thread);
  26. ENTRY(pid);
  27. BLANK();
  28. #undef ENTRY
  29. #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
  30. ENTRY(flags);
  31. ENTRY(addr_limit);
  32. ENTRY(preempt_count);
  33. ENTRY(status);
  34. BLANK();
  35. #undef ENTRY
  36. #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
  37. ENTRY(kernelstack);
  38. ENTRY(oldrsp);
  39. ENTRY(pcurrent);
  40. ENTRY(irqcount);
  41. ENTRY(cpunumber);
  42. ENTRY(irqstackptr);
  43. ENTRY(data_offset);
  44. BLANK();
  45. #undef ENTRY
  46. #ifdef CONFIG_IA32_EMULATION
  47. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  48. ENTRY(eax);
  49. ENTRY(ebx);
  50. ENTRY(ecx);
  51. ENTRY(edx);
  52. ENTRY(esi);
  53. ENTRY(edi);
  54. ENTRY(ebp);
  55. ENTRY(esp);
  56. ENTRY(eip);
  57. BLANK();
  58. #undef ENTRY
  59. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  60. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  61. BLANK();
  62. #endif
  63. DEFINE(pbe_address, offsetof(struct pbe, address));
  64. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  65. DEFINE(pbe_next, offsetof(struct pbe, next));
  66. BLANK();
  67. DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
  68. BLANK();
  69. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  70. return 0;
  71. }