Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.6 KiB

  1. /*--
  2. Module Name
  3. constant.h
  4. Author
  5. Thomas Parslow (tomp)
  6. --*/
  7. //
  8. // Debugging Level defines
  9. //
  10. #ifdef DEBUG0
  11. #define DBG0(x) x
  12. #define DBG1(x)
  13. #elif defined DEBUG1
  14. #define DBG0(x) x
  15. #define DBG1(x) x
  16. #else
  17. #define DBG0(x)
  18. #define DBG1(x)
  19. #endif
  20. #define WAITFOREVER while(1);
  21. #define BUGCHECK while(1);
  22. #define ENTRIES_PER_PAGETABLE 1024
  23. #define PAGE_SIZE 0x1000
  24. #define ENABLING 0
  25. #define RE_ENABLING 1
  26. //
  27. // Define page-table-entry bit definitions
  28. //
  29. // Dir Table
  30. // ----------==========
  31. // 00000000000000000000xxxxxxxxxxxx
  32. // ::::::+--- Present = 1 - Not Present = 0
  33. // :::::+---- ReadWrite = 1 - Read only = 0
  34. // ::::+----- UserAccess = 1 - Supervisor = 0
  35. // :::+------ Reserved
  36. // ::+------- Reserved
  37. // :+-------- Dirty = 1 - Not written = 0
  38. // +--------- Accessed = 1 - No accessed = 0
  39. #define PAGE_SUPERVISOR 0x0000
  40. #define PAGE_READ_ONLY 0x0000
  41. #define PAGE_PRESENT 0x0001
  42. #define PAGE_NOT_PRESENT 0x0000
  43. #define PAGE_READ_WRITE 0x0002
  44. #define PAGE_USER_ACCESS 0x0004
  45. #define PAGE_PERSIST 0x0200 // Tells kernel maintain
  46. //
  47. // Define RWSP (Read, Write, Supervisor, Present)
  48. //
  49. #define PAGE_RWSP 0L | PAGE_READ_WRITE | PAGE_SUPERVISOR | PAGE_PRESENT
  50. #define PAGE_ROSP 0L | PAGE_READ_ONLY | PAGE_SUPERVISOR | PAGE_PRESENT
  51. // Since the entire boot process occurs at ring 0, the only way we can
  52. // protext areas that we don't want trashed is too mark them not present
  53. #define PAGE_NO_ACCESS 0L | PAGE_READ_ONLY | PAGE_SUPERVISOR | PAGE_NOT_PRESENT
  54. //
  55. // Page-entry macros
  56. //
  57. #define PD_Entry(x) (USHORT)((x)>>22) & 0x3ff
  58. #define PT_Entry(x) (USHORT)((x)>>12) & 0x3ff
  59. #define PAGE_Count(x) (USHORT)((x)/PAGE_SIZE) + (((x) % PAGE_SIZE) ? 1 : 0)
  60. #define PhysToSeg(x) (USHORT)((x) >> 4) & 0xffff
  61. #define PhysToOff(x) (USHORT)((x) & 0x0f)
  62. #define MAKE_FP(p,a) FP_SEG(p) = (USHORT)((a) >> 4) & 0xffff; FP_OFF(p) = (USHORT)((a) & 0x0f)
  63. #define MAKE_FLAT_ADDRESS(fp) ( ((ULONG)FP_SEG(fp) * 16 ) + (ULONG)FP_OFF(fp) )
  64. //
  65. // Machine type definitions.
  66. // N.B. All the constants defined here
  67. // must match the ones defined in ntos\inc\i386.h
  68. //
  69. #define MACHINE_TYPE_ISA 0
  70. #define MACHINE_TYPE_EISA 1
  71. #define MACHINE_TYPE_MCA 2