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.

572 lines
14 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. IFDEF NEC_98
  48. IDT_ENTRIES equ 100h
  49. BIOS_KEYBOARD_INTERRUPT equ 18h
  50. BIOS_DISK_INTERRUPT equ 1bh
  51. else ;NEC_98
  52. BIOS_DISK_INTERRUPT equ 13h
  53. BIOS_READ_SECTOR equ 2
  54. IDT_ENTRIES equ 100h
  55. BIOS_KEYBOARD_INTERRUPT equ 16h
  56. endif ;NEC_98
  57. EXPORT_STACK equ 07ffeh
  58. RE_ENABLING equ 1
  59. LOADER_STACK equ 061ffch
  60. CR0_ET equ 10h
  61. ;
  62. ; Trap Number macro save eax on the stack and then pushes the
  63. ; number of the trap that's in progress.
  64. ;
  65. TRAP_NUMBER macro num,addr
  66. IF num EQ 9
  67. push eax ; push place holder for error code
  68. ENDIF
  69. IF num LE 7
  70. push eax ; push place holder for error code
  71. ENDIF
  72. push eax ; save eax on stack first
  73. mov eax,num
  74. push eax
  75. jmp addr
  76. endm
  77. ;;
  78. ;
  79. ; GetSector Stack Frame Structure
  80. ;
  81. ; Stack frame definition for GetSector call from OS loader
  82. ; to 16bit routines.
  83. ;
  84. ;;
  85. GetSectorFrame struc
  86. FunctionNumber dd ?
  87. DriveNumber dd ?
  88. HeadNumber dd ?
  89. TrackNumber dd ?
  90. SectorNumber dd ?
  91. NumberOfSectors dd ?
  92. BufferPointer dd ?
  93. GetSectorFrame ends
  94. ;;
  95. ;
  96. ; GetEddsSector Stack Frame Structure
  97. ;
  98. ; Stack frame definition for GetEddsSector call from OS loader
  99. ; to 16bit routines.
  100. ;
  101. ;;
  102. GetEddsSectorFrame struc
  103. DriveNum dd ?
  104. LBNLow dd ?
  105. LBNHigh dd ?
  106. NumberOfBlocks dd ?
  107. BufPointer dd ?
  108. FunctionNum dd ?
  109. GetEddsSectorFrame ends
  110. RebootFrame struc
  111. BootType dd ?
  112. RebootFrame ends
  113. ;
  114. ; ABIOS services Stack Frame Structure
  115. ;
  116. ; Stack frame definition for ABIOS services call from OS loader
  117. ; to 16 bit routine.
  118. ;
  119. AbiosServicesFrame struc
  120. AbiosFunction dd ?
  121. CommonDataArea dd ?
  122. InitTable dd ?
  123. RamExtension dd ?
  124. AbiosRoutine dd ?
  125. LogicalId dd ?
  126. NumberLids dd ?
  127. AbiosServicesFrame ends
  128. ;
  129. ; Hardware detection frame structure
  130. ;
  131. ; Stack frame definition for DetectHardware call from OS loader
  132. ; to 16 bit routine.
  133. ;
  134. DetectionFrame struc
  135. HeapStart dd ?
  136. HeapSize dd ?
  137. ConfigTree dd ?
  138. HeapUsed dd ?
  139. LoadOptions dd ?
  140. OptionsLength dd ?
  141. DetectionFrame ends
  142. ;
  143. ; HardwareCursor Stack Frame Structure
  144. ;
  145. ; Stack frame definition for HardwareCursor call from OS loader
  146. ; to 16 bit routine.
  147. ;
  148. HardwareCursorFrame struc
  149. XCoord dd ?
  150. YCoord dd ?
  151. HardwareCursorFrame ends
  152. ;
  153. ; GetDateTime Stack Frame Structure
  154. ;
  155. ; Stack frame definition for GetDateTime call from OS loader
  156. ; to 16 bit routine.
  157. ;
  158. GetDateTimeFrame struc
  159. DateDword dd ?
  160. TimeDword dd ?
  161. GetDateTimeFrame ends
  162. ;
  163. ; ComPort Stack Frame Structure
  164. ;
  165. ; Stack frame definition for ComPort call from OS loader
  166. ; to 16 bit routine.
  167. ;
  168. ComPortFrame struc
  169. ComPortPort dd ?
  170. ComPortFunction dd ?
  171. ComPortArg dd ?
  172. ComPortFrame ends
  173. ;
  174. ; IsMcaMachine Stack Frame Structure
  175. ;
  176. ; Stack frame definition for IsMcaMachine call from OS loader
  177. ; to 16 bit routine.
  178. ;
  179. IsMcaMachineFrame struc
  180. Dummy dd ?
  181. IsMcaMachineFrame ends
  182. ;;
  183. ;
  184. ; GetElToritoStatus Stack Frame Structure
  185. ;
  186. ; Stack frame definition for GetElToritoStatus call from OS loader
  187. ; to 16bit routines.
  188. ;
  189. ;;
  190. GetElToritoStatusFrame struc
  191. SpecPacketPointer dd ?
  192. ETDriveNum dd ?
  193. GetElToritoStatusFrame ends
  194. ;;
  195. ;
  196. ; GetExtendedInt13Params Stack Frame Structure
  197. ;
  198. ; Stack frame definition for GetExtendedInt13Params call from OS loader
  199. ; to 16bit routines.
  200. ;
  201. ;;
  202. GetExtendedInt13ParamsFrame struc
  203. ParamPacketPointer dd ?
  204. Int13UnitNumber dd ? ; really only a byte >= 0x80
  205. GetExtendedInt13ParamsFrame ends
  206. ;;
  207. ;
  208. ; NetPcRomServices Stack Frame Structure
  209. ;
  210. ; Stack frame definition for NetPcRomServices call from OS loader
  211. ; to 16bit routines.
  212. ;
  213. ;;
  214. NetPcRomServicesFrame struc
  215. NetPcRomFunctionNumber dd ?
  216. NetPcRomCommandPacketPointer dd ?
  217. NetPcRomServicesFrame ends
  218. ;;
  219. ;
  220. ; BiosRedirectService Stack Frame Structure
  221. ;
  222. ; Stack frame definition for BiosRedirectService call from OS loader
  223. ; to 16bit routines.
  224. ;
  225. ;;
  226. BiosRedirectServiceFrame struc
  227. Command dd ?
  228. BiosRedirectServiceFrame ends
  229. ;;
  230. ;
  231. ; Memory Descriptor Structure.
  232. ;
  233. ; Passed to OS loader as part of the boot context record
  234. ;
  235. ;;
  236. MemoryDescriptor struc
  237. BlockBase dd ?
  238. BlockSize dd ?
  239. MemoryDescriptor ends
  240. ;;
  241. ;
  242. ; File System Context Record Structure
  243. ;
  244. ;;
  245. FsContextRecord struc
  246. BootDrive db ?
  247. FsContextRecord ends
  248. ;;
  249. ;
  250. ; IDT Descriptor Structure
  251. ;
  252. ;;
  253. TrapDesc struc
  254. IDT_offset dw ?
  255. IDT_selector dw ?
  256. IDT_attribute dw ?
  257. IDT_reserved dw ?
  258. TrapDesc ends
  259. ;;
  260. ;
  261. ; GDT Descriptor Structure ;;
  262. ;
  263. ;;
  264. GDTDesc struc
  265. GDT_limit dw 0
  266. GDT_base1 dw 0
  267. GDT_base2 db 0
  268. GDT_access db 0
  269. GDT_limacc db 0
  270. GDT_base3 db 0
  271. GDTDesc ends
  272. ;;
  273. ;
  274. ; GDT Selector Definitions
  275. ;
  276. ;;
  277. NULL_Selector equ 0h
  278. KeCodeSelector equ 8h
  279. KeDataSelector equ 10h
  280. UsCodeSelector equ 18h
  281. UsDataSelector equ 20h
  282. TSS_Selector equ 28h
  283. PCR_Selector equ 30h
  284. TEP_Selector equ 38h
  285. BDA_Selector equ 40h
  286. KeLdtSelector equ 48h
  287. DblFltTskSelector equ 50h
  288. SuCodeSelector equ 58h
  289. SuDataSelector equ 60h
  290. VideoSelector equ 68h
  291. GDT_AliasSelector equ 70h
  292. DbCodeSelector equ 78h
  293. DbDataSelector equ 80h
  294. DebugUseSelector equ 88h
  295. MdlSelector equ 90h
  296. ;;
  297. ;
  298. ; Exception Frame Structure
  299. ; Note, this absolutely must match the corresponding structure
  300. ; defined in "types.h"
  301. ;
  302. ;;
  303. ExceptionFrame struc
  304. Ftr dw 0
  305. Fdr6 dd 0
  306. Fcr0 dd 0
  307. Fcr2 dd 0
  308. Fcr3 dd 0
  309. Fss dw 0
  310. Fgs dw 0
  311. Ffs dw 0
  312. Fes dw 0
  313. Fds dw 0
  314. Fedi dd 0
  315. Fesi dd 0
  316. Febp dd 0
  317. Fesp dd 0
  318. Febx dd 0
  319. Fedx dd 0
  320. Fecx dd 0
  321. TrapNum dd 0
  322. Feax dd 0
  323. Error dd 0
  324. Feip dd 0
  325. Fcs dd 0
  326. Feflags dd 0
  327. ExceptionFrame ends
  328. FUNCTION_ERROR equ -1
  329. ;;
  330. ;
  331. ; Register Frame Structure
  332. ;
  333. ; For bios int calls
  334. ;
  335. ;;
  336. reg_frame struc
  337. intnum dw ?
  338. sfg dw ?
  339. sax dw ?
  340. sbx dw ?
  341. scx dw ?
  342. sdx dw ?
  343. ssi dw ?
  344. ses dw ?
  345. reg_frame ends
  346. IFDEF NEC_98
  347. gdpRegistors struc
  348. rAL db 0FFh
  349. FLG db ?
  350. rBX dw ?
  351. rCX dw ?
  352. rDX dw ?
  353. gdpRegistors ends
  354. PartitionDescriptor struc
  355. BootableFlag db ?
  356. PartitionType db ?
  357. Reserved00 dw ?
  358. IPLSector db ?
  359. IPLTrack db ?
  360. IPLCylinder dw ?
  361. StartingSector db ?
  362. StartingTrack db ?
  363. StartingCylinder dw ?
  364. EndingSector db ?
  365. EndingTrack db ?
  366. EndingCylinder dw ?
  367. PartitionName db 16 dup(?) ; ASCII strings
  368. PartitionDescriptor ends
  369. BIOS_FLAG equ 500h ; byte in ROM work segment
  370. BIOS_FLAG1 equ 480h ; byte in ROM work segment
  371. BIOS_FLAG4 equ 484h ; byte in ROM work segment
  372. BIOS_FLAG5 equ 458h ; byte in ROM work segment
  373. BIOS_FLAG6 equ 45Ah ; byte in ROM work segment
  374. AT_SWITCH equ 457h ; byte in ROM work segment
  375. DAUA equ 584h ; byte in ROM work segment
  376. DISK_EQUIP equ 55Ch ; byte in ROM work segment
  377. DISK_EQUIPS_SCSI equ 482h ; byte in ROM work segment
  378. EXPMMSIZ equ 401h ; byte in ROM work segment
  379. EXPMMSZ2 equ 594h ; word in ROM work segment
  380. DISK_RESULT equ 564h ; word in ROM work segment
  381. H_EQUIPS equ 47Dh ; byte in ROM work segment
  382. H_DISK_EQUIPS equ 47Eh ; word in ROM work segment
  383. EQUIPS_47Ch equ 47Ch ; byte in ROM work segment
  384. IC0 equ 10000000b
  385. IC1 equ 01000000b
  386. DAFloppy equ 00010000b ; floppy bit in DA
  387. DASCSI equ 00100000b ; SCSI bit in DA
  388. DASASI equ 00000000b ; SASI bit in DA
  389. DEVICEFORMAT equ 0FFFFh
  390. TRACKFORMAT equ 00000h
  391. MEMBANK08 equ 91h ; bank 08
  392. MEMBANK0A equ 93h ; bank 0A
  393. ROLLOVER_COUNT equ 45011 ; 1/18.2 * 2457.6KHz /3
  394. TIMER_VECTOR equ (8*4)
  395. TIMER1_DATA_PORT0 equ 71h ; Timer1, channel 0 data port
  396. TIMER1_CONTROL_PORT0 equ 77h ; Timer1, channel 0 control port
  397. TIMER1_INTSHAREREG equ 879h ; PC-H98 TIMER INT SHARE REGISTER
  398. COMMAND_8254_COUNTER0 equ 00h ; Select count 0
  399. COMMAND_8254_RW_16BIT equ 30h ; Read/Write LSB firt then MSB
  400. COMMAND_8254_MODE2 equ 4 ; Use mode 2
  401. UR_DAT equ 030h ; data port
  402. UR_LCR equ UR_DAT+2 ; line control registers
  403. UR_LSR equ UR_DAT+2 ; line status register
  404. UR_IEN equ UR_DAT+5 ; Interrupt enable
  405. UR_TIMERSET equ 75h ; 8253 counter set
  406. UR_TIMERMODE equ 77h ; 8253 counter mode
  407. UR_MODE equ 01001110B ; stop 1, disable p, 8 bpc, 1 stop, x16
  408. UR_COMMAND equ 00110111B ; RTS, err reset, RXE, DTR, TXEN
  409. UR_RESET equ 01000000B ; internal reset command
  410. RD_RDY equ 02h ; recieve data ready
  411. TX_RDY equ 01h ; transmitter empty if 1
  412. endif ;NEC_98
  413. ;;
  414. ;; Processor Flags
  415. ;;
  416. PROT_MODE equ 000000001 ; Enable protect mode operation
  417. ENABLE_PAGING equ 80000000h ; Enable paging hardware
  418. PD_PHYSICAL_ADDRESS equ 99000h
  419. TSS_SIZE equ 80h
  420. OVERRIDE equ 66h
  421. ;
  422. ; Operand and Address size overrides
  423. ;
  424. OPSIZE macro
  425. db 66h
  426. endm
  427. ADSIZE macro
  428. db 67h
  429. endm
  430. ;
  431. ; External Procedures for SUDATA.ASM
  432. ;
  433. IFDEF SU_CODEMODULE
  434. extrn _SuMain:near
  435. extrn _ScreenStart:near
  436. extrn _vp:near
  437. extrn _putx:near
  438. extrn _TrapHandler:near
  439. extrn _GDTregister:fword
  440. extrn _IDTregister:fword
  441. extrn _IDTregisterZero:fword
  442. extrn saveDS:word
  443. extrn SuStack:word
  444. extrn _edata:word
  445. extrn _FileStart:dword
  446. ENDIF
  447. ;
  448. ; External Procedures for SUDATA.ASM
  449. ;
  450. IFDEF SU_DATAMODULE
  451. extrn Trap0:far
  452. extrn Trap1:far
  453. extrn Trap2:far
  454. extrn Trap3:far
  455. extrn Trap4:far
  456. extrn Trap5:far
  457. extrn Trap6:far
  458. extrn Trap7:far
  459. extrn Trap8:far
  460. extrn Trap9:far
  461. extrn TrapA:far
  462. extrn TrapB:far
  463. extrn TrapC:far
  464. extrn TrapD:far
  465. extrn TrapE:far
  466. extrn TrapF:far
  467. extrn _edata:near
  468. ENDIF
  469. ;
  470. ; Segment declarations for "Small Model" 16 bit Su Module.
  471. ;
  472. _TEXT segment para use16 public 'CODE'
  473. _TEXT ends
  474. _DATA segment para use16 public 'DATA'
  475. _DATA ends
  476. CONST segment para use16 public 'CONST'
  477. CONST ends
  478. _BSS segment para use16 public 'BSS'
  479. _BSS ends
  480. DGROUP group const, _BSS, _DATA
  481. ;;; END OF FILE ;;;
  482.