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.

867 lines
27 KiB

  1. ;******************************************************************************
  2. ;
  3. ; (C) Copyright MICROSOFT Corp., 1988-1990
  4. ;
  5. ; Title: DEBUGSYS.INC - VMM debugging include file
  6. ;
  7. ; Version: 1.00
  8. ;
  9. ; Date: 13-Jun-1988
  10. ;
  11. ; Author: RAL
  12. ;
  13. ;------------------------------------------------------------------------------
  14. ;
  15. ; README README README README README
  16. ;
  17. ; The "master copy" of this file lives in the WIN386 include directory.
  18. ; If another copy of this file is ever checked in anywhere, the copy
  19. ; should be checked periodically to make sure it is identical with the
  20. ; master copy.
  21. ;
  22. ;------------------------------------------------------------------------------
  23. ;
  24. ; Change log:
  25. ;
  26. ; DATE REV DESCRIPTION
  27. ; ----------- --- -----------------------------------------------------------
  28. ; 13-Jun-1988 RAL
  29. ; 24-Oct-1988 RAP changed INT from 2E to 41, and added functions for
  30. ; Windows to notify the debugger about segment selectors
  31. ; 14-Dec-1988 RAP split services into ones available through INT 41h
  32. ; for non-ring 0 clients and those available through INT 21h
  33. ; for ring 0 clients
  34. ; 11-Dec-1990 ERH Merged WIN386 copy with file actually used by the
  35. ; debugger.
  36. ; 11-Dec-1990 ERH Merged file describing real mode services with this
  37. ; one.
  38. ;
  39. ;==============================================================================
  40. ;******************************************************************************
  41. ;
  42. ; Real mode Debugger services:
  43. ;
  44. ;
  45. D386_RM_Int equ 68h ; hooked by the debugger in real mode.
  46. D386_Id equ 0F386h ; debugger identification code
  47. D386_MIN equ 43h ; minimum INT 68 function code
  48. D386_Identify equ 43h ; returns debugger identification, if debugger
  49. ; loaded
  50. D386_Prepare_PMode equ 44h ; partially prepare for protected mode operation
  51. ; a pointer to a procedure is returned so that
  52. ; the IDT can also be set in protected mode
  53. ; INPUT:
  54. ; AL 0 - retail version of Win386
  55. ; 1 - debugging version
  56. ; BX a valid selector that gives access
  57. ; to all of memory
  58. ; CX first of 2 selectors reserved for
  59. ; WDeb386 to use
  60. ; DX is GDT selector
  61. ; DS:SI pointer to working copy of GDT
  62. ; ES:DI pointer to working copy of IDT
  63. ;
  64. ; RETURN:
  65. ; ES:EDI points to a protected mode procedure
  66. ; (selector:offset32) that can be called
  67. ; to set the IDT when it has been created.
  68. ; This protected mode procedure takes a
  69. ; pointer to the PMode IDT in ES:EDI.
  70. D386_Real_Mode_Init equ 45h ; re-init fro real mode after entering pmode
  71. D386_Set_Switches equ 46h ; set debugging switches
  72. ; BL = verbose switch
  73. ; - 00b - no segment display
  74. ; - 01b - display win386 segments only
  75. ; - 10b - display ring 1 segments only
  76. ; - 11b - display win386 & ring 1 segs
  77. ; BH = conditional brkpts
  78. ; 0 - off
  79. ; 1 - on
  80. ; -1 for BX means no change (default)
  81. D386_Execute_Cond equ 47h ; execute conditional BP (/B option)
  82. ; ES:SI points to NUL terminated string
  83. ; to print if conditional flag set.
  84. D386_Set_Baudrate equ 49h ; set com port baud rate
  85. ; BX = baud rate
  86. D386_Reinit equ 4ah ; reinitialize debugger for protected mode
  87. ; AL 0 - retail version of Win386
  88. ; 1 - debugging version of Win386
  89. ; 2 - 286 DOS extender (3.0)
  90. ; 3 - 286 DOS extender under VCPI (3.1)
  91. ; 4 - 286 DOS extender (3.1)
  92. ; BX a valid selector that gives access
  93. ; to all of memory
  94. ; CX first of 2 selectors reserved for
  95. ; wdeb386 to use
  96. ; DX is GDT selector
  97. ;
  98. ; This function can after a function 45h only
  99. ; if function 44 was executed in the past on
  100. ; the IDT/GDT.
  101. D386_Def_Deb_Segs equ 4bh ; define debugger's segments
  102. D386_Set_Com_Port equ 4ch ; set com port number
  103. ; BX = com port number
  104. ; returns AX != 0, error bad com port
  105. D386_Link_Sym equ 4dh ; link sym file map
  106. ; ES:DI pointer to AddrS struc in front of
  107. ; sym file map.
  108. ; BX = loader ID (used to unlink sym file maps)
  109. ; A loader ID of 0 is used for all the maps
  110. ; wdeb386 loads via /S is ran as a program and
  111. ; -1 is used by the device driver version. All
  112. ; loader IDs of 0 are automaticly unlinked when
  113. ; wdeb386 exits.
  114. D386_Unlink_Sym equ 4eh ; unlink sym file maps
  115. ; BX = loader ID - this routine looks at all
  116. ; of the maps that are currently linked and
  117. ; removes the ones that were loaded with this
  118. ; ID.
  119. D386_Remove_Segs equ 4fh ; remove any undefined segments from the
  120. ; name module's symbols
  121. ; ES:DI pointer to module name
  122. D386_Load_Segment equ 50h ; defines the actual segment/selector for a
  123. ; loaded segment to allow for symbol processing
  124. ; INPUT:
  125. ; AL segment type 0 - code selector
  126. ; 1 - data selector
  127. ; 10h - code segment
  128. ; 11h - data segment
  129. ; 40h - code segment & sel
  130. ; 41h - data segment & sel
  131. ; 80h - device driver code seg
  132. ; 81h - device driver data seg
  133. ; If AL < 80h then
  134. ; BX segment #
  135. ; CX actual segment/selector
  136. ; DX actual selector (if 40h or 41h)
  137. ; ES:DI pointer to module name
  138. ; Else
  139. ; ES:DI points to D386_Device_Params struc
  140. ;
  141. ; RETURN:
  142. ; AL = 1, if successful, else 0
  143. D386_Display_Char equ 51h ; display a character to the debugging terminal
  144. ; AL = char to display
  145. D386_Display_Str equ 52h ; display a string to the debugging terminal
  146. ; ES:SI points to NUL terminated string
  147. D386_IsVxDInstalled equ 53h ; returns if debug VxD has been installed
  148. ; AL == 0 if not install, AL != 0 if installed
  149. D386_VxDInstall equ 54h ; sets that the debug VxD installed/uninstalled
  150. ; BL == 0 if uninstall, BL != 0 if installed
  151. D386_RegisterDotCmd equ 55h ; registers dot command
  152. ; BL = command letter
  153. ; CX:SI = address of dot command routine
  154. ; DX:DI = address of help text
  155. ; returns AX == 0, no errors
  156. ; AX != 0, dot command already used
  157. ; or out of dot commands
  158. ; Dot command routine:
  159. ; AL = command character
  160. ; DS:SI = linear address of command line
  161. ; terminated by a NULL or ";".
  162. ; DS,ES = debugger's data selector
  163. ; returns AX == 0, no errors
  164. ; AX !=0, command line or option error
  165. D386_DeRegisterDotCmd equ 56h ; de-registers dot command
  166. ; BL = command letter
  167. D386_Printf equ 57h ; Printf
  168. ; (DS:SI) = address of format string
  169. ; (ES:DI) = address of the start of parameters
  170. ; set DS_Printf for format char information
  171. D386_Link_Sym_Phys equ 58h ; link symbol file with physical address
  172. ; (DX:CX) = physical address of one extra
  173. ; paragraph front of map file image.
  174. ; (SI) = XMS handle (0 if just physical)
  175. ; (BX) = load id
  176. D386_CheckMap equ 59h ; DX:DI = pointer to module name
  177. ; returns AX != 0, map found
  178. ; AX == 0, map not found
  179. D386_SetAutoLoadSym equ 5ah ; (BL) != 0, auto load symbols
  180. ; (BL) == 0, don't auto load symbols
  181. D386_SetTeftiPort equ 5bh ; (BX) = TEFTI port address
  182. D386_ExecDebugCommand equ 5ch ; execute debugger command script
  183. ; (DS:SI) = ptr to debugger command script str
  184. ; (CX) = size of script
  185. D386_LoadCodeDataHigh equ 5dh ; makes the debugger copy its code/data high
  186. ; (DX:BX) = physical address to put debugger
  187. D386_SetWinVersion equ 5eh ; sets Windows version number
  188. ; (DI) = Version number (default if this
  189. ; api not called is 0300h).
  190. D386_MAX equ 5eh ; maximum INT 68 function code
  191. ; D386_Load_Segment type equates:
  192. ST_code_sel equ 0 ; code selector
  193. ST_data_sel equ 1 ; data selector
  194. ST_code_seg equ 10h ; code segment
  195. ST_data_seg equ 11h ; data segment
  196. ST_dual_code equ 40h ; code segment and selector
  197. ST_dual_data equ 41h ; data segment and selector
  198. ST_device_code equ 80h ; device driver code segment
  199. ST_device_data equ 81h ; device driver data segment
  200. ; D386_Load_Segment device load parameters structure
  201. D386_Device_Params STRUC
  202. DD_logical_seg dw ? ; logical segment # from map
  203. DD_actual_sel dw ? ; actual selector value
  204. DD_base dd ? ; linear address offset for start of segment
  205. DD_length dd ? ; actual length of segment
  206. DD_name df ? ; 16:32 ptr to null terminated device name
  207. DD_sym_name df ? ; 16:32 ptr to null terminated symbolic
  208. ; module name (i.e. Win386)
  209. DD_alias_sel dw ? ; alias selector value (0 = none)
  210. D386_Device_Params ENDS
  211. ;
  212. ; VCPI information, passed to debugger when client is DOS Extender
  213. ; running as a VCPI client. This information is used to get into
  214. ; and out of protected mode when running under a VCPI server.
  215. ;
  216. ;
  217. ; This structure is also used by the DOS Extender.
  218. ;
  219. WdebVCPIInfo STRUC
  220. ;
  221. ; Enter protected mode information.
  222. ;
  223. fnVCPI df ? ; VCPI protect mode server entry point
  224. rdsVCPI dw ? ; Selector for VCPI server
  225. ;
  226. ; Enter v86 mode information.
  227. ;
  228. laVTP dd ? ; linear address of data structure containing
  229. ; values for system registers.
  230. Port67 dw ? ; Qualitas magic port for emulating INT 67h
  231. WdebVCPIInfo ENDS
  232. ;
  233. ; The following structure contains the system register contents for the
  234. ; VCPI server to use when switching to protected mode. It is taken
  235. ; from dxvcpi.inc in the DOSX project, and is part of the VCPI spec.
  236. ;
  237. VTP struc
  238. zaCr3VTP dd 0 ; physical addr of page directory
  239. laGdtrVTP dd 0 ; linear addr in first meg of gdtr
  240. laIdtrVTP dd 0 ; linear addr in first meg of idtr
  241. selLdtVTP dw 0 ; selector of ldt
  242. selTrVTP dw 0 ; selector of tr
  243. ipVTP dw 0 ; 48-bit address of protect
  244. unusedVTP dw 0 ; mode entry point to xfer to
  245. csVTP dw 0 ;
  246. VTP ends
  247. VCPI_RM_CALLOUT_INT equ 67h ; v86 mode call to VCPI server
  248. ;
  249. ; Send this value in AX to the VCPI server to request V86 to protected
  250. ; mode switch or protected to V86 mode switch.
  251. ;
  252. VCPI_PROT_ENTRY equ 0DE0CH
  253. ;******************************************************************************
  254. ;
  255. ; Protected mode Debugger services:
  256. ;
  257. ;
  258. Debug_Serv_Int equ 41h ; Interrupt that calls Deb386 to perform
  259. ; debugging I/O, AX selects the function as
  260. ; described by the following equates
  261. DS_Out_Char equ 0 ; function to display the char in DL
  262. DS_In_Char equ 1 ; function to read a char into AL
  263. DS_Out_Str equ 2 ; function to display a NUL terminated string
  264. ; pointed to by DS:ESI
  265. DS_Is_Char equ 3 ; Non blocking In_Chr
  266. DS_DebLoaded equ 4Fh ; check to see if the debugger is installed and
  267. ; knows how to deal with protected mode programs
  268. ; return AX = F386h, if true
  269. DS_DebPresent equ 0F386h
  270. DS_Out_Str16 equ 12h ; function to display a NUL terminated string
  271. ; pointed to by DS:SI
  272. ; (same as function 2, but for 16 bit callers)
  273. DS_ForcedGO16 equ 40h ; enter the debugger and perform the equivalent
  274. ; of a GO command to force a stop at the
  275. ; specified CS:IP
  276. ; CX is the desired CS
  277. ; BX is the desired IP
  278. DS_LinkMap equ 45h ; DX:(E)DI = ptr to paragraph in front of map
  279. DS_UnlinkMap equ 46h ; DX:(E)DI = ptr to paragraph in front of map
  280. DS_CheckMap equ 47h ; DX:(E)DI = pointer to module name
  281. ; returns AX != 0, map found
  282. ; AX == 0, map not found
  283. DS_IsAutoLoadSym equ 48h ; returns AX != 0, auto load symbols
  284. ; AX == 0, don't auto load symbols
  285. DS_LoadSeg equ 50h ; define a segment value for the
  286. ; debugger's symbol handling
  287. ; SI type 0 - code selector
  288. ; 1 - data selector
  289. ; 80h - code segment
  290. ; 81h - data segment
  291. ; BX segment #
  292. ; CX actual segment/selector
  293. ; DX data instance
  294. ; ES:(E)DI pointer to module name
  295. DS_LoadSeg_32 equ 0150h ; Define a 32-bit segment for Windows 32
  296. ; SI type 0 - code selector
  297. ; 1 - data selector
  298. ; DX:EBX points to a D386_Device_Params STRUC
  299. ; with all the necessaries in it
  300. DS_MoveSeg equ 51h ; notify the debugger that a segment has moved
  301. ; BX old segment value
  302. ; CX new segment value
  303. DS_FreeSeg equ 52h ; notify the debugger that a segment has been
  304. ; freed
  305. ; BX segment value
  306. DS_FreeSeg_32 equ 0152h ; notify the debugger that a segment has been
  307. ; freed
  308. ; BX segment number
  309. ; DX:EDI pointer to module name
  310. DS_DGH equ 56h ; register "dump global heap" handler
  311. ; BX is code offset
  312. ; CX is code segment
  313. DS_DFL equ 57h ; register "dump free list" handler
  314. ; BX is code offset
  315. ; CX is code segment
  316. DS_DLL equ 58h ; register "dump LRU list" handler
  317. ; BX is code offset
  318. ; CX is code segment
  319. DS_StartTask equ 59h ; notify debugger that a new task is starting
  320. ; BX is task handle
  321. ; task's initial registers are stored on the
  322. ; stack:
  323. ; push cs
  324. ; push ip
  325. ; pusha
  326. ; push ds
  327. ; push es
  328. ; push ss
  329. ; push sp
  330. DS_Kernel_Vars equ 5ah ; Used by the Windows kernel to tell the
  331. ; debugger the location of kernel variables
  332. ; used in the heap dump commands.
  333. ; BX = version number of this data (03a0h)
  334. ; DX:CX points to:
  335. ; WORD hGlobalHeap ****
  336. ; WORD pGlobalHeap ****
  337. ; WORD hExeHead ****
  338. ; WORD hExeSweep
  339. ; WORD topPDB
  340. ; WORD headPDB
  341. ; WORD topsizePDB
  342. ; WORD headTDB ****
  343. ; WORD curTDB ****
  344. ; WORD loadTDB
  345. ; WORD LockTDB
  346. ; WORD SelTableLen ****
  347. ; DWORD SelTableStart ****
  348. ;
  349. ; The starred fields are used by the
  350. ; heap dump commands which are internal
  351. ; to WDEB386.
  352. DS_VCPI_Notify equ 5bh ; notify debugger that DOS extender is
  353. ; running under a VCPI implementation,
  354. ; and register VCPI protect mode interface
  355. ; ES:DI points to a data structure used to
  356. ; get from V86 mode to Pmode under VCPI.
  357. ; This is defined in the VCPI version
  358. ; 1.0 spec.
  359. DS_ReleaseSeg equ 5ch ; This does the same as a DS_FreeSeg, but
  360. ; it restores any breakpoints first.
  361. DS_POSTLOAD = 60h ; Used by the RegisterPTrace interface
  362. DS_EXITCALL = 62h ; Somebody will fill these in if we ever
  363. DS_INT2 = 63h ; figure out what they are supposed to do.
  364. DS_LOADDLL = 64h
  365. DS_DELMODULE = 65h
  366. DS_NEWTASK = 0BH
  367. DS_FLUSHTASK = 0CH
  368. DS_SWITCHOUT = 0DH
  369. DS_SWITCHIN = 0EH
  370. DS_IntRings equ 20h ; function to tell debugger which INT 1's & 3's
  371. ; to grab
  372. ; BX = 0, grab only ring 0 ints
  373. ; BX != 0, grab all ints
  374. DS_IncludeSegs equ 21h ; function to tell debugger to go ahead and
  375. ; process INT 1's & 3's which occur in this
  376. ; DX:DI points to list of selectors
  377. ; (1 word per entry)
  378. ; CX = # of selectors (maximum of 20)
  379. ; CX = 0, to remove the list of segs
  380. MaxDebugSegs = 20
  381. DS_CondBP equ 0F001h ; conditional break pt, if the command line
  382. ; switch /B is given when the debugger is run
  383. ; or the conditional flag is later set, then
  384. ; this int should cause the program to break
  385. ; into the debugger, else this int should be
  386. ; ignored!
  387. ; ESI points to a nul terminated string to
  388. ; display if break is to happen.
  389. DS_ForcedBP equ 0F002h ; break pt, which accomplishes the same thing
  390. ; as an INT 1 or an INT 3, but is a break point
  391. ; that should be permanently left in the code,
  392. ; so that a random search of source code would
  393. ; not result in the accidental removal of this
  394. ; necessary break_pt
  395. DS_ForcedGO equ 0F003h ; enter the debugger and perform the equivalent
  396. ; of a GO command to force a stop at the
  397. ; specified CS:EIP
  398. ; CX is the desired CS
  399. ; EBX is the desired EIP
  400. DS_HardINT1 equ 0F004h ; check to see if INT 1 hooked for all rings
  401. ; ENTER: nothing
  402. ; EXIT: AX = 0, if no, 1, if yes
  403. DS_FatalFault equ 0F005h ; check if fault is hooked by debugger via VSF
  404. ; ENTRY BX = trap number
  405. ; DX = error code
  406. ; CX:(E)SI = address of CS:(E)IP
  407. ; EXIT: AL == 0, handle fault normally
  408. ; AL != 0, handled by debugger
  409. DS_Out_Symbol equ 0Fh ; find the symbol nearest to the address in
  410. ; CX:EBX and display the result in the format
  411. ; symbol name <+offset>
  412. ; the offset is only included if needed, and
  413. ; no CR&LF is displayed
  414. DS_Disasm_Ins equ 10h ; function to disassemble the instruction
  415. ; pointed to by DS:ESI
  416. DS_RegisterDotCommand equ 70h ; registers a 32 bit dot command handler
  417. ; This interface is used to register wdeb386 dot commands by FLAT 32
  418. ; bit code. The following conditions apply:
  419. ;
  420. ; * The code will be run at ring 0
  421. ; * Interrupts may not be enabled
  422. ; * Must not access any not present pages or load invalid selectors
  423. ; * Must stay on the stack called with when calling INT 41 services
  424. ; * Must not change DS or ES from the FLAT selector
  425. ;
  426. ; The help text is printed when .? is executed in the order of
  427. ; registration. The text must include CR/LF at the end; nothing
  428. ; is added to the help text.
  429. ;
  430. ; ENTRY: (AX) = 0070h
  431. ; (BL) = dot command to register
  432. ; (ESI) = linear address of dot command routine
  433. ; Dot command routine:
  434. ; ENTRY: (AL) = command character
  435. ; (DS, ES) = flat data selector
  436. ;
  437. ; EXIT: (AX) == 0, no errors
  438. ; (AX) !=0, command line or option error
  439. ;
  440. ; NOTE: MUST return with a 32 bit FAR return (retfd)
  441. ; (EDI) = linear address of help text
  442. ;
  443. ; EXIT: (AX) == 0, no errors
  444. ; (AX) != 0, dot command already used or out of dot commands
  445. DS_RegisterDotCommand16 equ 71h ; registers a 16 bit dot command handler
  446. ; This interface is used to register wdeb386 dot commands by 16 bit
  447. ; code. The following conditions apply:
  448. ;
  449. ; * The code will be run at ring 0 or in real mode
  450. ; * Interrupts may not be enabled
  451. ; * Must not access any not present pages or load invalid selectors
  452. ; * Must stay on the stack called with when calling INT 41 services
  453. ;
  454. ; The help text is printed when .? is executed in the order of
  455. ; registration. The text must include CR/LF at the end; nothing
  456. ; is added to the help text.
  457. ;
  458. ; ENTRY: (AX) = 0071h
  459. ; (BL) = dot command to register
  460. ; (CX:SI) = address of dot command routine
  461. ; Dot command routine:
  462. ; ENTRY: (AL) = command character
  463. ; (DS, ES) = debugger's data selector
  464. ;
  465. ; EXIT: (AX) == 0, no errors
  466. ; (AX) != 0, command line or option error
  467. ;
  468. ; NOTE: MUST return with a 16 bit FAR return (retf)
  469. ; (DX:DI) = address of help text
  470. ;
  471. ; EXIT: (AX) == 0, no errors
  472. ; (AX) != 0, dot command already used or out of dot commands
  473. DS_DeRegisterDotCommand equ 72h ; de-registers 16 or 32 bit dot command
  474. ; This interface is used to de-register wdeb386 dot commands registered
  475. ; by the above 16 or 32 bit services. Care should be used not to
  476. ; de-register dot commands that weren't registered by your code.
  477. ;
  478. ; ENTRY: (AX) = 0072h
  479. ; (BL) = dot command to de-register
  480. ;
  481. ; EXIT: NONE
  482. DS_Printf equ 73h ; print formatted output
  483. ; This function allows formatted output with the standard "C"
  484. ; printf syntax.
  485. ;
  486. ; ENTRY: (AX) = 0073h
  487. ; (DS:ESI) = address of format string
  488. ; (ES:EDI) = address of the start of the dword arguments
  489. ;
  490. ; EXIT: NONE
  491. ;
  492. ; Supported types are:
  493. ;
  494. ; %% %
  495. ; %[l][h]c character
  496. ; %[-][+][ ][0][width][.precision][l][h][p][n]d decimal
  497. ; %[-][0][width][.precision][l][h][p][n]u unsigned decimal
  498. ; %[-][#][0][width][.precision][l][h][p][n]x hex
  499. ; %[-][#][0][width][.precision][l][h][p][n]X hex
  500. ; %[-][0][width][.precision][l][h][p][n]o octal
  501. ; %[-][0][width][.precision][l][h][p][n]b binary
  502. ; %[-][width][.precision][l][h][a][F]s string
  503. ; %[-][width][.precision][l][h][a][p][n][F][L][H][N]S symbol
  504. ; %[-][width][.precision][l][h][a][p][n][F][L][H][N]G group:symbol
  505. ; %[-][width][.precision][l][h][a][p][n][F][L][H][N]M map:group:symbol
  506. ; %[-][width][.precision][l][h][a][p][n][F][L][H][N]A address
  507. ;
  508. ; Where "width" or "precision" is a decimal number or the '*'
  509. ; character; '*' causes the field width or precision to be picked
  510. ; up from the next parameter. []'ed parameters are optional.
  511. ;
  512. ; "\r", "\t", "\n", "\a", "\b", are supported directly.
  513. ;
  514. ; Prefixes
  515. ; --------
  516. ;
  517. ; Used with c,d,u,x,X,o,b:
  518. ;
  519. ; Parameter Argument Size
  520. ; -----------------------
  521. ; word h
  522. ; dword l
  523. ;
  524. ; Used with s,S,G,M,A:
  525. ;
  526. ; Address Argument Size
  527. ; ---------------------
  528. ; 16 bit DS relative h
  529. ; 16:16 segment:offset hF or Fh
  530. ; 32 bit flat relative l
  531. ; 16:32 segment:offset (2 dwords) lF or Fl
  532. ; pointer to AddrS structure a
  533. ;
  534. ; Used with S,G,M,A:
  535. ;
  536. ; Address Display Size or Format
  537. ; ------------------------------
  538. ; 16 bit offset H
  539. ; 32 bit offset L
  540. ; offset only N
  541. ;
  542. ; Default display size depends on the "386env" flag setting.
  543. ;
  544. ; Used with S,G,M:
  545. ;
  546. ; gets the previous symbol p
  547. ; gets the next symbol n
  548. ;
  549. ; Used with A:
  550. ;
  551. ; gets the previous symbol address p
  552. ; gets the next symbol address n
  553. ;
  554. ; Used with d,u,x,X,o,b:
  555. ;
  556. ; gets the previous symbol offset p
  557. ; gets the next symbol offset n
  558. ;
  559. DS_Printf16 equ 74h ; print formatted 16 bit output
  560. ; This function allows formatted output with the standard "C"
  561. ; printf syntax.
  562. ;
  563. ; ENTRY: (AX) = 0074h
  564. ; (DS:SI) = address of format string
  565. ; (ES:DI) = address of the start of the word or dword arguments
  566. ;
  567. ; EXIT: NONE
  568. ;
  569. ; The format options and parameters are the same as DS_Printf except
  570. ; the default parameter size is a word (the h option is implicit).
  571. ;
  572. DS_GetRegisterSet equ 75h ; get the debugger's registers
  573. ; This function copies the current register set.
  574. ;
  575. ; ENTRY: (AX) = 0075h
  576. ; (DS:ESI) = address of SaveRegs_Struc structure
  577. ;
  578. ; EXIT: NONE
  579. ;
  580. DS_SetAlternateRegisterSet equ 76h ; set the debugger's registers
  581. ; This function temporary sets the debugger's registers to values
  582. ; passed in the structure. If an "r" command is executed or the
  583. ; debugged code is returned to (via the "g", "t" or "p" commands),
  584. ; the register set reverts to the debugged code's registers.
  585. ;
  586. ; ENTRY: (AX) = 0076h
  587. ; (CX) = thread ID, 0 use current thread ID
  588. ; (DS:ESI) = address of SaveRegs_Struc structure
  589. ;
  590. ; EXIT: NONE
  591. ;
  592. DS_GetCommandLineChar equ 77h ; get a character from the command line
  593. ; This services gets the next character off the command line.
  594. ;
  595. ; ENTRY: (AX) = 0077h
  596. ; (BL) == 0 just peek the character, don't increment text pointer
  597. ; leading white space isn't ignored
  598. ; (BL) != 0 get the character, increment text pointer
  599. ; leading white space is skipped
  600. ;
  601. ; EXIT: (AL) = command line character
  602. ; (AH) == 0 if no more characters (EOL)
  603. ; (AH) != 0 if more characters
  604. ;
  605. DS_EvaluateExpression equ 78h ; evaluate debugger command line expression
  606. ; Expressions can be numbers of various radices, symbols, addresses
  607. ; or an combination of the above hooked together with various
  608. ; operators. Expressions are separated by blanks or commas. This
  609. ; function is passed a pointer to the beginning of the text of the
  610. ; expression (i.e. "%80003444+4232"). The expression is either
  611. ; evaluated down into a dword value if there are no addresses or
  612. ; into a linear address.
  613. ;
  614. ; ENTRY: (AX) = 0078h
  615. ;
  616. ; EXIT: (AX) == 0, returning a data value
  617. ; (AX) != 0, returning a linear address
  618. ; (EBX) = return value
  619. ;
  620. ; NOTE: If the expression is invalid, this service will not
  621. ; return. A message is printed and control returns to
  622. ; the command loop.
  623. ;
  624. DS_VerifyMemory equ 79h ; verify the memory is valid and present
  625. ; ENTRY: (AX) = 0079h
  626. ; (ECX) = length of memory region
  627. ; (DS:ESI) = address of memory to verify
  628. ;
  629. ; EXIT: (AX) == 0, no errors
  630. ; (AX) != 0, invalid memory
  631. DS_PrintRegisters equ 7ah ; print the register set (the "r" command)
  632. ; This function prints (just like the "r" command) the either the
  633. ; debugged code's registers or the alternate register set, set with
  634. ; DS_SetAlternateRegisterSet function.
  635. ;
  636. ; ENTRY: (AX) = 007ah
  637. ;
  638. ; EXIT: NONE
  639. ;
  640. ; NOTE: If the CS:EIP is invalid, this service will not return
  641. ; because of an error when the code is disassembled. A
  642. ; message is printed and control returns to the command loop.
  643. ;
  644. DS_PrintStackDump equ 7bh ; dumps the [E]BP stack chain (the "k" command)
  645. ; This function prints (just like the "k" command) the stack dump
  646. ; based on the current register set that may have been set with
  647. ; DS_SetAlternateRegisterSet function.
  648. ;
  649. ; ENTRY: (AX) = 007bh
  650. ; (BX) = flags
  651. ; 01h - verbose stack dump
  652. ; 02h - 16 bit stack dump
  653. ; 04h - 32 bit stack dump
  654. ;
  655. ; EXIT: NONE
  656. ;
  657. ; NOTE: If the CS:EIP or SS:EBP are invalid, this service will not
  658. ; return because of an error when accessing the stack. A
  659. ; message is printed and control returns to the command loop.
  660. ;
  661. DS_SetThreadID equ 7ch ; sets the debugger's thread ID
  662. ; This function sets what the debugger thinks the thread ID is
  663. ; for memory address in other address contexts. It stays set
  664. ; until the debugged code is returned to (via "g", "t" or "p")
  665. ; or set back to 0.
  666. ;
  667. ; ENTRY: (AX) = 007ch
  668. ; (CX) = thread ID or 0 for currently executed thread
  669. ;
  670. ; EXIT: NONE
  671. DS_ExecDebugCommand equ 7dh ; execute debugger command script
  672. ; This service allows any debugger command to be executed. In can
  673. ; be a multi-lined script with the lines separated by CR, LF. MUST
  674. ; have a "g" command at the end of script so the debugger doesn't
  675. ; stop while in the INT 41.
  676. ;
  677. ; ENTRY: (AX) = 007dh
  678. ; (DS:ESI) = pointer to debugger command script string
  679. ; (CX) = size of script
  680. ;
  681. ; EXIT: NONE
  682. ;
  683. ; Interupt and services that Win386 provides to the debugger
  684. ;
  685. Win386_Query_Int equ 22h ; interrupt for Win386 protected mode
  686. ; interface requests
  687. Win386_Alive equ 0 ; function 0, query Win386 installation
  688. Win386_Q_Ack equ 0F386h ; good response from func 43h, of
  689. ; INT 68h & func 4fh of INT 41h
  690. Win386_Query equ 1 ; function 1, query Win386 state
  691. ; ds:esi points to command string
  692. ; that Win386 needs to process
  693. ; ds:edi points to the SaveRegs_Struc
  694. ; that the debugger has stored all the
  695. ; client register state into.
  696. ; (Win386 just writes the query
  697. ; answers directly to the output
  698. ; device, so no response is
  699. ; returned)
  700. Win386_PhysToLinr equ 2 ; function 2, have Win386 convert a
  701. ; physical address into a valid
  702. ; linear address that Deb386 can
  703. ; use. esi is physicaladdress
  704. ; cx is # of bytes required
  705. ; returns esi as linear address
  706. ; returns ax = 1, if okay, else
  707. ; 0, if request couldn't be
  708. ; completed
  709. Win386_AddrValid equ 3 ; function 3, have Win386 check the
  710. ; validity of a linear address
  711. ; esi is linear address to check
  712. ; cx is # of bytes required
  713. ; returns ax = 1, if address okay
  714. ; else ax = 0
  715. Win386_MapVM equ 4 ; function 4, make sure that the VM's
  716. ; low memory is mapped in, in case
  717. ; it is touched (a count is maintained)
  718. Win386_UnmapVM equ 5 ; function 5, map out the VM's low
  719. ; memory (dec the count)
  720. Win386_GetDLAddr equ 6 ; function 6, return offset of dyna-link
  721. ; service. EBX = Device ID << 10h +
  722. ; Service #. Returns EAX = Offset.
  723. Max_Win386_Services equ 6
  724. SaveRegs_Struc STRUC
  725. Debug_EAX dd ?
  726. Debug_EBX dd ?
  727. Debug_ECX dd ?
  728. Debug_EDX dd ?
  729. Debug_ESP dd ?
  730. Debug_EBP dd ?
  731. Debug_ESI dd ?
  732. Debug_EDI dd ?
  733. Debug_ES dw ?
  734. Debug_SS dw ?
  735. Debug_DS dw ?
  736. Debug_FS dw ?
  737. Debug_GS dw ?
  738. Debug_EIP dd ?
  739. Debug_CS dw ?
  740. dd ?
  741. Debug_EFlags dd ?
  742. Debug_CR0 dd ?
  743. Debug_GDT dq ?
  744. Debug_IDT dq ?
  745. Debug_LDT dw ?
  746. Debug_TR dw ?
  747. Debug_CR2 dd ?
  748. Debug_CR3 dd ?
  749. Debug_DR0 dd ?
  750. Debug_DR1 dd ?
  751. Debug_DR2 dd ?
  752. Debug_DR3 dd ?
  753. Debug_DR6 dd ?
  754. Debug_DR7 dd ?
  755. Debug_DR7_2 dd ?
  756. Debug_TR6 dd ?
  757. Debug_TR7 dd ?
  758. Debug_TrapNumber dw -1 ; -1 means no trap number
  759. Debug_ErrorCode dw 0 ; 0 means no error code
  760. SaveRegs_Struc ENDS