getconstants.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  *  linux/arch/arm/tools/getconsdata.c
  3.  *
  4.  *  Copyright (C) 1995-2001 Russell King
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify
  7.  * it under the terms of the GNU General Public License version 2 as
  8.  * published by the Free Software Foundation.
  9.  */
  10. #include <linux/config.h>
  11. #include <linux/sched.h>
  12. #include <linux/mm.h>
  13. #include <asm/pgtable.h>
  14. #include <asm/uaccess.h>
  15. /*
  16.  * Make sure that the compiler and target are compatible.
  17.  */
  18. #if defined(__APCS_32__) && defined(CONFIG_CPU_26)
  19. #error Your compiler targets APCS-32 but this kernel requires APCS-26
  20. #endif
  21. #if defined(__APCS_26__) && defined(CONFIG_CPU_32)
  22. #error Your compiler targets APCS-26 but this kernel requires APCS-32
  23. #endif
  24. #define OFF_TSK(n) (unsigned long)&(((struct task_struct *)0)->n)
  25. #define DEFN(name,off) asm("n#define "name" %0" :: "I" (off))
  26. void func(void)
  27. {
  28. DEFN("TSK_SIGPENDING", OFF_TSK(sigpending));
  29. DEFN("TSK_ADDR_LIMIT", OFF_TSK(addr_limit));
  30. DEFN("TSK_NEED_RESCHED", OFF_TSK(need_resched));
  31. DEFN("TSK_PTRACE", OFF_TSK(ptrace));
  32. DEFN("TSK_USED_MATH", OFF_TSK(used_math));
  33. DEFN("TSS_SAVE", OFF_TSK(thread.save));
  34. DEFN("TSS_FPESAVE", OFF_TSK(thread.fpstate.soft.save));
  35. #ifdef CONFIG_CPU_32
  36. DEFN("TSS_DOMAIN", OFF_TSK(thread.domain));
  37. DEFN("HPTE_TYPE_SMALL", PTE_TYPE_SMALL);
  38. DEFN("HPTE_AP_READ", PTE_AP_READ);
  39. DEFN("HPTE_AP_WRITE", PTE_AP_WRITE);
  40. DEFN("LPTE_PRESENT", L_PTE_PRESENT);
  41. DEFN("LPTE_YOUNG", L_PTE_YOUNG);
  42. DEFN("LPTE_BUFFERABLE", L_PTE_BUFFERABLE);
  43. DEFN("LPTE_CACHEABLE", L_PTE_CACHEABLE);
  44. DEFN("LPTE_USER", L_PTE_USER);
  45. DEFN("LPTE_WRITE", L_PTE_WRITE);
  46. DEFN("LPTE_EXEC", L_PTE_EXEC);
  47. DEFN("LPTE_DIRTY", L_PTE_DIRTY);
  48. #endif
  49. #ifdef CONFIG_CPU_26
  50. DEFN("PAGE_PRESENT", _PAGE_PRESENT);
  51. DEFN("PAGE_READONLY", _PAGE_READONLY);
  52. DEFN("PAGE_NOT_USER", _PAGE_NOT_USER);
  53. DEFN("PAGE_OLD", _PAGE_OLD);
  54. DEFN("PAGE_CLEAN", _PAGE_CLEAN);
  55. #endif
  56. DEFN("PAGE_SZ", PAGE_SIZE);
  57. DEFN("SYS_ERROR0", 0x9f0000);
  58. }