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.

164 lines
4.1 KiB

  1. ;/* himem.inc
  2. ; *
  3. ; * Microsoft Confidential
  4. ; * Copyright (C) Microsoft Corporation 1988-1991
  5. ; * All Rights Reserved.
  6. ; *
  7. ; * Modification History
  8. ; *
  9. ; * Sudeepb 14-May-1991 Ported for NT XMS support
  10. ; */
  11. ;*----------------------------------------------------------------------*
  12. ;* EQUATES *
  13. ;*----------------------------------------------------------------------*
  14. ; Build options
  15. NUM_A20_RETRIES = 3 ; # times to retry A20 diddles
  16. ; Debugging options
  17. debug_vers = 00000h
  18. tdump = 00000h ; display the handle table on each call
  19. keep_cs = 00000h ; keep track of allocator's cs:
  20. XMSVersion equ 0200h
  21. HimemVersion equ 0200h+77h
  22. DATE_String equ '02/27/91'
  23. INT2F_ID equ 043h ; XMS Int 2Fh multiplex ID
  24. INT2F_INS_CHK equ 000h ; driver installation check
  25. INT2F_CTL_FUN equ 010h ; get control function address
  26. INT2F_EXT_A20 equ 030h ; get external A20 hander info
  27. ifndef DBCS
  28. HISEG_ORG equ 0A000h ; ORG for the seg to be moved
  29. ; into HMA
  30. else
  31. ifndef NEC_98
  32. HISEG_ORG equ 0A000h+01000h ; adjust for DBCS System
  33. else
  34. HISEG_ORG equ 0A000h+02000h ; adjust for NEC_98 System
  35. endif
  36. endif
  37. multMULT equ 4ah
  38. multMULTGETHMAPTR equ 1
  39. multMULTALLOCHMA equ 2
  40. DEFHANDLES equ 32 ; Default # of EMB handles
  41. MAXHANDLES equ 128 ; Max # of EMB handles
  42. FREEFLAG equ 00000001b ; EMB Flags
  43. USEDFLAG equ 00000010b
  44. UNUSEDFLAG equ 00000100b
  45. ;*----------------------------------------------------------------------*
  46. ;* XMS Error Codes *
  47. ;*----------------------------------------------------------------------*
  48. ERR_NOTIMPLEMENTED equ 080h
  49. ERR_VDISKFOUND equ 081h
  50. ERR_A20 equ 082h
  51. ERR_GENERAL equ 08Eh
  52. ERR_UNRECOVERABLE equ 08Fh
  53. ERR_HMANOTEXIST equ 090h
  54. ERR_HMAINUSE equ 091h
  55. ERR_HMAMINSIZE equ 092h
  56. ERR_HMANOTALLOCED equ 093h
  57. ERR_OUTOMEMORY equ 0A0h
  58. ERR_OUTOHANDLES equ 0A1h
  59. ERR_INVALIDHANDLE equ 0A2h
  60. ERR_SHINVALID equ 0A3h
  61. ERR_SOINVALID equ 0A4h
  62. ERR_DHINVALID equ 0A5h
  63. ERR_DOINVALID equ 0A6h
  64. ERR_LENINVALID equ 0A7h
  65. ERR_OVERLAP equ 0A8h
  66. ERR_PARITY equ 0A9h
  67. ERR_EMBUNLOCKED equ 0AAh
  68. ERR_EMBLOCKED equ 0ABh
  69. ERR_LOCKOVERFLOW equ 0ACh
  70. ERR_LOCKFAIL equ 0ADh
  71. ERR_UMBSIZETOOBIG equ 0B0h
  72. ERR_NOUMBS equ 0B1h
  73. ERR_INVALIDUMB equ 0B2h
  74. ; Macro to avoid the 286 POPF bug. Performs a harmless IRET to simulate a
  75. ; popf. Some 286s allow interrupts to sneak in during a real popf.
  76. popff macro
  77. push cs
  78. call pPPFIRet ; Defined as the offset of any IRET
  79. endm
  80. .286
  81. ;*----------------------------------------------------------------------*
  82. ;* SEGMENT DEFINITION *
  83. ;*----------------------------------------------------------------------*
  84. _text segment word public 'code'
  85. assume cs:_text,ds:_text
  86. ;************************************************************************
  87. ;* *
  88. ;* Data Structures *
  89. ;* *
  90. ;************************************************************************
  91. ; The driver Request Header structure definition.
  92. ReqHdr struc
  93. ReqLen db ?
  94. Unit db ?
  95. Command db ?
  96. Status dw ?
  97. Reserved db 8 dup (?)
  98. Units db ?
  99. Address dd ?
  100. pCmdLine dd ?
  101. ReqHdr ends
  102. ; An EMB Handle structure definition.
  103. Handle struc ; Handle Table Entry
  104. zzFlags db ? ; Unused/InUse/Free
  105. zzcLock db ? ; Lock count
  106. zzBase dw ? ; 32-bit base address in K
  107. zzLen dw ? ; 32-bit length in K
  108. if keep_cs
  109. zzAcs dw ? ; allocator's code segment
  110. endif
  111. Handle ends
  112. ; allow easy generation of appropriate segment overrides
  113. xFlags equ funky:zzFlags
  114. xcLock equ funky:zzcLock
  115. xBase equ funky:zzBase
  116. xLen equ funky:zzLen
  117. if keep_cs
  118. xAcs equ funky:zzAcs
  119. endif
  120. Flags equ funky:zzFlags
  121. cLock equ funky:zzcLock
  122. Base equ funky:zzBase
  123. Len equ funky:zzLen
  124. if keep_cs
  125. Acs equ funky:zzAcs
  126. endif
  127. ; Extended Memory Move Block structure definition.
  128. MoveExtendedStruc struc
  129. bCount dd ? ; Length of block to move
  130. SourceHandle dw ? ; Handle for souce
  131. SourceOffset dd ? ; Offset into source
  132. DestHandle dw ? ; Handle for destination
  133. DestOffset dd ? ; Offset into destination
  134. MoveExtendedStruc ends
  135.