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.

234 lines
6.4 KiB

  1. /*
  2. * demdisp.c - SVC dispatch module
  3. *
  4. * Modification History:
  5. *
  6. * Sudeepb 31-Mar-1991 Created
  7. */
  8. #include "dem.h"
  9. #include <stdio.h>
  10. #include <softpc.h>
  11. #include <dbgsvc.h>
  12. #if DBG
  13. PCHAR aSVCNames[] = {
  14. "demChgFilePtr",
  15. "demChMod",
  16. "demClose",
  17. "demCreate",
  18. "demCreateDir",
  19. "demDelete",
  20. "demDeleteDir",
  21. "demDeleteFCB",
  22. "demFileTimes",
  23. "demFindFirst",
  24. "demFindFirstFCB",
  25. "demFindNext",
  26. "demFindNextFCB",
  27. "demGetBootDrive",
  28. "demGetDriveFreeSpace",
  29. "demGetDrives",
  30. "demGSetMediaID",
  31. "demLoadDos",
  32. "demOpen",
  33. "demQueryCurrentDir",
  34. "demQueryDate",
  35. "demQueryTime",
  36. "demRead",
  37. "demRename",
  38. "demSetCurrentDir",
  39. "demSetDate",
  40. "demSetDefaultDrive",
  41. "demSetDTALocation",
  42. "demSetTime",
  43. "demSetV86KernelAddr",
  44. "demWrite",
  45. "demGetDriveInfo",
  46. "demRenameFCB",
  47. "demIOCTL",
  48. "demCreateNew",
  49. "DemDiskReset",
  50. "DemSetDPB",
  51. "DemGetDPB",
  52. "DemSleazeFunc",
  53. "demCommit",
  54. "DemExtHandle",
  55. "DemAbsDRD",
  56. "DemAbsDWRT",
  57. "DemGsetCDPG",
  58. "DemCreateFCB",
  59. "DemOpenFCB",
  60. "DemCloseFCB",
  61. "DemFCBIO",
  62. "DemDate16",
  63. "DemGetFileInfo",
  64. "DemSetHardErrorInfo",
  65. "DemRetry",
  66. "DemLoadDosAppSym",
  67. "DemFreeDosAppSym",
  68. "DemEntryDosApp",
  69. "DemDOSDispCall",
  70. "DemDOSDispRet",
  71. "DemOutputString",
  72. "DemInputString",
  73. "DemIsDebug",
  74. "DemTerminatePDB",
  75. "DemExitVDM",
  76. "DemWOWFiles",
  77. "DemLockOper",
  78. "demNotYetImplemented",
  79. "DemGetComputerName",
  80. "DemFastRead",
  81. "DemFastWrite",
  82. "DemCheckPath",
  83. "DemSystemSymbolOp",
  84. "DemGetDpbList",
  85. "DemPipeFileDataEOF",
  86. "DemPipeFileEOF",
  87. "DemLFNEntry",
  88. "DemSetDosVarLocation"
  89. };
  90. #endif // DBG
  91. DWORD fShowSVCMsg = 0;
  92. ULONG CurrentISVC;
  93. PFNSVC apfnSVC [] = {
  94. demChgFilePtr, //SVC_DEMCHGFILEPTR
  95. demChMod, //SVC_DEMCHMOD
  96. demClose, //SVC_DEMCLOSE
  97. demCreate, //SVC_DEMCREATE
  98. demCreateDir, //SVC_DEMCREATEDIR
  99. demDelete, //SVC_DEMDELETE
  100. demDeleteDir, //SVC_DEMDELETEDIR
  101. demDeleteFCB, //SVC_DEMDELETEFCB
  102. demFileTimes, //SVC_DEMFILETIMES
  103. demFindFirst, //SVC_DEMFINDFIRST
  104. demFindFirstFCB, //SVC_DEMFINDFIRSTFCB
  105. demFindNext, //SVC_DEMFINDNEXT
  106. demFindNextFCB, //SVC_DEMFINDNEXTFCB
  107. demGetBootDrive, //SVC_DEMGETBOOTDRIVE
  108. demGetDriveFreeSpace, //SVC_DEMGETDRIVEFREESPACE
  109. demGetDrives, //SVC_DEMGETDRIVES
  110. demGSetMediaID, //SVC_DEMGSETMEDIAID
  111. demLoadDos, //SVC_DEMLOADDOS
  112. demOpen, //SVC_DEMOPEN
  113. demQueryCurrentDir, //SVC_DEMQUERYCURRENTDIR
  114. demQueryDate, //SVC_DEMQUERYDATE
  115. demQueryTime, //SVC_DEMQUERYTIME
  116. demRead, //SVC_DEMREAD
  117. demRename, //SVC_DEMRENAME
  118. demSetCurrentDir, //SVC_DEMSETCURRENTDIR
  119. demSetDate, //SVC_DEMSETDATE
  120. demSetDefaultDrive, //SVC_DEMSETDEFAULTDRIVE
  121. demSetDTALocation, //SVC_DEMSETDTALOCATION
  122. demSetTime, //SVC_DEMSETTIME
  123. demSetV86KernelAddr, //SVC_DEMSETV86KERNELADDR
  124. demWrite, //SVC_DEMWRITE
  125. demNotYetImplemented, //SVC_GETDRIVEINFO
  126. demRenameFCB, //SVC_DEMRENAMEFCB
  127. demIOCTL, //SVC_DEMIOCTL
  128. demCreateNew, //SVC_DEMCREATENEW
  129. demDiskReset, //SVC_DEMDISKRESET
  130. demNotYetImplemented, //SVC_DEMSETDPB
  131. demGetDPB, //SVC_DEMGETDPB
  132. demNotYetImplemented, //SVC_DEMSLEAZEFUNC
  133. demCommit, //SVC_DEMCOMMIT
  134. demNotYetImplemented, //SVC_DEMEXTHANDLE
  135. demAbsRead, //SVC_DEMABSDRD
  136. demAbsWrite, //SVC_DEMABSDWRT
  137. demNotYetImplemented, //SVC_DEMGSETCDPG
  138. demCreateFCB, //SVC_DEMCREATEFCB
  139. demOpenFCB, //SVC_DEMOPENFCB
  140. demCloseFCB, //SVC_DEMCLOSEFCB
  141. demFCBIO, //SVC_FCBIO
  142. demDate16, //SVC_DEMDATE16
  143. demGetFileInfo, //SVC_DEMGETFILEINFO
  144. demSetHardErrorInfo, //SVC_DEMSETHARDERRORINFO
  145. demRetry, //SVC_DEMRETRY
  146. demLoadDosAppSym, //SVC_DEMLOADDOSAPPSYM
  147. demFreeDosAppSym, //SVC_DEMFREEDOSAPPSYM
  148. demEntryDosApp, //SVC_DEMENTRYDOSAPP
  149. demDOSDispCall, //SVC_DEMDOSDISPCALL
  150. demDOSDispRet, //SVC_DEMDOSDISPRET
  151. demOutputString, //SVC_OUTPUT_STRING
  152. demInputString, //SVC_INPUT_STRING
  153. demIsDebug, //SVC_ISDEBUG
  154. demTerminatePDB, //SVC_PDBTERMINATE
  155. demExitVDM, //SVC_DEMEXITVDM
  156. demWOWFiles, //SVC_DEMWOWFILES
  157. demLockOper, //SVC_DEMLOCKOPER
  158. demNotYetImplemented, //SVC_DEMNOTYETIMPLEMENTED
  159. demGetComputerName, //SVC_DEMGETCOMPUTERNAME
  160. demNotYetImplemented, //SVC_DEMFASTREAD
  161. demNotYetImplemented, //SVC_DEMFASTWRITE
  162. demCheckPath, //SVC_DEMCHECKPATH
  163. demSystemSymbolOp, //SVC_DEMSYSTEMSYMBOLOP
  164. demGetDPBList, //SVC_DEMBUILDDPBLIST
  165. demPipeFileDataEOF, //SVC_DEMPIPEFILEDATAEOF
  166. demPipeFileEOF, //SVC_DEMPIPEFILEEOF
  167. demLFNEntry, //SVC_DEMLFNENTRY
  168. demSetDosVarLocation //SVC_SETDOSVARLOCATION
  169. };
  170. /* DemDispatch - Dispatch SVC call to right handler.
  171. *
  172. * Entry - iSvc (SVC byte following SVCop)
  173. *
  174. * Exit - None
  175. *
  176. * Note - Some mechanism has to be worked out to let the emulator know
  177. * about DOSKRNL code segment and size. Using these it will figure
  178. * out whether SVCop (hlt for the moment) has to be passed to
  179. * DEM or to be handled as normal invalid opcode.
  180. */
  181. BOOL DemDispatch (ULONG iSvc)
  182. {
  183. DBGTRACE(VDMTR_TYPE_DEM + DEM_EVENT_DISPATCH, 0, iSvc);
  184. if (iSvc >= SVC_DEMLASTSVC){
  185. #if DBG
  186. sprintf(demDebugBuffer,"Unimplemented SVC index %x\n",iSvc);
  187. OutputDebugStringOem(demDebugBuffer);
  188. #endif
  189. setCF(1);
  190. return FALSE;
  191. }
  192. if (pHardErrPacket) {
  193. pHardErrPacket->vhe_fbInt24 = 0;
  194. }
  195. CurrentISVC = iSvc;
  196. (apfnSVC [iSvc])();
  197. DBGTRACE(VDMTR_TYPE_DEM + DEM_EVENT_DISPATCH_EXIT, 0, iSvc);
  198. return TRUE;
  199. }
  200. VOID demNotYetImplemented (VOID)
  201. {
  202. if (fShowSVCMsg) {
  203. sprintf(demDebugBuffer,"Unimplemented SVC %d\n",CurrentISVC);
  204. OutputDebugStringOem(demDebugBuffer);
  205. }
  206. setCF(0);
  207. return;
  208. }
  209. VOID demSetV86KernelAddr (VOID)
  210. {
  211. // Here debugger callout has to be made for DOSKRNL symbols
  212. return;
  213. }
  214.