asm-offsets_64.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. #define __NO_STUBS 1
  21. #undef __SYSCALL
  22. #undef _ASM_X86_64_UNISTD_H_
  23. #define __SYSCALL(nr, sym) [nr] = 1,
  24. static char syscalls[] = {
  25. #include <asm/unistd.h>
  26. };
  27. int main(void)
  28. {
  29. #define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
  30. ENTRY(state);
  31. ENTRY(flags);
  32. ENTRY(thread);
  33. ENTRY(pid);
  34. BLANK();
  35. #undef ENTRY
  36. #define ENTRY(entry) DEFINE(threadinfo_ ## entry, offsetof(struct thread_info, entry))
  37. ENTRY(flags);
  38. ENTRY(addr_limit);
  39. ENTRY(preempt_count);
  40. ENTRY(status);
  41. BLANK();
  42. #undef ENTRY
  43. #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
  44. ENTRY(kernelstack);
  45. ENTRY(oldrsp);
  46. ENTRY(pcurrent);
  47. ENTRY(irqcount);
  48. ENTRY(cpunumber);
  49. ENTRY(irqstackptr);
  50. ENTRY(data_offset);
  51. BLANK();
  52. #undef ENTRY
  53. #ifdef CONFIG_IA32_EMULATION
  54. #define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
  55. ENTRY(eax);
  56. ENTRY(ebx);
  57. ENTRY(ecx);
  58. ENTRY(edx);
  59. ENTRY(esi);
  60. ENTRY(edi);
  61. ENTRY(ebp);
  62. ENTRY(esp);
  63. ENTRY(eip);
  64. BLANK();
  65. #undef ENTRY
  66. DEFINE(IA32_RT_SIGFRAME_sigcontext,
  67. offsetof (struct rt_sigframe32, uc.uc_mcontext));
  68. BLANK();
  69. #endif
  70. DEFINE(pbe_address, offsetof(struct pbe, address));
  71. DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
  72. DEFINE(pbe_next, offsetof(struct pbe, next));
  73. BLANK();
  74. DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
  75. BLANK();
  76. DEFINE(crypto_tfm_ctx_offset, offsetof(struct crypto_tfm, __crt_ctx));
  77. BLANK();
  78. DEFINE(__NR_syscall_max, sizeof(syscalls) - 1);
  79. return 0;
  80. }