asm-offsets.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #include <linux/sched.h>
  2. #include <asm/thread_info.h>
  3. #include <linux/autoconf.h>
  4. /*
  5. * Generate definitions needed by assembly language modules.
  6. * This code generates raw asm output which is post-processed to extract
  7. * and format the required data.
  8. */
  9. #define DEFINE(sym, val) \
  10. asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  11. #define BLANK() asm volatile("\n->" : : )
  12. #if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32)
  13. #error One of ARCH v10 and ARCH v32 must be true!
  14. #endif
  15. int main(void)
  16. {
  17. #define ENTRY(entry) DEFINE(PT_ ## entry, offsetof(struct pt_regs, entry))
  18. ENTRY(orig_r10);
  19. ENTRY(r13);
  20. ENTRY(r12);
  21. ENTRY(r11);
  22. ENTRY(r10);
  23. ENTRY(r9);
  24. #ifdef CONFIG_ETRAX_ARCH_V32
  25. ENTRY(acr);
  26. ENTRY(srs);
  27. #endif
  28. ENTRY(mof);
  29. #ifdef CONFIG_ETRAX_ARCH_V10
  30. ENTRY(dccr);
  31. #else
  32. ENTRY(ccs);
  33. #endif
  34. ENTRY(srp);
  35. BLANK();
  36. #undef ENTRY
  37. #define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
  38. ENTRY(task);
  39. ENTRY(flags);
  40. ENTRY(preempt_count);
  41. BLANK();
  42. #undef ENTRY
  43. #define ENTRY(entry) DEFINE(THREAD_ ## entry, offsetof(struct thread_struct, entry))
  44. ENTRY(ksp);
  45. ENTRY(usp);
  46. #ifdef CONFIG_ETRAX_ARCH_V10
  47. ENTRY(dccr);
  48. #else
  49. ENTRY(ccs);
  50. #endif
  51. BLANK();
  52. #undef ENTRY
  53. #define ENTRY(entry) DEFINE(TASK_ ## entry, offsetof(struct task_struct, entry))
  54. ENTRY(pid);
  55. BLANK();
  56. DEFINE(LCLONE_VM, CLONE_VM);
  57. DEFINE(LCLONE_UNTRACED, CLONE_UNTRACED);
  58. return 0;
  59. }