asm-offsets.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/sched.h>
  7. #include <linux/stddef.h>
  8. #include <linux/errno.h>
  9. #include <linux/hardirq.h>
  10. #include <linux/suspend.h>
  11. #include <asm/pda.h>
  12. #include <asm/processor.h>
  13. #include <asm/segment.h>
  14. #include <asm/thread_info.h>
  15. #include <asm/ia32.h>
  16. #define DEFINE(sym, val) \
  17. asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  18. #define BLANK() asm volatile("\n->" : : )
  19. int main(void)
  20. {
  21. #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
  22. ENTRY(state);
  23. ENTRY(flags);
  24. ENTRY(thread);
  25. ENTRY(pid);
  26. BLANK();
  27. #undef ENTRY
  28. #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
  29. ENTRY(flags);
  30. ENTRY(addr_limit);
  31. ENTRY(preempt_count);
  32. ENTRY(status);
  33. BLANK();
  34. #undef ENTRY
  35. #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
  36. ENTRY(kernelstack);
  37. ENTRY(oldrsp);
  38. ENTRY(pcurrent);
  39. ENTRY(irqcount);
  40. ENTRY(cpunumber);
  41. ENTRY(irqstackptr);
  42. ENTRY(data_offset);
  43. BLANK();
  44. #undef ENTRY
  45. #ifdef CONFIG_IA32_EMULATION
  46. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  47. ENTRY(eax);
  48. ENTRY(ebx);
  49. ENTRY(ecx);
  50. ENTRY(edx);
  51. ENTRY(esi);
  52. ENTRY(edi);
  53. ENTRY(ebp);
  54. ENTRY(esp);
  55. ENTRY(eip);
  56. BLANK();
  57. #undef ENTRY
  58. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  59. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  60. BLANK();
  61. #endif
  62. DEFINE(pbe_address, offsetof(struct pbe, address));
  63. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  64. DEFINE(pbe_next, offsetof(struct pbe, next));
  65. BLANK();
  66. DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
  67. return 0;
  68. }