asm-offsets.c 1.6 KB

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