asm-offsets.c 1.4 KB

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