asm-offsets.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) 1995-2001 Russell King
  3. * 2001-2002 Keith Owens
  4. * 2003 Ian Molton
  5. *
  6. * Generate definitions needed by assembly language modules.
  7. * This code generates raw asm output which is post-processed to extract
  8. * and format the required data.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/sched.h>
  15. #include <linux/mm.h>
  16. #include <asm/pgtable.h>
  17. #include <asm/uaccess.h>
  18. /*
  19. * Make sure that the compiler and target are compatible.
  20. */
  21. #if defined(__APCS_32__) && defined(CONFIG_CPU_26)
  22. #error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
  23. #endif
  24. /* Use marker if you need to separate the values later */
  25. #define DEFINE(sym, val) \
  26. asm volatile("\n->" #sym " %0 " #val : : "i" (val))
  27. #define BLANK() asm volatile("\n->" : : )
  28. int main(void)
  29. {
  30. DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
  31. BLANK();
  32. DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
  33. DEFINE(VMA_VM_FLAGS, offsetof(struct vm_area_struct, vm_flags));
  34. BLANK();
  35. DEFINE(VM_EXEC, VM_EXEC);
  36. BLANK();
  37. BLANK();
  38. DEFINE(PAGE_PRESENT, _PAGE_PRESENT);
  39. DEFINE(PAGE_READONLY, _PAGE_READONLY);
  40. DEFINE(PAGE_NOT_USER, _PAGE_NOT_USER);
  41. DEFINE(PAGE_OLD, _PAGE_OLD);
  42. DEFINE(PAGE_CLEAN, _PAGE_CLEAN);
  43. BLANK();
  44. DEFINE(PAGE_SZ, PAGE_SIZE);
  45. BLANK();
  46. DEFINE(SYS_ERROR0, 0x9f0000);
  47. return 0;
  48. }