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.

464 lines
9.7 KiB

  1. ;++
  2. ;
  3. ; Module name
  4. ;
  5. ; su.inc
  6. ;
  7. ; Author
  8. ;
  9. ; Thomas Parslow (tomp) Mar-1-90
  10. ;
  11. ; Description
  12. ;
  13. ; Include file for SU.ASM.
  14. ;
  15. ;
  16. ;--
  17. .386
  18. PAGE_SIZE equ 1000h
  19. MACHINE_TYPE_ISA equ 0
  20. MACHINE_TYPE_EISA equ 1
  21. MACHINE_TYPE_MCA equ 2
  22. ;
  23. ; Define the segment:offset address pair of the location to
  24. ; load detection module.
  25. ; N.B. This definition *MUST* be the same as the ones defined
  26. ; in ..\constant.h
  27. ;
  28. DETECTION_ADDRESS_SEG equ 1000h
  29. DETECTION_ADDRESS_OFFSET equ 0
  30. ;
  31. ; Structure definitions and equates for INT 15 function E820
  32. ;
  33. E820Frame struc
  34. ErrorFlag dd ?
  35. Key dd ?
  36. DescSize dd ?
  37. BaseAddrLow dd ?
  38. BaseAddrHigh dd ?
  39. SizeLow dd ?
  40. SizeHigh dd ?
  41. MemoryType dd ?
  42. E820Frame ends
  43. MemoryDescriptorFramePointer struc
  44. E820FramePointer dd ?
  45. MemoryDescriptorFramePointer ends
  46. ;
  47. BIOS_DISK_INTERRUPT equ 13h
  48. BIOS_READ_SECTOR equ 2
  49. IDT_ENTRIES equ 100h
  50. BIOS_KEYBOARD_INTERRUPT equ 16h
  51. EXPORT_STACK equ 07ffeh
  52. RE_ENABLING equ 1
  53. LOADER_STACK equ 061ffch
  54. CR0_ET equ 10h
  55. ;
  56. ; Trap Number macro save eax on the stack and then pushes the
  57. ; number of the trap that's in progress.
  58. ;
  59. TRAP_NUMBER macro num,addr
  60. IF num EQ 9
  61. push eax ; push place holder for error code
  62. ENDIF
  63. IF num LE 7
  64. push eax ; push place holder for error code
  65. ENDIF
  66. push eax ; save eax on stack first
  67. mov eax,num
  68. push eax
  69. jmp addr
  70. endm
  71. ;;
  72. ;
  73. ; GetSector Stack Frame Structure
  74. ;
  75. ; Stack frame definition for GetSector call from OS loader
  76. ; to 16bit routines.
  77. ;
  78. ;;
  79. GetSectorFrame struc
  80. FunctionNumber dd ?
  81. DriveNumber dd ?
  82. HeadNumber dd ?
  83. TrackNumber dd ?
  84. SectorNumber dd ?
  85. NumberOfSectors dd ?
  86. BufferPointer dd ?
  87. GetSectorFrame ends
  88. ;;
  89. ;
  90. ; GetEddsSector Stack Frame Structure
  91. ;
  92. ; Stack frame definition for GetEddsSector call from OS loader
  93. ; to 16bit routines.
  94. ;
  95. ;;
  96. GetEddsSectorFrame struc
  97. DriveNum dd ?
  98. LBNLow dd ?
  99. LBNHigh dd ?
  100. NumberOfBlocks dd ?
  101. BufPointer dd ?
  102. FunctionNum dd ?
  103. GetEddsSectorFrame ends
  104. RebootFrame struc
  105. BootType dd ?
  106. RebootFrame ends
  107. ;
  108. ; ABIOS services Stack Frame Structure
  109. ;
  110. ; Stack frame definition for ABIOS services call from OS loader
  111. ; to 16 bit routine.
  112. ;
  113. AbiosServicesFrame struc
  114. AbiosFunction dd ?
  115. CommonDataArea dd ?
  116. InitTable dd ?
  117. RamExtension dd ?
  118. AbiosRoutine dd ?
  119. LogicalId dd ?
  120. NumberLids dd ?
  121. AbiosServicesFrame ends
  122. ;
  123. ; Hardware detection frame structure
  124. ;
  125. ; Stack frame definition for DetectHardware call from OS loader
  126. ; to 16 bit routine.
  127. ;
  128. DetectionFrame struc
  129. HeapStart dd ?
  130. HeapSize dd ?
  131. ConfigTree dd ?
  132. HeapUsed dd ?
  133. LoadOptions dd ?
  134. OptionsLength dd ?
  135. DetectionFrame ends
  136. ;
  137. ; HardwareCursor Stack Frame Structure
  138. ;
  139. ; Stack frame definition for HardwareCursor call from OS loader
  140. ; to 16 bit routine.
  141. ;
  142. HardwareCursorFrame struc
  143. XCoord dd ?
  144. YCoord dd ?
  145. HardwareCursorFrame ends
  146. ;
  147. ; GetDateTime Stack Frame Structure
  148. ;
  149. ; Stack frame definition for GetDateTime call from OS loader
  150. ; to 16 bit routine.
  151. ;
  152. GetDateTimeFrame struc
  153. DateDword dd ?
  154. TimeDword dd ?
  155. GetDateTimeFrame ends
  156. ;
  157. ; ComPort Stack Frame Structure
  158. ;
  159. ; Stack frame definition for ComPort call from OS loader
  160. ; to 16 bit routine.
  161. ;
  162. ComPortFrame struc
  163. ComPortPort dd ?
  164. ComPortFunction dd ?
  165. ComPortArg dd ?
  166. ComPortFrame ends
  167. ;
  168. ; IsMcaMachine Stack Frame Structure
  169. ;
  170. ; Stack frame definition for IsMcaMachine call from OS loader
  171. ; to 16 bit routine.
  172. ;
  173. IsMcaMachineFrame struc
  174. Dummy dd ?
  175. IsMcaMachineFrame ends
  176. ;;
  177. ;
  178. ; GetElToritoStatus Stack Frame Structure
  179. ;
  180. ; Stack frame definition for GetElToritoStatus call from OS loader
  181. ; to 16bit routines.
  182. ;
  183. ;;
  184. GetElToritoStatusFrame struc
  185. SpecPacketPointer dd ?
  186. ETDriveNum dd ?
  187. GetElToritoStatusFrame ends
  188. ;;
  189. ;
  190. ; GetExtendedInt13Params Stack Frame Structure
  191. ;
  192. ; Stack frame definition for GetExtendedInt13Params call from OS loader
  193. ; to 16bit routines.
  194. ;
  195. ;;
  196. GetExtendedInt13ParamsFrame struc
  197. ParamPacketPointer dd ?
  198. Int13UnitNumber dd ? ; really only a byte >= 0x80
  199. GetExtendedInt13ParamsFrame ends
  200. ;;
  201. ;
  202. ; Memory Descriptor Structure.
  203. ;
  204. ; Passed to OS loader as part of the boot context record
  205. ;
  206. ;;
  207. MemoryDescriptor struc
  208. BlockBase dd ?
  209. BlockSize dd ?
  210. MemoryDescriptor ends
  211. ;;
  212. ;
  213. ; File System Context Record Structure
  214. ;
  215. ;;
  216. FsContextRecord struc
  217. BootDrive db ?
  218. FsContextRecord ends
  219. ;;
  220. ;
  221. ; IDT Descriptor Structure
  222. ;
  223. ;;
  224. TrapDesc struc
  225. IDT_offset dw ?
  226. IDT_selector dw ?
  227. IDT_attribute dw ?
  228. IDT_reserved dw ?
  229. TrapDesc ends
  230. ;;
  231. ;
  232. ; GDT Descriptor Structure ;;
  233. ;
  234. ;;
  235. GDTDesc struc
  236. GDT_limit dw 0
  237. GDT_base1 dw 0
  238. GDT_base2 db 0
  239. GDT_access db 0
  240. GDT_limacc db 0
  241. GDT_base3 db 0
  242. GDTDesc ends
  243. ;;
  244. ;
  245. ; GDT Selector Definitions
  246. ;
  247. ;;
  248. NULL_Selector equ 0h
  249. KeCodeSelector equ 8h
  250. KeDataSelector equ 10h
  251. UsCodeSelector equ 18h
  252. UsDataSelector equ 20h
  253. TSS_Selector equ 28h
  254. PCR_Selector equ 30h
  255. TEP_Selector equ 38h
  256. BDA_Selector equ 40h
  257. KeLdtSelector equ 48h
  258. DblFltTskSelector equ 50h
  259. SuCodeSelector equ 58h
  260. SuDataSelector equ 60h
  261. VideoSelector equ 68h
  262. GDT_AliasSelector equ 70h
  263. DbCodeSelector equ 78h
  264. DbDataSelector equ 80h
  265. DebugUseSelector equ 88h
  266. ReservedSelector equ 90h
  267. ;;
  268. ;
  269. ; Exception Frame Structure
  270. ; Note, this absolutely must match the corresponding structure
  271. ; defined in "types.h"
  272. ;
  273. ;;
  274. ExceptionFrame struc
  275. Ftr dw 0
  276. Fdr6 dd 0
  277. Fcr0 dd 0
  278. Fcr2 dd 0
  279. Fcr3 dd 0
  280. Fss dw 0
  281. Fgs dw 0
  282. Ffs dw 0
  283. Fes dw 0
  284. Fds dw 0
  285. Fedi dd 0
  286. Fesi dd 0
  287. Febp dd 0
  288. Fesp dd 0
  289. Febx dd 0
  290. Fedx dd 0
  291. Fecx dd 0
  292. TrapNum dd 0
  293. Feax dd 0
  294. Error dd 0
  295. Feip dd 0
  296. Fcs dd 0
  297. Feflags dd 0
  298. ExceptionFrame ends
  299. FUNCTION_ERROR equ -1
  300. ;;
  301. ;
  302. ; Register Frame Structure
  303. ;
  304. ; For bios int calls
  305. ;
  306. ;;
  307. reg_frame struc
  308. intnum dw ?
  309. sfg dw ?
  310. sax dw ?
  311. sbx dw ?
  312. scx dw ?
  313. sdx dw ?
  314. ssi dw ?
  315. ses dw ?
  316. reg_frame ends
  317. ;;
  318. ;; Processor Flags
  319. ;;
  320. PROT_MODE equ 000000001 ; Enable protect mode operation
  321. ENABLE_PAGING equ 80000000h ; Enable paging hardware
  322. PD_PHYSICAL_ADDRESS equ 99000h
  323. TSS_SIZE equ 80h
  324. OVERRIDE equ 66h
  325. ;
  326. ; Operand and Address size overrides
  327. ;
  328. OPSIZE macro
  329. db 66h
  330. endm
  331. ADSIZE macro
  332. db 67h
  333. endm
  334. ;
  335. ; External Procedures for SUDATA.ASM
  336. ;
  337. IFDEF SU_CODEMODULE
  338. extrn _SuMain:near
  339. extrn _ScreenStart:near
  340. extrn _vp:near
  341. extrn _putx:near
  342. extrn _TrapHandler:near
  343. extrn _GDTregister:fword
  344. extrn _IDTregister:fword
  345. extrn _IDTregisterZero:fword
  346. extrn saveDS:word
  347. extrn SuStack:word
  348. extrn _edata:word
  349. extrn _FileStart:dword
  350. ENDIF
  351. ;
  352. ; External Procedures for SUDATA.ASM
  353. ;
  354. IFDEF SU_DATAMODULE
  355. extrn Trap0:far
  356. extrn Trap1:far
  357. extrn Trap2:far
  358. extrn Trap3:far
  359. extrn Trap4:far
  360. extrn Trap5:far
  361. extrn Trap6:far
  362. extrn Trap7:far
  363. extrn Trap8:far
  364. extrn Trap9:far
  365. extrn TrapA:far
  366. extrn TrapB:far
  367. extrn TrapC:far
  368. extrn TrapD:far
  369. extrn TrapE:far
  370. extrn TrapF:far
  371. extrn _edata:near
  372. ENDIF
  373. ;
  374. ; Segment declarations for "Small Model" 16 bit Su Module.
  375. ;
  376. _TEXT segment para use16 public 'CODE'
  377. _TEXT ends
  378. _DATA segment para use16 public 'DATA'
  379. _DATA ends
  380. CONST segment para use16 public 'CONST'
  381. CONST ends
  382. _BSS segment para use16 public 'BSS'
  383. _BSS ends
  384. DGROUP group const, _BSS, _DATA
  385. ;;; END OF FILE ;;;
  386.