asm-offsets.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * This program is used to generate definitions needed by
  3. * assembly language modules.
  4. *
  5. * We use the technique used in the OSF Mach kernel code:
  6. * generate asm statements containing #defines,
  7. * compile this file to assembler, and then extract the
  8. * #defines from the assembly-language output.
  9. *
  10. * On sparc, thread_info data is static and TI_XXX offsets are computed by hand.
  11. */
  12. #include <linux/sched.h>
  13. // #include <linux/mm.h>
  14. #include <linux/kbuild.h>
  15. #include <asm/hibernate.h>
  16. #ifdef CONFIG_SPARC32
  17. int sparc32_foo(void)
  18. {
  19. DEFINE(AOFF_thread_fork_kpsr,
  20. offsetof(struct thread_struct, fork_kpsr));
  21. return 0;
  22. }
  23. #else
  24. int sparc64_foo(void)
  25. {
  26. #ifdef CONFIG_HIBERNATION
  27. BLANK();
  28. OFFSET(SC_REG_FP, saved_context, fp);
  29. OFFSET(SC_REG_CWP, saved_context, cwp);
  30. OFFSET(SC_REG_WSTATE, saved_context, wstate);
  31. OFFSET(SC_REG_TICK, saved_context, tick);
  32. OFFSET(SC_REG_PSTATE, saved_context, pstate);
  33. OFFSET(SC_REG_G4, saved_context, g4);
  34. OFFSET(SC_REG_G5, saved_context, g5);
  35. OFFSET(SC_REG_G6, saved_context, g6);
  36. #endif
  37. return 0;
  38. }
  39. #endif
  40. int foo(void)
  41. {
  42. BLANK();
  43. DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
  44. BLANK();
  45. DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
  46. BLANK();
  47. DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
  48. /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
  49. return 0;
  50. }