Source code of Windows XP (NT5)
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.

1740 lines
58 KiB

  1. /*****************************************************************************
  2. (C) Copyright MICROSOFT Corp., 1988-1992
  3. Title: DEBUGSYS.INC - VMM debugging include file
  4. Version: 1.00
  5. Date: 13-Jun-1988
  6. Author: RAL
  7. ------------------------------------------------------------------------------
  8. Change log:
  9. DATE REV DESCRIPTION
  10. ----------- --- -----------------------------------------------------------
  11. 13-Jun-1988 RAL
  12. 24-Oct-1988 RAP changed INT from 2E to 41, and added functions for
  13. Windows to notify the debugger about segment selectors
  14. 14-Dec-1988 RAP split services into ones available through INT 41h
  15. for non-ring 0 clients and those available through INT 21h
  16. for ring 0 clients
  17. 11-Dec-1990 ERH Merged WIN386 copy with file actually used by the
  18. debugger.
  19. 11-Dec-1990 ERH Merged file describing real mode services with this
  20. one.
  21. 24-Feb-1997 AJO Converted from inc to h, added WDeb98 stuff, PTrace stuff
  22. ==============================================================================*/
  23. #ifndef _DEBUGSYS_H
  24. #define _DEBUGSYS_H
  25. /*
  26. * Note: You must define WDEB98 to use any of the new WDEB98 services...
  27. *
  28. */
  29. /******************************************************************************
  30. Real mode Debugger services:
  31. */
  32. // hooked by the debugger in real mode.
  33. #define D386_RM_Int 0x68
  34. // debugger identification code
  35. #define D386_Id 0x0F386
  36. // minimum INT 68 function code
  37. #define D386_MIN 0x43
  38. // returns debugger identification, if debugger loaded
  39. #define D386_Identify 0x43
  40. // partially prepare for protected mode operation.
  41. #define D386_Prepare_PMode 0x44
  42. /*
  43. A pointer to a procedure is returned so that the IDT can also be set in
  44. protected mode
  45. INPUT:
  46. AL 0 - retail version of Win386
  47. 1 - debugging version
  48. BX a valid selector that gives access to all of memory
  49. CX first of 2 selectors reserved for WDeb386 to use
  50. DX is GDT selector
  51. DS:SI pointer to working copy of GDT
  52. ES:DI pointer to working copy of IDT
  53. RETURN:
  54. ES:EDI points to a protected mode procedure (selector:offset32) that can
  55. be called to set the IDT when it has been created. Takes a function
  56. number in AL. See the PMINIT equates.
  57. */
  58. // re-init from real mode after entering pmode
  59. #define D386_Real_Mode_Init 0x45
  60. // set debugging switches
  61. #define D386_Set_Switches 0x46
  62. /*
  63. BL = verbose switch
  64. - 00b - no segment display
  65. - 01b - display win386 segments only
  66. - 10b - display ring 1 segments only
  67. - 11b - display win386 & ring 1 segs
  68. BH = conditional brkpts
  69. 0 - off
  70. 1 - on
  71. -1 for BX means no change (default)
  72. */
  73. // execute conditional BP (/B option)
  74. #define D386_Execute_Cond 0x47
  75. // ES:SI points to NUL terminated string to print if conditional flag set.
  76. // undefine the real mode segment's symbols
  77. #define D386_Free_Segment 0x48
  78. // BX = real mode segment to undefined
  79. // set com port baud rate
  80. #define D386_Set_Baudrate 0x49
  81. // BX = baud rate
  82. // reinitialize debugger for protected mode
  83. #define D386_Reinit 0x4a
  84. /*
  85. AL 0 - retail version of Win386
  86. 1 - debugging version of Win386
  87. 2 - 286 DOS extender (3.0)
  88. 3 - 286 DOS extender under VCPI (3.1)
  89. 4 - 286 DOS extender (3.1)
  90. BX a valid selector that gives access to all of memory
  91. CX first of 2 selectors reserved for wdeb386 to use
  92. DX is GDT selector
  93. This function can after a function 45h only if function 44h was executed in
  94. the past on the IDT/GDT.
  95. */
  96. // define debugger's segments
  97. #define D386_Def_Deb_Segs 0x4b
  98. // set com port number
  99. #define D386_Set_Com_Port 0x4c
  100. // BX = com port number
  101. // returns AX != 0, error bad com port
  102. // link sym file map
  103. #define D386_Link_Sym 0x4d
  104. /*
  105. ES:DI pointer to AddrS struc in front of sym file map.
  106. BX loader ID (used to unlink sym file maps)
  107. A loader ID of 0 is used for all the maps
  108. wdeb386 loads via /S is ran as a program and
  109. -1 is used by the device driver version. All
  110. loader IDs of 0 are automaticly unlinked when
  111. wdeb386 exits.
  112. */
  113. // unlink sym file maps
  114. #define D386_Unlink_Sym 0x4e
  115. /*
  116. BX = loader ID - this routine looks at all
  117. of the maps that are currently linked and
  118. removes the ones that were loaded with this
  119. ID.
  120. */
  121. // remove any undefined segments from the name module's symbols
  122. #define D386_Remove_Segs 0x4f
  123. // ES:DI pointer to module name
  124. // defines the actual segment/selector for a loaded segment to allow for
  125. // symbol processing
  126. #define D386_Load_Segment 0x50
  127. /*
  128. INPUT:
  129. AL segment type 0 - code selector
  130. 1 - data selector
  131. 10h - code segment
  132. 11h - data segment
  133. 20h - real-mode EXE
  134. 40h - code segment & sel
  135. 41h - data segment & sel
  136. 80h - device driver code seg
  137. 81h - device driver data seg
  138. If AL = 20h then
  139. CX = paragraph number
  140. ES:DI pointer to module name
  141. Else If AL < 80h then
  142. BX segment #
  143. CX actual segment/selector
  144. DX actual selector (if 40h or 41h)
  145. ES:DI pointer to module name
  146. Else
  147. ES:DI points to D386_Device_Params struc
  148. RETURN:
  149. AL = 1, if successful, else 0
  150. */
  151. // display a character to the debugging terminal
  152. #define D386_Display_Char 0x51
  153. // AL = char to display
  154. // display a string to the debugging terminal
  155. #define D386_Display_Str 0x52
  156. // ES:SI points to NUL terminated string
  157. // returns if debug VxD has been installed
  158. #define D386_IsVxDInstalled 0x53
  159. // AL == 0 if not install, AL != 0 if installed
  160. // sets that the debug VxD installed/uninstalled
  161. #define D386_VxDInstall 0x54
  162. // BL == 0 if uninstall, BL != 0 if installed
  163. // registers dot command
  164. #define D386_RegisterDotCmd 0x55
  165. /*
  166. INPUTS
  167. BL = command letter
  168. CX:SI = address of dot command routine
  169. DX:DI = address of help text
  170. RETURNS
  171. AX == 0, no errors
  172. AX != 0, dot command already used or out of dot commands
  173. Dot command routine:
  174. -------------------
  175. CALLED WITH
  176. AL = command character
  177. DS:SI = linear address of command line terminated by a NULL or ";".
  178. DS,ES = debugger's data selector
  179. RETURNS
  180. AX ==0, no errors
  181. AX !=0, command line or option error
  182. */
  183. // de-registers dot command
  184. #define D386_DeRegisterDotCmd 0x56
  185. // BL = command letter
  186. // Printf
  187. #define D386_Printf 0x57
  188. /*
  189. (DS:SI) = address of format string
  190. (ES:DI) = address of the start of parameters
  191. set DS_Printf for format char information
  192. returns (AX) = number of characters printed
  193. */
  194. // link symbol file with physical address
  195. #define D386_Link_Sym_Phys 0x58
  196. /*
  197. (DX:CX) = physical address of one extra
  198. paragraph front of map file image.
  199. (SI) = XMS handle (0 if just physical)
  200. (BX) = load id
  201. */
  202. #define D386_CheckMap 0x59
  203. /*
  204. DX:DI = pointer to module name
  205. returns AX != 0, map found
  206. AX == 0, map not found
  207. */
  208. #define D386_SetAutoLoadSym 0x5a
  209. /*
  210. (BL) != 0, auto load symbols
  211. (BL) == 0, don't auto load symbols
  212. */
  213. #define D386_SetTeftiPort 0x5b
  214. // (BX) = TEFTI port address
  215. // execute debugger command script
  216. #define D386_ExecDebugCommand 0x5c
  217. /*
  218. (DS:SI) = ptr to debugger command script str
  219. (CX) = size of script
  220. */
  221. // makes the debugger copy its code/data high
  222. #define D386_LoadCodeDataHigh 0x5d
  223. // (DX:BX) = physical address to put debugger
  224. // sets Windows version number
  225. #define D386_SetWinVersion 0x5e
  226. // (DI) = Version number (default if this api not called is 0300h).
  227. // scan for character
  228. #define D386_ScanChar 0x5f
  229. // returns AL == 0, no char. AL != 0, char
  230. // ungetchar scaned character
  231. #define D386_UnGetChar 0x60
  232. // AL = char
  233. // stop at the CS:IP specified
  234. #define D386_Stop 0x61
  235. /*
  236. TOS + 0 = AX
  237. TOS + 2 = IP
  238. TOS + 4 = CS
  239. */
  240. #ifdef WDEB98
  241. // set com port baud rate (beyond 57600)
  242. #define D386_Set_Baudrate_Ex 0x62
  243. // EBX = baud rate, EBX is zero if successful
  244. // programs wdeb with windows info
  245. #define D386_SetBuildInfo 0x63
  246. // DS:EDX points to string of from "4.00.0950" or similar.
  247. // Sets new switches for WDEB
  248. #define D386_Set_Switches_Ex 0x64
  249. // EBX [0:1] controls text packet usage:
  250. // 00 - No change
  251. // 01 - Off
  252. // 10 - On with timeouts (switchbox environment)
  253. // 11 - On with infinite retries
  254. //
  255. // All other bits in EBX are reserved and must be zero.
  256. //
  257. #define D386_MAX 0x64 // maximum INT 68 function code
  258. #else // WDEB98
  259. #define D386_MAX 0x61 // maximum INT 68 function code
  260. #endif // WDEB98
  261. // D386_Load_Segment type ates:
  262. #define ST_code_sel 0x0 // code selector
  263. #define ST_data_sel 0x1 // data selector
  264. #define ST_code_seg 0x10 // code segment
  265. #define ST_data_seg 0x11 // data segment
  266. #define ST_dual_code 0x40 // code segment and selector
  267. #define ST_dual_data 0x41 // data segment and selector
  268. #define ST_device_code 0x80 // device driver code segment
  269. #define ST_device_data 0x81 // device driver data segment
  270. // D386_Load_Segment device load parameters structure
  271. // Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
  272. /*XLATOFF*/
  273. struct D386_Device_Params {
  274. WORD DD_logical_seg ; // logical segment # from map
  275. WORD DD_actual_sel ; // actual selector value
  276. DWORD DD_base ; // linear address offset for start of segment
  277. DWORD DD_length ; // actual length of segment
  278. FWORD DD_name ; // 16:32 ptr to null terminated device name
  279. FWORD DD_sym_name ; // 16:32 ptr to null terminated symbolic
  280. // module name (i.e. Win386)
  281. WORD DD_alias_sel ; // alias selector value (0 = none)
  282. } ;
  283. /*XLATON*/
  284. /* ASM
  285. D386_Device_Params STRUC
  286. DD_logical_seg DW ?
  287. DD_actual_sel DW ?
  288. DD_base DD ?
  289. DD_length DD ?
  290. DD_name DF ?
  291. DD_sym_name DF ?
  292. DD_alias_sel DW ?
  293. D386_Device_Params ENDS
  294. */
  295. // WDEB int 2f subfunctions (AH = W386_INT_MULTIPLEX, AL = W386_WDEB)
  296. // Entry: BX = subfunction number
  297. #define WDEB_INT2F_STARTING 0x0 // first time starting
  298. #define WDEB_INT2F_ENDING 0x1 // first time ending
  299. #define WDEB_INT2F_NESTED_STARTING 0x2 // start on level of nesting
  300. #define WDEB_INT2F_NESTED_ENDING 0x3 // end one level of nesting
  301. // PMINIT routine functions
  302. #define PMINIT_INIT_IDT 0x0 // (ES:EDI) = pointer to PM IDT
  303. #define PMINIT_INIT_PAGING 0x1 // (BX) = phys-linear selector
  304. // (ECX) = phys-linear bias
  305. #define PMINIT_ENABLE_DEBUG_QUERYS 0x2 // enables dot commands, etc.
  306. #define PMINIT_INIT_SPARE_PTE 0x3 // (EBX) = lin addr of spare PTE
  307. // (EDX) = lin addr the PTE is
  308. #define PMINIT_SET_ENTER_EXIT_VMM 0x4 // (EBX) = Enter VMM routine addr
  309. // (ECX) = Exit VMM routine addr
  310. // This routines must return
  311. // with a retfd.
  312. #define PMINIT_GET_SIZE_PHYS 0x5 // get debugger size/phys addr
  313. // returns:
  314. // AL = 0 (don't call AL=1)
  315. // ECX = size in bytes
  316. // ESI = starting phys addr
  317. // if this call is ignored
  318. // (AL = 5) then function 1 is
  319. // called with a phys-linear
  320. // region
  321. #define PMINIT_SET_BASE_SPARE_PTE 0x6 // set debugger base/spare PTE
  322. // EBX = laddr of spare PTE
  323. // EDX = laddr the PTE represents
  324. // ESI = starting linear address
  325. #define PMINIT_ENABLE_MEMORY_CONTEXT 0x7 // enables mem context functions
  326. #define PMINIT_MAX 0x7
  327. /*
  328. VCPI information, passed to debugger when client is DOS Extender
  329. running as a VCPI client. This information is used to get into
  330. and out of protected mode when running under a VCPI server.
  331. This structure is also used by the DOS Extender.
  332. */
  333. // Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
  334. /*XLATOFF*/
  335. struct WdebVCPIInfo {
  336. // Enter protected mode information.
  337. FWORD fnVCPI ; // VCPI protect mode server entry point
  338. WORD rdsVCPI ; // Selector for VCPI server
  339. // Enter v86 mode information.
  340. DWORD laVTP ; // linear address of data structure containing
  341. // values for system registers.
  342. WORD Port67 ; // Qualitas magic port for emulating INT 67h
  343. } ;
  344. /*XLATON*/
  345. /* ASM
  346. WdebVCPIInfo STRUC
  347. fnVCPI DF ?
  348. rdsVCPI DW ?
  349. laVTP DD ?
  350. Port67 DW ?
  351. WdebVCPIInfo ENDS
  352. */
  353. /*
  354. The following structure contains the system register contents for the
  355. VCPI server to use when switching to protected mode. It is taken
  356. from dxvcpi.inc in the DOSX project, and is part of the VCPI spec.
  357. */
  358. struct VTP {
  359. DWORD zaCr3VTP ; // physical addr of page directory
  360. DWORD laGdtrVTP ; // linear addr in first meg of gdtr
  361. DWORD laIdtrVTP ; // linear addr in first meg of idtr
  362. WORD selLdtVTP ; // selector of ldt
  363. WORD selTrVTP ; // selector of tr
  364. WORD ipVTP ; // 48-bit address of protect
  365. WORD unusedVTP ; // mode entry point to xfer to
  366. WORD csVTP ; //
  367. } ;
  368. #define VCPI_RM_CALLOUT_INT 0x67 // v86 mode call to VCPI server
  369. /*
  370. Send this value in AX to the VCPI server to request V86 to protected
  371. mode switch or protected to V86 mode switch.
  372. */
  373. #define VCPI_PROT_ENTRY 0x0DE0C
  374. /*****************************************************************************
  375. Protected mode Debugger services:
  376. */
  377. #define Debug_Serv_Int 0x41 // Interrupt that calls Deb386 to perform
  378. // debugging I/O, AX selects the function as
  379. // described by the following equates
  380. #define DS_Out_Char 0x0 // function to display the char in DL
  381. #define DS_In_Char 0x1 // function to read a char into AL
  382. #define DS_Out_Str 0x2 // function to display a NUL terminated string
  383. // pointed to by DS:ESI
  384. #define DS_Is_Char 0x3 // Non blocking In_Chr
  385. #define DS_Out_Str16 0x12 // function to display a NUL terminated string
  386. // pointed to by DS:SI
  387. // (same as function 2, but for 16 bit callers)
  388. #define DS_ForcedGO16 0x40 // enter the debugger and perform the equivalent
  389. // of a GO command to force a stop at the
  390. // specified CS:IP
  391. // CX is the desired CS
  392. // BX is the desired IP
  393. #define DS_LinkMap 0x45 // DX:(E)DI = ptr to paragraph in front of map
  394. #define DS_UnlinkMap 0x46 // DX:(E)DI = ptr to paragraph in front of map
  395. #define DS_CheckMap 0x47 // DX:(E)DI = pointer to module name
  396. // returns AX != 0, map found
  397. // AX == 0, map not found
  398. #define DS_IsAutoLoadSym 0x48 // returns AX != 0, auto load symbols
  399. // AX == 0, don't auto load symbols
  400. #define DS_DebLoaded 0x4F // check to see if the debugger is installed and
  401. // knows how to deal with protected mode programs
  402. // return AX = F386h, if true
  403. #define DS_DebPresent 0x0F386
  404. #define DS_LoadSeg 0x50 // define a segment value for the
  405. // debugger's symbol handling
  406. // SI type 0 - code selector
  407. // 1 - data selector
  408. // 80h - code segment
  409. // 81h - data segment
  410. // BX segment #
  411. // CX actual segment/selector
  412. // DX data instance
  413. // ES:(E)DI pointer to module name
  414. // [PTrace]
  415. #define DS_LoadSeg_32 0x0150 // Define a 32-bit segment for Windows 32
  416. // SI type 0 - code selector
  417. // 1 - data selector
  418. // DX:EBX points to a D386_Device_Params STRUC
  419. // with all the necessaries in it
  420. #define DS_MoveSeg 0x51 // notify the debugger that a segment has moved
  421. // BX old segment value
  422. // CX new segment value
  423. // [PTrace]
  424. #define DS_FreeSeg 0x52 // notify the debugger that a segment has been
  425. // freed
  426. // BX segment value
  427. // [PTrace]
  428. #define DS_FreeSeg_32 0x0152 // notify the debugger that a segment has been
  429. // freed
  430. // BX segment number
  431. // DX:EDI pointer to module name
  432. #define DS_DGH 0x56 // register "dump global heap" handler
  433. // BX is code offset
  434. // CX is code segment
  435. // [PTrace]
  436. #define DS_DFL 0x57 // register "dump free list" handler
  437. // BX is code offset
  438. // CX is code segment
  439. // [PTrace]
  440. #define DS_DLL 0x58 // register "dump LRU list" handler
  441. // BX is code offset
  442. // CX is code segment
  443. // [PTrace]
  444. #define DS_StartTask 0x59 // notify debugger that a new task is starting
  445. // BX is task handle
  446. // task's initial registers are stored on the
  447. // stack:
  448. // push cs
  449. // push ip
  450. // pusha
  451. // push ds
  452. // push es
  453. // push ss
  454. // push sp
  455. // [PTrace]
  456. #define DS_Kernel_Vars 0x5a // Used by the Windows kernel to tell the
  457. // debugger the location of kernel variables
  458. // used in the heap dump commands.
  459. // BX = version number of this data (03a0h)
  460. // DX:CX points to:
  461. // WORD hGlobalHeap ****
  462. // WORD pGlobalHeap ****
  463. // WORD hExeHead ****
  464. // WORD hExeSweep
  465. // WORD topPDB
  466. // WORD headPDB
  467. // WORD topsizePDB
  468. // WORD headTDB ****
  469. // WORD curTDB ****
  470. // WORD loadTDB
  471. // WORD LockTDB
  472. // WORD SelTableLen ****
  473. // DWORD SelTableStart ****
  474. //
  475. // The starred fields are used by the
  476. // heap dump commands which are internal
  477. // to WDEB386.
  478. #define DS_VCPI_Notify 0x5b // notify debugger that DOS extender is
  479. // running under a VCPI implementation,
  480. // and register VCPI protect mode interface
  481. // ES:DI points to a data structure used to
  482. // get from V86 mode to Pmode under VCPI.
  483. // This is defined in the VCPI version
  484. // 1.0 spec.
  485. #define DS_ReleaseSeg 0x5c // This does the same as a DS_FreeSeg, but
  486. // it restores any breakpoints first.
  487. // [PTrace]
  488. #define DS_User_Vars 0x5d // DS:SI = pointer to an array of offsets:
  489. // BX = windows version
  490. // CX = number of words in array
  491. // WORD = fDebugUser (1 = DEBUG, 0 = RETAIL)
  492. // WORD = 16 bit offset to hHmenuSel
  493. // WORD = 16 bit offset to hHwndSel
  494. // WORD = 16 bit offset to pclsList
  495. // WORD = 16 bit offset to pdceFirst
  496. // WORD = 16 bit offset to hwndDesktop
  497. // This array MUST BE COPIED it goes away
  498. // when we return from this service.
  499. #define DS_POSTLOAD 0x60 // Used by the RegisterPTrace interface
  500. #define DS_EXITCALL 0x62 // Somebody will fill these in if we ever
  501. #define DS_INT2 0x63 // figure out what they are supposed to do.
  502. #define DS_LOADDLL 0x64
  503. #define DS_DELMODULE 0x65
  504. #define DS_LOGERROR 0x66 // CX==error code, dx:bx = ptr to optional info
  505. #define DS_LOGPARAMERROR 0x67 // ES:BX = ptr to struct { err, lpfn, param } ;
  506. #define DS_RIN 0x09
  507. #define DS_BANKLINE 0x0A
  508. #define DS_NEWTASK 0x0B
  509. #define DS_FLUSHTASK 0x0C
  510. #define DS_SWITCHOUT 0x0D
  511. #define DS_SWITCHIN 0x0E
  512. //#define DS_KEYBOARD 0x0F // Conflicts with DS_Out_Symbol
  513. #define DS_IntRings 0x20 // function to tell debugger which INT 1's & 3's
  514. // to grab
  515. // BX == 0, grab only ring 0 ints
  516. // BX != 0, grab all ints
  517. #define DS_IncludeSegs 0x21 // function to tell debugger to go ahead and
  518. // process INT 1's & 3's which occur in this
  519. // DX:DI points to list of selectors
  520. // (1 word per entry)
  521. // CX = # of selectors (maximum of 20)
  522. // CX = 0, to remove the list of segs
  523. #define MaxDebugSegs 20
  524. #define DS_CondBP 0x0F001 // conditional break pt, if the command line
  525. // switch /B is given when the debugger is run
  526. // or the conditional flag is later set, then
  527. // this int should cause the program to break
  528. // into the debugger, else this int should be
  529. // ignored!
  530. // ESI points to a nul terminated string to
  531. // display if break is to happen.
  532. #define DS_ForcedBP 0x0F002 // break pt, which accomplishes the same thing
  533. // as an INT 1 or an INT 3, but is a break point
  534. // that should be permanently left in the code,
  535. // so that a random search of source code would
  536. // not result in the accidental removal of this
  537. // necessary break_pt
  538. #define DS_ForcedGO 0x0F003 // enter the debugger and perform the equivalent
  539. // of a GO command to force a stop at the
  540. // specified CS:EIP
  541. // CX is the desired CS
  542. // EBX is the desired EIP
  543. #define DS_HardINT1 0x0F004 // check to see if INT 1 hooked for all rings
  544. // ENTER: nothing
  545. // EXIT: AX = 0, if no, 1, if yes
  546. #define DS_Out_Symbol 0x0F // find the symbol nearest to the address in
  547. // CX:EBX and display the result in the format
  548. // symbol name <+offset>
  549. // the offset is only included if needed, and
  550. // no CR&LF is displayed
  551. #define DS_Disasm_Ins 0x10 // function to disassemble the instruction
  552. // pointed to by DS:ESI
  553. #define DS_JumpTableStart 0x70
  554. /*** DS_RegisterDotCommand
  555. This interface is used to register wdeb386 dot commands by FLAT 32
  556. bit code. The following conditions apply:
  557. * The code will be run at ring 0
  558. * Interrupts may be enabled
  559. * Must not access any invalid pages or load invalid selectors
  560. * Must stay on the stack called with when calling INT 41 services
  561. * Must not change DS or ES from the FLAT selector
  562. The help text is printed when .? is executed in the order of
  563. registration. The text must include CR/LF at the end; nothing
  564. is added to the help text.
  565. ENTRY: (AX) = 0070h
  566. (BL) = dot command to register
  567. (ESI) = linear address of dot command routine
  568. Dot command routine:
  569. ENTRY: (AL) = command character
  570. (DS, ES) = flat data selector
  571. EXIT: (AX) == 0, no errors
  572. (AX) != 0, command line or option error
  573. NOTE: MUST return with a 32 bit FAR return (retfd)
  574. (EDI) = linear address of help text
  575. EXIT: (AX) == 0, no errors
  576. (AX) != 0, dot command already used or out of dot commands
  577. */
  578. #define DS_RegisterDotCommand 0x70
  579. /*** DS_RegisterDotCommand16
  580. This interface is used to register wdeb386 dot commands by 16 bit
  581. code. The following conditions apply:
  582. * The code will be run at ring 0 or in real mode
  583. * Interrupts may not be enabled
  584. * Must not access any not present pages or load invalid selectors
  585. * Must stay on the stack called with when calling INT 41 services
  586. The help text is printed when .? is executed in the order of
  587. registration. The text must include CR/LF at the end; nothing
  588. is added to the help text.
  589. ENTRY: (AX) = 0071h
  590. (BL) = dot command to register
  591. (CX:SI) = address of dot command routine
  592. Dot command routine:
  593. ENTRY: (AL) = command character
  594. (DS, ES) = debugger's data selector
  595. EXIT: (AX) == 0, no errors
  596. (AX) != 0, command line or option error
  597. NOTE: MUST return with a 16 bit FAR return (retf)
  598. (DX:DI) = address of help text
  599. EXIT: (AX) == 0, no errors
  600. (AX) != 0, dot command already used or out of dot commands
  601. */
  602. #define DS_RegisterDotCommand16 0x71
  603. /*** DS_DeRegisterDotCommand
  604. This interface is used to de-register wdeb386 dot commands registered
  605. by the above 16 or 32 bit services. Care should be used not to
  606. de-register dot commands that weren't registered by your code.
  607. ENTRY: (AX) = 0072h
  608. (BL) = dot command to de-register
  609. EXIT: NONE
  610. */
  611. #define DS_DeRegisterDotCommand 0x72
  612. /*** DS_Printf
  613. This function allows formatted output with the standard "C"
  614. printf syntax.
  615. ENTRY: (AX) = 0073h
  616. (DS:ESI) = address of format string
  617. (ES:EDI) = address of the start of the dword arguments
  618. EXIT: (EAX) = number of characters printed
  619. Supported types are:
  620. %% %
  621. %[l][h]c character
  622. %[-][+][ ][0][width][.precision][l|h|p|n]d decimal
  623. %[-][0][width][.precision][l|h|p|n]u unsigned decimal
  624. %[-][#][0][width][.precision][l|h|p|n]x hex
  625. %[-][#][0][width][.precision][l|h|p|n]X hex
  626. %[-][0][width][.precision][l|h|p|n]o octal
  627. %[-][0][width][.precision][l|h|p|n]b binary
  628. %[-][width][.precision][l|h|a|F|R|P]s string
  629. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]A address
  630. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]S symbol
  631. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]G group:symbol
  632. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]M map:group:symbol
  633. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]g group
  634. %[-][width][.precision][l|h|a|p|n|F|L|R|L|H|N|Z]m map
  635. Where "width" or "precision" is a decimal number or the '*'
  636. character; '*' causes the field width or precision to be picked
  637. up from the next parameter. []'ed parameters are optional.
  638. "\r", "\t", "\n", "\a", "\b", are supported directly.
  639. Prefixes
  640. --------
  641. Used with c,d,u,x,X,o,b:
  642. Parameter Argument Size
  643. -----------------------
  644. word h
  645. dword l
  646. Used with s,A,S,G,M,g,m:
  647. Address Argument Size
  648. ---------------------
  649. 16 bit DS relative h
  650. 16:16 segment:offset hF or Fh
  651. 32 bit flat relative l
  652. 16:32 segment:offset (2 dwords) lF or Fl
  653. pointer to AddrS structure a
  654. segment is a real mode segment R
  655. segment is a protected mode selector P
  656. Default segment type is the current code type.
  657. Used with A,S,G,M,g,m:
  658. Address Display Size or Format
  659. ------------------------------
  660. 16 bit offset H
  661. 32 bit offset L
  662. offset only N
  663. no address Z
  664. Default display size depends on the "386env" flag setting.
  665. Used with S,G,M,g,m:
  666. gets the previous symbol p
  667. gets the next symbol n
  668. Used with A:
  669. gets the previous symbol address p
  670. gets the next symbol address n
  671. Used with d,u,x,X,o,b:
  672. gets the previous symbol offset p
  673. gets the next symbol offset n
  674. */
  675. #define DS_Printf 0x73
  676. /*** DS_Printf16
  677. This function allows formatted output with the standard "C"
  678. printf syntax.
  679. ENTRY: (AX) = 0074h
  680. (DS:SI) = address of format string
  681. (ES:DI) = address of the start of the word or dword arguments
  682. EXIT: (AX) = number of characters printed
  683. The format options and parameters are the same as DS_Printf except
  684. the default parameter size is a word (the h option is implicit).
  685. */
  686. #define DS_Printf16 0x74
  687. /*** DS_GetRegisterSet
  688. This function copies the current register set.
  689. ENTRY: (AX) = 0075h
  690. (DS:ESI) = address of SaveRegs_Struc structure
  691. EXIT: NONE
  692. */
  693. #define DS_GetRegisterSet 0x75
  694. /*** DS_SetAlternateRegisterSet
  695. This function temporary sets the debugger's registers to values
  696. passed in the structure. If an "r" command is executed or the
  697. debugged code is returned to (via the "g", "t" or "p" commands),
  698. the register set reverts to the debugged code's registers.
  699. ENTRY: (AX) = 0076h
  700. (CX) = thread ID, 0 use current thread ID
  701. (DS:ESI) = address of SaveRegs_Struc structure
  702. EXIT: NONE
  703. */
  704. #define DS_SetAlternateRegisterSet 0x76
  705. /*** DS_GetCommandLineChar
  706. This services gets the next character off the command line.
  707. ENTRY: (AX) = 0077h
  708. (BL) = 0 just peek the character, don't increment text pointer
  709. leading white space isn't ignored
  710. (BL) = 1 get the character, increment text pointer
  711. leading white space is skipped
  712. (BL) = 2 peek the character, don't increment text pointer
  713. leading white space is skipped
  714. EXIT: (AL) = command line character
  715. (AH) == 0 if no more characters (EOL)
  716. (AH) != 0 if more characters
  717. */
  718. #define DS_GetCommandLineChar 0x77
  719. /*** DS_EvaluateExpression
  720. Expressions can be numbers of various radices, symbols, addresses
  721. or an combination of the above hooked together with various
  722. operators. Expressions are separated by blanks or commas. This
  723. function is passed a pointer to the beginning of the text of the
  724. expression (i.e. "%80003444+4232"). The expression is either
  725. evaluated down into a dword value if there are no addresses or
  726. into a linear address.
  727. ENTRY: (AX) = 0078h
  728. EXIT: (AX) == 0, returning a data value
  729. (AX) != 0, returning a linear address
  730. (CX) = thread id
  731. (EBX) = return value
  732. NOTE: If the expression is invalid, this service will not
  733. return. A message is printed and control returns to
  734. the command loop.
  735. */
  736. #define DS_EvaluateExpression 0x78
  737. /*** DS_VerifyMemory
  738. ENTRY: (AX) = 0079h
  739. (ECX) = length of memory region
  740. (DS:ESI) = address of memory to verify
  741. EXIT: (AX) == 0, no errors
  742. (AX) != 0, invalid memory
  743. */
  744. #define DS_VerifyMemory 0x79
  745. /*** DS_PrintRegisters
  746. This function prints (just like the "r" command) the either the
  747. debugged code's registers or the alternate register set, set with
  748. DS_SetAlternateRegisterSet function.
  749. ENTRY: (AX) = 007ah
  750. EXIT: NONE
  751. NOTE: If the CS:EIP is invalid, this service will not return
  752. because of an error when the code is disassembled. A
  753. message is printed and control returns to the command loop.
  754. */
  755. #define DS_PrintRegisters 0x7a
  756. /*** DS_PrintStackDump
  757. This function prints (just like the "k" command) the stack dump
  758. based on the current register set that may have been set with
  759. DS_SetAlternateRegisterSet function.
  760. ENTRY: (AX) = 007bh
  761. (BX) = flags
  762. 01h - verbose stack dump
  763. 02h - 16 bit stack dump
  764. 04h - 32 bit stack dump
  765. EXIT: NONE
  766. NOTE: If the CS:EIP or SS:EBP are invalid, this service will not
  767. return because of an error when accessing the stack. A
  768. message is printed and control returns to the command loop.
  769. */
  770. #define DS_PrintStackDump 0x7b
  771. /*** DS_SetThreadID
  772. This function sets what the debugger thinks the thread ID is
  773. for memory address in other address contexts. It stays set
  774. until the debugged code is returned to (via "g", "t" or "p")
  775. or set back to 0.
  776. ENTRY: (AX) = 007ch
  777. (CX) = thread ID or 0 for currently executed thread
  778. EXIT: NONE
  779. */
  780. #define DS_SetThreadID 0x7c
  781. /*** DS_ExecDebugCommand
  782. This service allows any debugger command to be executed. In can
  783. be a multi-lined script with the lines separated by CR, LF. MUST
  784. have a "g" command at the end of script so the debugger doesn't
  785. stop while in the INT 41.
  786. ENTRY: (AX) = 007dh
  787. (DS:ESI) = pointer to debugger command script string
  788. (CX) = size of script
  789. EXIT: NONE
  790. NOTE: If the any kind of error happens, this service will not
  791. return. A message is printed and control returns to the
  792. command loop.
  793. */
  794. #define DS_ExecDebugCommand 0x7d
  795. /*** DS_GetDebuggerInfo
  796. This service returns various debugger info and routines.
  797. ENTRY: (AX) = 007eh
  798. (DS:ESI) = pointer to DebInfoBuf structure
  799. (ECX) = size of the above buffer. Only this many bytes are
  800. copied to the buffer this allows more info to be
  801. passed in future versions without breaking anything.
  802. EXIT: (AX) == 0, no errors
  803. (AX) != 0, error: (AX) == 007eh, function not implemented
  804. (AX) == anything else, invalid buffer
  805. */
  806. #define DS_GetDebuggerInfo 0x7e
  807. /*** DS_CheckFault
  808. This service checks if the debugger wants control on the fault.
  809. ENTRY: (AX) = 007fh
  810. (BX) = fault number
  811. (CX) = fault type mask
  812. DEBUG_FAULT_TYPE_V86
  813. DEBUG_FAULT_TYPE_PM
  814. DEBUG_FAULT_TYPE_RING0
  815. DEBUG_FAULT_TYPE_FIRST
  816. DEBUG_FAULT_TYPE_LAST
  817. EXIT: (AX) == 0, handle fault normally
  818. (AX) != 0, handled by debugger
  819. */
  820. #define DS_CheckFault 0x7f
  821. /*** DS_SetBreak
  822. This service allows an error break or ctrl-c handler to be
  823. set. The old value that is returned must be save and set
  824. back to remove the break handler.
  825. ENTRY: (AX) = 0080h
  826. (DS:ESI) = pointer to BreakStruc with the CS:EIP and
  827. SS:ESP values to be used when a error break or ctrl-c
  828. happens. The old value is copied into this buffer.
  829. EXIT: (AX) == 0, no error
  830. (AX) != 0, error on BreakStruc address
  831. */
  832. #define DS_SetBreak 0x80
  833. /*** DS_RedirectExec
  834. This service redirects the input and output streams to the
  835. specified buffers for the debugger command line passed.
  836. ENTRY: (AX) = 0081h
  837. (DS:ESI) = pointer to RedirectExecStruc
  838. EXIT: (ECX) = number of bytes written
  839. (AX) == 0, no error
  840. (AX) != 0, error
  841. 1 to 10 = memory access error
  842. -1 = buffer overflow
  843. -2 = invalid parameter, not on a 386, or reentered
  844. */
  845. #define DS_RedirectExec 0x81
  846. /*** DS_PassOnDebugCommand
  847. Used to tell the debugger to pass this dot command on to the
  848. next handler.
  849. ENTRY: (AX) = 0082h
  850. EXIT: NONE
  851. */
  852. #define DS_PassOnDebugCommand 0x82
  853. /*** DS_TrapFault
  854. Allows ring 3 code to send a fault to the debugger
  855. ENTRY: (AX) = 0083h
  856. (BX) = fault number
  857. (CX) = faulting CS
  858. (EDX) = faulting EIP
  859. (ESI) = fault error code
  860. (EDI) = faulting flags
  861. EXIT: (CX) = replacement CS
  862. (EDX) = replacement EIP
  863. */
  864. #define DS_TrapFault 0x83
  865. /*** DS_SetStackTraceCallBack
  866. Sets the "k" command callback filter used to back trace
  867. thru thunks.
  868. ENTRY: (AX) = 0084h
  869. (EBX) = linear address of call back routine, zero to uninstall
  870. (ECX) = linear address of the end of the call back routine
  871. (EDX) = EIP to use for for faults in call back routine
  872. EXIT: NONE
  873. CALLBACK:
  874. ENTRY: (EAX) = linear base of SS
  875. (EBX) = linear address of SS:EBP
  876. (DS, ES) = flat ds
  877. (SS) = NOT flat ds !!!!!!!!!
  878. EXIT: (EAX) = FALSE, no thunk
  879. TRUE, is a thunk
  880. (CX:ESI) = new SS:EBP
  881. (DX:EDI) = new CS:EIP
  882. */
  883. #define DS_SetStackTraceCallBack 0x84
  884. /*** DS_RemoveSegs
  885. Removes all the undefined groups from a map file.
  886. ENTRY: (AX) = 0085h
  887. (ES:EDI) pointer to module name
  888. EXIT: NONE
  889. */
  890. #define DS_RemoveSegs 0x85
  891. /*** DS_DefineDebugSegs
  892. Defines the debugger's code and data symbols.
  893. ENTRY: (AX) = 0086h
  894. EXIT: NONE
  895. */
  896. #define DS_DefineDebugSegs 0x86
  897. /*** DS_SetBaudRate
  898. Sets the com port's baud rate.
  899. Use DS_SetBaudRateEx to get 115200bps (only on WDEB98 and up)
  900. ENTRY: (AX) = 0087h
  901. (BX) = baud rate
  902. EXIT: NONE
  903. */
  904. #define DS_SetBaudRate 0x87
  905. /*** DS_SetComPort
  906. Sets the com port's baud rate
  907. ENTRY: (AX) = 0088h
  908. (BX) = com port number
  909. EXIT: (AX) == 0, ok
  910. (AX) != 0, error bad com port
  911. */
  912. #define DS_SetComPort 0x88
  913. /*** DS_ChangeTaskNum
  914. Changes a task number to another task number or
  915. indicates that the task has gone away.
  916. ENTRY: (AX) = 0089h
  917. (CX) = old task number
  918. (DX) = new task number or -1 if process terminated.
  919. EXIT: NONE
  920. */
  921. #define DS_ChangeTaskNum 0x89
  922. /*** DS_ExitCleanup
  923. Called when Windows exits.
  924. ENTRY: (AX) = 008ah
  925. EXIT: NONE
  926. */
  927. #define DS_ExitCleanup 0x8a
  928. /*** DS_InstallVGAHandler
  929. Called when the Debug VxD is initializing (during Device Init),
  930. to specify an alternate I/O handler for VGA. The handler accepts the
  931. following inputs:
  932. BX == subfunction #:
  933. 0 == save screen state (switch to debugger context)
  934. No inputs/outputs
  935. 1 == restore screen state (switch to windows context)
  936. No inputs/outputs
  937. 2 == display output character (ie, OEMOutputCharCOM)
  938. on input, AL == character
  939. 3 == check for input character (ie, OEMScanCharCOM)
  940. on output, ZR if no chars, else NZ and AL == char
  941. ENTRY: (AX) = 008bh
  942. (DX:EDI) == 16:32 address to call, with BX == subfunction above
  943. EXIT: NONE
  944. */
  945. #define DS_InstallVGAHandler 0x8b
  946. /*** DS_GetComBase
  947. Called when Debug VxD is initializing (during Device Init),
  948. to get the base of the com port being used by wdeb386.
  949. Entry:
  950. (AX) == 008ch
  951. Exit:
  952. (AX) = base of COM port.
  953. */
  954. #define DS_GetComBase 0x8c
  955. /*** DS_GetSymbol
  956. Looks up a symbol and returns the linear address and segment/offset.
  957. ENTRY: (AX) == 008dh
  958. (DS:ESI) = ptr to null-terminated symbol
  959. EXIT: (AX) == 0, no error
  960. (AX) == 1, symbol not found
  961. (AX) == 2, memory not loaded yet
  962. (ECX) = linear address of variable (if AX == 0)
  963. (EDX) = seg:offset of variable (if AX == 0)
  964. */
  965. #define DS_GetSymbol 0x8d
  966. /*** DS_CopyMem
  967. Copys memory from one AddrS to another AddrS
  968. ENTRY: (AX) == 008eh
  969. (DS:ESI) = pointer to source AddrS block
  970. (ES:EDI) = pointer to destination AddrS block
  971. (CX) = number of bytes
  972. EXIT: (AX) == 0, no error
  973. (AX) != 0, invalid address
  974. */
  975. #define DS_CopyMem 0x8e
  976. /*** DS_LogPrintf
  977. Just like DS_Printf except it prints to the log file
  978. ENTRY: see DS_Printf
  979. */
  980. #define DS_LogPrintf 0x8f
  981. #ifdef WDEB98
  982. #define DS_Reserved0 0x8f
  983. #define DS_IsCompatibleWDeb 0x90
  984. /*** DS_IsCompatibleWDeb
  985. Used to determine WDeb version.
  986. ENTRY: (AX) = 0090h
  987. (BX) = WDeb version, major version in hiword, minor version
  988. in low word. For example:
  989. BH == 98T BL == 0
  990. EXIT: (AX) == 0, version is supported,
  991. (AX) != 0, version is not supported
  992. */
  993. #define DS_SetBaudRateEx 0x91
  994. /*** DS_SetBaudRateEx
  995. Sets the com port's baud rate. Supports >57600kbps
  996. Only available on WDEB98 and up
  997. ENTRY: (AX) = 0091h
  998. (EBX) = baud rate
  999. EXIT: EBX == 0, no error
  1000. EBX != 0, error or not supported function (try DS_SetBaudRate)
  1001. */
  1002. #define DS_GetSetDebuggerState 0x92
  1003. /*** DS_GetSetDebuggerState
  1004. This function can be used to temporarily change the state of the
  1005. debugger (this function might be called if the comm port were about
  1006. to turn off or on).
  1007. ENTRY: (AX) = 0092h
  1008. (BX) = Debugger State:
  1009. 0 == No state change will occur if this value is used. Use this
  1010. value to retrieve the current state of the debugger.
  1011. 1 == Debugger is on and responds to all faults, CTRL-C attempts,
  1012. comm port input requests, and comm port output requests.
  1013. 2 == Debugger does not respond to traps, but still responds to all
  1014. CTRL-C attempts, comm port input requests, and comm port
  1015. output requests. This means the Windows Debug Kernel
  1016. "Abort, Retry, ..." messages will still work, but no Win32
  1017. or Ring0 assertions will stop the machine.
  1018. 3 == Debugger does not respond to traps, or CTRL-C attempts. Comm
  1019. port input requests, and comm port input and output requests
  1020. are honored still, as above.
  1021. 4 == Debugger does not respond to traps, or CTRL-C attempts, or
  1022. comm port input requests. Only comm port output requests are
  1023. processed.
  1024. 5 == Debugger does not respond to traps, CTRL-C attempts,
  1025. comm port input requests, or comm port output requests. The
  1026. debugger is essentially "silent". Most other API calls
  1027. (DS_LoadSeg, DS_EvaluateExpression, etc) are still supported.
  1028. EXIT: AX == 0, if successful. BX is the new state.
  1029. AX != 0, not successful
  1030. */
  1031. #define DS_TestDebugComPort 0x93
  1032. /*** DS_TestDebugComPort
  1033. This function determines whether the passed in port range is in
  1034. use by WDEB98, and determines the state of Rterm98 on the other
  1035. end of the port. Calling this function can also allow "late" binding
  1036. on WDeb to a com port (useful if the OS needs to "turn on" the
  1037. port range first.) If this function finds an Rterm98, an implicit
  1038. call to DS_GetSetDebuggerState with BX==1 is made.
  1039. ENTRY: (AX) = 0093h
  1040. (BX) = Port range to test (3F8, 2F8, etc)
  1041. (CX==0) - If WDeb has not found it's com port yet (ie, the
  1042. port is set to auto, or was not available at boot
  1043. time), WDeb can acquire this port. In the case of
  1044. auto port selection, this port will be acquired
  1045. only if Rterm98 is detected on the other side.
  1046. (CX==1) - WDeb will _not_ take this com port if it does not
  1047. already have one.
  1048. EXIT: (AX) != 0, API error (for example, called on WDeb386)
  1049. (AX) == 0, then...
  1050. (BH==0) - Debugger is not on this port.
  1051. (BL==0) - Debugger is on another port already
  1052. (BL==1) - Debugger does not have a port yet.
  1053. (BL==2) - Debugger could not initialize this port
  1054. (BL==3) - Debugger could not find an Rterm98 on this port.
  1055. (BH==1) - Debugger is using this port
  1056. (BL==0) - Rterm98 cannot be found, or not responding.
  1057. (BL==1) - Rterm98 version is too old.
  1058. (BL==2) - WDeb98 version is too old.
  1059. (BL==3) - Rterm present and fully compatible.
  1060. */
  1061. #define DS_Reserved4 0x94
  1062. #define DS_Reserved5 0x95
  1063. #define DS_Reserved6 0x96
  1064. #define DS_Reserved7 0x97
  1065. #define DS_Reserved8 0x98
  1066. #define DS_Reserved9 0x99
  1067. #define DS_Reserved10 0x9A
  1068. #define DS_Reserved11 0x9B
  1069. #define DS_Reserved12 0x9C
  1070. #define DS_Reserved13 0x9D
  1071. #define DS_Reserved14 0x9E
  1072. #define DS_Reserved15 0x9F
  1073. /*** DS_InstallVxDThunk
  1074. Installs a private callback for WDeb98 and it's accompanying VxD.
  1075. This routine is the 16 -> 32 bit portion of the thunk layer.
  1076. ENTRY: (AX) = 00A0h
  1077. (DX:EDI) == 16:32 address to call
  1078. BUGBUG: DOC this better!
  1079. */
  1080. #define DS_InstallVxDThunk 0xA0
  1081. /*** DS_ThunkDownTo16
  1082. Entry into a private callback into 16bit WDeb98 for it's VxD.
  1083. This int is the 32 -> 16 bit portion of the thunk layer.
  1084. ENTRY: (AX) = 00A1h
  1085. BUGBUG: DOC this better!
  1086. */
  1087. #define DS_ThunkDownTo16 0xA1
  1088. #define DS_JumpTableEnd 0xA1
  1089. #else // WDEB98
  1090. #define DS_JumpTableEnd 0x8f
  1091. #endif // WDEB98
  1092. struct SaveRegs_Struc {
  1093. DWORD Debug_EAX ;
  1094. DWORD Debug_EBX ;
  1095. DWORD Debug_ECX ;
  1096. DWORD Debug_EDX ;
  1097. DWORD Debug_ESP ;
  1098. DWORD Debug_EBP ;
  1099. DWORD Debug_ESI ;
  1100. DWORD Debug_EDI ;
  1101. WORD Debug_ES ;
  1102. WORD Debug_SS ;
  1103. WORD Debug_DS ;
  1104. WORD Debug_FS ;
  1105. WORD Debug_GS ;
  1106. DWORD Debug_EIP ;
  1107. WORD Debug_CS ;
  1108. DWORD dwReserved ;
  1109. DWORD Debug_EFlags ;
  1110. DWORD Debug_CR0 ;
  1111. QWORD Debug_GDT ;
  1112. QWORD Debug_IDT ;
  1113. WORD Debug_LDT ;
  1114. WORD Debug_TR ;
  1115. DWORD Debug_CR2 ;
  1116. DWORD Debug_CR3 ;
  1117. DWORD Debug_DR0 ;
  1118. DWORD Debug_DR1 ;
  1119. DWORD Debug_DR2 ;
  1120. DWORD Debug_DR3 ;
  1121. DWORD Debug_DR6 ;
  1122. DWORD Debug_DR7 ;
  1123. DWORD Debug_DR7_2 ;
  1124. DWORD Debug_TR6 ;
  1125. DWORD Debug_TR7 ;
  1126. WORD Debug_TrapNumber ; // -1 means no trap number
  1127. WORD Debug_ErrorCode ; // 0 means no error code
  1128. } ;
  1129. // Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
  1130. /*XLATOFF*/
  1131. struct DebInfoBuf {
  1132. BYTE DIB_MajorVersion ;
  1133. BYTE DIB_MinorVersion ;
  1134. BYTE DIB_Revision ;
  1135. BYTE DIB_Reserved ;
  1136. DWORD DIB_DebugTrap16 ; // send 16 bit trap to debugger
  1137. FWORD DIB_DebugTrap32 ; // send 32 bit trap to debugger
  1138. DWORD DIB_DebugBreak16 ; // 16 bit break in debugger
  1139. FWORD DIB_DebugBreak32 ; // 32 bit break in debugger
  1140. DWORD DIB_DebugCtrlC16 ; // 16 bit check for ctrl C
  1141. FWORD DIB_DebugCtrlC32 ; // 32 bit check for ctrl C
  1142. } ;
  1143. /*XLATON*/
  1144. /* ASM
  1145. DebInfoBuf STRUC
  1146. DIB_MajorVersion DB ?
  1147. DIB_MinorVersion DB ?
  1148. DIB_Revision DB ?
  1149. DIB_Reserved DB ?
  1150. DIB_DebugTrap16 DD ?
  1151. DIB_DebugTrap32 DF ?
  1152. DIB_DebugBreak16 DD ?
  1153. DIB_DebugBreak32 DF ?
  1154. DIB_DebugCtrlC16 DD ?
  1155. DIB_DebugCtrlC32 DF ?
  1156. DebInfoBuf ENDS
  1157. */
  1158. struct BreakStruc {
  1159. DWORD BS_BreakEIP ; // CS:EIP, SS:ESP to go to on a error or ctrlc break
  1160. WORD BS_BreakCS ;
  1161. DWORD BS_BreakESP ;
  1162. WORD BS_BreakSS ;
  1163. } ;
  1164. // Don't let h2inc see FWORD as it doesn't understand FWORD, QWORD, & TWORD
  1165. /*XLATOFF*/
  1166. struct RedirectExecStruc {
  1167. FWORD RDE_fpbufDebugCommand ; // debugger command script
  1168. WORD RDE_cbDebugCommand ; // debugger command script len
  1169. FWORD RDE_fpszInput ; // input stream pointer
  1170. WORD RDE_usFlags ; // reserved (must be 0)
  1171. DWORD RDE_cbOutput ; // size of output buffer
  1172. FWORD RDE_fpbufOutput ; // output buffer pointer
  1173. } ;
  1174. /*XLATON*/
  1175. /* ASM
  1176. RedirectExecStruc STRUC
  1177. RDE_fpbufDebugCommand DF ?
  1178. RDE_cbDebugCommand DW ?
  1179. RDE_fpszInput DF ?
  1180. RDE_usFlags DW ?
  1181. RDE_cbOutput DD ?
  1182. RDE_fpbufOutput DF ?
  1183. RedirectExecStruc ENDS
  1184. */
  1185. #define REPEAT_FOREVER_CHAR 0x0fe // send next character until
  1186. // end of debugger command
  1187. // for printf service
  1188. struct AddrS {
  1189. DWORD AddrOff ;
  1190. WORD AddrSeg ;
  1191. BYTE AddrType ;
  1192. BYTE AddrSize ;
  1193. WORD AddrTask ;
  1194. } ;
  1195. //AddrTypeSize equ word ptr AddrType
  1196. #define EXPR_TYPE_SEG 0x0001 // 00000001b address type segment:offset
  1197. #define EXPR_TYPE_SEL 0x0009 // 00001001b address type selector:offset
  1198. #define EXPR_TYPE_LIN 0x0002 // 00000010b address type linear
  1199. #define EXPR_TYPE_PHY 0x000A // 00001010b address type physical
  1200. #define EXPR_TYPE_LOG 0x0008 // 00001000b logical address (no sel yet)
  1201. #define EXPR_TYPE_MOD 0x000B // 00001011b module address (no sel yet)
  1202. #define DEBUG_FAULT_TYPE_V86 0x0001 // 00000001b
  1203. #define DEBUG_FAULT_TYPE_PM 0x0002 // 00000010b
  1204. #define DEBUG_FAULT_TYPE_RING0 0x0004 // 00000100b
  1205. #define DEBUG_FAULT_TYPE_FIRST 0x0008 // 00001000b
  1206. #define DEBUG_FAULT_TYPE_LAST 0x0010 // 00010000b
  1207. //
  1208. // Interrupt and services that Win386 provides to the debugger
  1209. //
  1210. #define Win386_Query_Int 0x22 // interrupt for Win386 protected mode
  1211. // interface requests
  1212. #define Win386_Alive 0 // function 0, query Win386 installation
  1213. #define Win386_Q_Ack 0x0F386 // good response from func 43h, of
  1214. // INT 68h & func 4fh of INT 41h
  1215. #define Win386_Query 1 // function 1, query Win386 state
  1216. // ds:esi points to command string
  1217. // that Win386 needs to process
  1218. // ds:edi points to the SaveRegs_Struc
  1219. // that the debugger has stored all the
  1220. // client register state into.
  1221. // (Win386 just writes the query
  1222. // answers directly to the output
  1223. // device, so no response is returned)
  1224. #define Win386_PhysToLinr 2 // function 2, have Win386 convert a
  1225. // physical address into a valid
  1226. // linear address that Deb386 can
  1227. // use. esi is physicaladdress
  1228. // cx is # of bytes required
  1229. // returns esi as linear address
  1230. // returns ax = 1, if okay, else
  1231. // 0, if request couldn't be completed
  1232. #define Win386_AddrValid 3 // function 3, have Win386 check the
  1233. // validity of a linear address
  1234. // esi is linear address to check
  1235. // cx is # of bytes required
  1236. // returns ax = 1, if address okay
  1237. // else ax = 0
  1238. #define Win386_MapVM 4 // function 4, make sure that the VM's
  1239. // low memory is mapped in, in case
  1240. // it is touched (a count is maintained)
  1241. #define Win386_UnmapVM 5 // function 5, map out the VM's low
  1242. // memory (dec the count)
  1243. #define Win386_GetDLAddr 6 // function 6, return offset of dyna-link
  1244. // service. EBX = Device ID << 10h +
  1245. // Service #. Returns EAX = Offset.
  1246. #define Win386_GetVXDName 7 // function 7, determines whether an address
  1247. // is within a VXD object.
  1248. // DS:ESI -> buffer to receive object name
  1249. // BX = thread number
  1250. // EDX = linear address to query
  1251. // If EAX == 0, EDX = base address of object
  1252. // If EAX != 0, error
  1253. #define Win386_GetPDE 8 // function 8, get pde for a context
  1254. // BX = thread number
  1255. // EDX = linear address
  1256. // if EAX == 0, ECX = PDE
  1257. // if EAX != 0, error
  1258. #define Win386_GetFrame 9 // function 9, get phys addr for not pres ptes
  1259. // BX = thread number
  1260. // EDX = linear address
  1261. // ECX = PDE or PTE
  1262. // ESI = 0 if PDE, !0 if PTE
  1263. // if EAX == 0, EDX = physical address
  1264. // if EAX != 0, error
  1265. #define Win386_GetLDTAddress 10 // function 10,
  1266. // BX = thread number
  1267. // if EAX == 0,
  1268. // EDI = pointer to LDT
  1269. // ECX = ldt limit
  1270. // if EAX != 0, error
  1271. #define Win386_GetThreadID 11 // function 11, AX = Current Thread ID
  1272. #define Win386_GetTSHandler 12 // function 12, return offset of transfer-space
  1273. // fault handler. EBX = 16:16 addr of
  1274. // int 30h. Returns EAX = Offset or 0.
  1275. #define Win386_GetArplHandler 13 // function 12, return offset of ARPL fault
  1276. // fault handler. Eb = 16:16 addr of
  1277. // ARPL. Returns EAX = Offset or 0.
  1278. #define Max_Win386_Services 13
  1279. #endif // _DEBUGSYS_H