asm-offsets.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/types.h>
  7. #include <linux/stddef.h>
  8. #include <linux/sched.h>
  9. #include <linux/ptrace.h>
  10. #include <asm/io.h>
  11. #define DEFINE(sym, val) \
  12. asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  13. #define BLANK() asm volatile("\n->" : : )
  14. void foo(void)
  15. {
  16. DEFINE(TI_TASK, offsetof(struct thread_info, task));
  17. DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
  18. DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
  19. BLANK();
  20. DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked));
  21. DEFINE(TASK_UID, offsetof(struct task_struct, uid));
  22. DEFINE(TASK_EUID, offsetof(struct task_struct, euid));
  23. DEFINE(TASK_GID, offsetof(struct task_struct, gid));
  24. DEFINE(TASK_EGID, offsetof(struct task_struct, egid));
  25. DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent));
  26. DEFINE(TASK_TGID, offsetof(struct task_struct, tgid));
  27. BLANK();
  28. DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs));
  29. DEFINE(PT_PTRACED, PT_PTRACED);
  30. DEFINE(CLONE_VM, CLONE_VM);
  31. DEFINE(CLONE_UNTRACED, CLONE_UNTRACED);
  32. DEFINE(SIGCHLD, SIGCHLD);
  33. BLANK();
  34. DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache));
  35. DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register));
  36. }