asm-offsets.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_types.h>
  14. // #include <linux/mm.h>
  15. #include <linux/kbuild.h>
  16. #include <asm/hibernate.h>
  17. #ifdef CONFIG_SPARC32
  18. int sparc32_foo(void)
  19. {
  20. DEFINE(AOFF_thread_fork_kpsr,
  21. offsetof(struct thread_struct, fork_kpsr));
  22. return 0;
  23. }
  24. #else
  25. int sparc64_foo(void)
  26. {
  27. #ifdef CONFIG_HIBERNATION
  28. BLANK();
  29. OFFSET(SC_REG_FP, saved_context, fp);
  30. OFFSET(SC_REG_CWP, saved_context, cwp);
  31. OFFSET(SC_REG_WSTATE, saved_context, wstate);
  32. OFFSET(SC_REG_TICK, saved_context, tick);
  33. OFFSET(SC_REG_PSTATE, saved_context, pstate);
  34. OFFSET(SC_REG_G4, saved_context, g4);
  35. OFFSET(SC_REG_G5, saved_context, g5);
  36. OFFSET(SC_REG_G6, saved_context, g6);
  37. #endif
  38. return 0;
  39. }
  40. #endif
  41. int foo(void)
  42. {
  43. BLANK();
  44. DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread));
  45. BLANK();
  46. DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context));
  47. BLANK();
  48. DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
  49. /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */
  50. return 0;
  51. }