asm-offsets.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. BLANK();
  33. #undef ENTRY
  34. #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
  35. ENTRY(kernelstack);
  36. ENTRY(oldrsp);
  37. ENTRY(pcurrent);
  38. ENTRY(irqrsp);
  39. ENTRY(irqcount);
  40. ENTRY(cpunumber);
  41. ENTRY(irqstackptr);
  42. BLANK();
  43. #undef ENTRY
  44. #ifdef CONFIG_IA32_EMULATION
  45. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  46. ENTRY(eax);
  47. ENTRY(ebx);
  48. ENTRY(ecx);
  49. ENTRY(edx);
  50. ENTRY(esi);
  51. ENTRY(edi);
  52. ENTRY(ebp);
  53. ENTRY(esp);
  54. ENTRY(eip);
  55. BLANK();
  56. #undef ENTRY
  57. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  58. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  59. BLANK();
  60. #endif
  61. DEFINE(pbe_address, offsetof(struct pbe, address));
  62. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  63. DEFINE(pbe_next, offsetof(struct pbe, next));
  64. return 0;
  65. }