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.

163 lines
3.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. abios.h
  5. Abstract:
  6. This module contains the i386 kernel ABIOS specific header file.
  7. Author:
  8. Shie-Lin Tzong (shielint) 22-May-1991
  9. Revision History:
  10. --*/
  11. //
  12. // Define public portion of the ABIOS Device Block
  13. //
  14. typedef struct _KDEVICE_BLOCK {
  15. USHORT Length;
  16. UCHAR Revision;
  17. UCHAR SecondDeviceId;
  18. USHORT LogicalId;
  19. USHORT DeviceId;
  20. USHORT NumberExclusivePortPairs;
  21. USHORT NumberCommonPortPairs;
  22. } KDEVICE_BLOCK, *PKDEVICE_BLOCK;
  23. typedef struct _KABIOS_POINTER {
  24. USHORT Offset;
  25. USHORT Selector;
  26. } KABIOS_POINTER, *PKABIOS_POINTER;
  27. #pragma pack(1)
  28. //
  29. // ABIOS Function Transfer Table definition
  30. //
  31. typedef struct _KFUNCTION_TRANSFER_TABLE {
  32. KABIOS_POINTER CommonRoutine[3];
  33. USHORT FunctionCount;
  34. USHORT Reserved;
  35. KABIOS_POINTER SpecificRoutine;
  36. } KFUNCTION_TRANSFER_TABLE, *PKFUNCTION_TRANSFER_TABLE;
  37. //
  38. // ABIOS Commom Data Area definitions
  39. //
  40. typedef struct _KDB_FTT_SECTION {
  41. KABIOS_POINTER DeviceBlock;
  42. KABIOS_POINTER FunctionTransferTable;
  43. } KDB_FTT_SECTION, *PKDB_FTT_SECTION;
  44. typedef struct _KCOMMON_DATA_AREA {
  45. USHORT DataPointer0Offset;
  46. USHORT NumberLids;
  47. ULONG Reserved;
  48. PKDB_FTT_SECTION DbFttPointer;
  49. } KCOMMON_DATA_AREA, *PKCOMMON_DATA_AREA;
  50. #pragma pack()
  51. //
  52. // Available GDT Entry
  53. //
  54. typedef struct _KFREE_GDT_ENTRY {
  55. struct _KFREE_GDT_ENTRY *Flink;
  56. ULONG BaseMid : 8;
  57. ULONG Type : 5;
  58. ULONG Dpl : 2;
  59. ULONG Present : 1;
  60. ULONG LimitHi : 4;
  61. ULONG Sys : 1;
  62. ULONG Reserved_0 : 1;
  63. ULONG Default_Big : 1;
  64. ULONG Granularity : 1;
  65. ULONG BaseHi : 8;
  66. } KFREE_GDT_ENTRY, *PKFREE_GDT_ENTRY;
  67. //
  68. // Logical Id table entry
  69. //
  70. typedef struct _KLID_TABLE_ENTRY {
  71. ULONG Owner;
  72. ULONG OwnerCount;
  73. } KLID_TABLE_ENTRY, *PKLID_TABLE_ENTRY;
  74. #define LID_NO_SPECIFIC_OWNER 0xffffffff
  75. #define NUMBER_LID_TABLE_ENTRIES 1024
  76. //
  77. // Macro to extract the high byte of a short offset
  78. //
  79. #define HIGHBYTE(l) ((UCHAR)(((USHORT)(l)>>8) & 0xff))
  80. //
  81. // Macro to extract the low byte of a short offset
  82. //
  83. #define LOWBYTE(l) ((UCHAR)(l))
  84. //
  85. // The following selectors are reserved for 16 bit stack, code and
  86. // ABIOS Common Data Area.
  87. //
  88. #define KGDT_STACK16 0xf8
  89. #define KGDT_CODE16 0xf0
  90. #define KGDT_CDA16 0xe8
  91. #define KGDT_GDT_ALIAS 0x70
  92. //
  93. // Misc. definitions
  94. //
  95. #define RESERVED_GDT_ENTRIES 28
  96. //
  97. // External references
  98. //
  99. extern PKFREE_GDT_ENTRY KiAbiosGdtStart;
  100. extern PKFREE_GDT_ENTRY KiAbiosGdtEnd;
  101. extern PUCHAR KiEndOfCode16;
  102. extern ULONG KiStack16GdtEntry;
  103. extern
  104. VOID
  105. KiI386CallAbios(
  106. IN KABIOS_POINTER AbiosFunction,
  107. IN KABIOS_POINTER DeviceBlockPointer,
  108. IN KABIOS_POINTER FunctionTransferTable,
  109. IN KABIOS_POINTER RequestBlock
  110. );
  111. VOID
  112. KiInitializeAbiosGdtEntry (
  113. OUT PKGDTENTRY GdtEntry,
  114. IN ULONG Base,
  115. IN ULONG Limit,
  116. IN USHORT Type
  117. );
  118. extern
  119. ULONG
  120. KiAbiosGetGdt (
  121. VOID
  122. );