home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / MVDM.H < prev    next >
C/C++ Source or Header  |  1997-04-10  |  8KB  |  339 lines

  1. /***************************************************************************
  2. *
  3. * Module Name: mvdm.h
  4. *
  5. * OS/2 public header file.
  6. *
  7. * Copyright (c) 1993  IBM Corporation
  8. *
  9. *      MVDM constants and types
  10. *
  11. *      Include file hierarchy:
  12. *
  13. *        mvdm.h
  14. *          basemac.h
  15. *          basedef.h
  16. *          vdmprop.h
  17. *          vdmm.h
  18. *          v8086.h
  19. *          vdos.h
  20. *          vpic.h
  21. *          vdmbios.h
  22. *          vkbd.h
  23. *          vlpt.h
  24. *          vdma.h
  25. *
  26. *      By default, ALL portions of ALL include files are included (ie,
  27. *      INCL_ALL is assumed).
  28. *
  29. *      To control what is included, use INCL_NONE and then select from
  30. *      the following:
  31. *
  32. *          INCL_DEF
  33. *          INCL_MI
  34. *          INCL_TYPES
  35. *          INCL_MVDMTYPES
  36. *          INCL_SSTODS
  37. *          INCL_ROMBIOS
  38. *          INCL_PAGE
  39. *          INCL_VDH
  40. *          INCL_VDHVPIC
  41. *          INCL_VDHALL
  42. *          INCL_VDDHELPERS
  43. *          INCL_VDHVKBD
  44. *          INCL_VDHVLPT
  45. *          INCL_VDHVDMA
  46. *
  47. *
  48. */
  49.  
  50. #pragma checkout( suspend )
  51.    #ifndef __CHKHDR__
  52.       #pragma checkout( suspend )
  53.    #endif
  54. #pragma checkout( resume )
  55.  
  56. #ifndef __MVDM__
  57. #define __MVDM__
  58.  
  59. #ifndef INCL_NONE
  60. #define INCL_DEF
  61. #define INCL_TYPES
  62. #define INCL_MVDMTYPES
  63. #define INCL_SSTODS
  64. #define INCL_ROMBIOS
  65. #define INCL_PAGE
  66. #define INCL_VDHALL
  67. #define INCL_VDDHELPERS
  68. #define INCL_VDHVKBD
  69. #define INCL_VDHVLPT
  70. #define INCL_VDHVDMA
  71. #endif
  72.  
  73. #ifdef  INCL_VDHALL             // if all VDH services, set defines
  74. #define INCL_VDH
  75. #define INCL_VDHVPIC
  76. #define INCL_VDHVKBD
  77. #define INCL_VDHVLPT
  78. #define INCL_VDHVDMA
  79. #endif
  80.  
  81. #ifdef  INCL_VDH                // VDH services require MVDM types
  82. #define INCL_MVDMTYPES
  83. #endif
  84.  
  85. #ifdef  INCL_VDHVPIC            // VDH services require MVDM types
  86. #define INCL_MVDMTYPES
  87. #endif
  88.  
  89. #ifdef  INCL_VDHVKBD            // VDH services require MVDM types
  90. #define INCL_MVDMTYPES
  91. #endif
  92.  
  93. #ifdef  INCL_VDHVLPT            // VDH services require MVDM types
  94. #define INCL_MVDMTYPES
  95. #endif
  96.  
  97. #ifdef  INCL_VDHVDMA            // VDH services require MVDM types
  98. #define INCL_MVDMTYPES
  99. #endif
  100.  
  101. #ifdef  INCL_MVDMTYPES          // MVDM types depend on basic types
  102. #define INCL_TYPES
  103. #endif
  104.  
  105. #ifdef  INCL_TYPES              // types depend on basemaca.inc macros
  106. #define INCL_DEF
  107. #endif
  108.  
  109.  
  110. /*** Required generic include files
  111.  */
  112.  
  113.  
  114. #include <basemac.h>            // macros for C
  115.  
  116.  
  117. #include <basedef.h>            // basic OS/2 data types
  118.  
  119.  
  120.  
  121. /*** MVDM-specific equates (required for function prototypes)
  122.  */
  123. #define VDHENTRY PASCAL NEAR    // to declare exported VDH services
  124. #define HOOKENTRY PASCAL NEAR   // to declare "hook" entry points
  125.  
  126. #define PDDENTRY FAR32 PASCAL   // to declare PDD and VDD entry points
  127. #define VDDENTRY FAR32 PASCAL
  128.  
  129.  
  130.  
  131. /*** MVDM-specific macros
  132.  */
  133.  
  134. //c-begin
  135. #define BEGIN_GLOBAL_CODE       code_seg()
  136. #define END_GLOBAL_CODE         code_seg()
  137.  
  138. #define BEGIN_GLOBAL_DATA       data_seg()
  139. #define END_GLOBAL_DATA         data_seg()
  140.  
  141. #define BEGIN_INIT_CODE         code_seg("CINIT_TEXT", "CODE")
  142. #define END_INIT_CODE           code_seg()
  143.  
  144. #define BEGIN_INIT_DATA         data_seg("CINIT_DATA", "CINITDATA")
  145. #define END_INIT_DATA           data_seg()
  146.  
  147. #define BEGIN_INSTANCE_DATA     data_seg("MVDMINSTDATA", "MIDATA")
  148. #define END_INSTANCE_DATA       data_seg()
  149.  
  150. #define BEGIN_SWAP_CODE         code_seg("CSWAP_TEXT","CODE")
  151. #define END_SWAP_CODE           code_seg()
  152.  
  153. #define BEGIN_SWAP_DATA         data_seg("CSWAP_DATA","CSWAPDATA")
  154. #define END_SWAP_DATA           data_seg()
  155.  
  156. #define BEGIN_SWAP_INSTANCE     data_seg("SWAPINSTDATA","SIDATA")
  157. #define END_SWAP_INSTANCE       data_seg()
  158. //c-end
  159.  
  160.  
  161. #ifdef  INCL_VDDHELPERS
  162.  
  163. ULONG PRIVENTRY vdhSaveFlags(VOID);     // prototypes for helper externals
  164. VOID  PRIVENTRY vdhRestoreFlags(ULONG);
  165. VOID  PRIVENTRY vdhInt3(VOID);
  166. ULONG PRIVENTRY vdhXCHG(PULONG, ULONG);
  167. ULONG PRIVENTRY vdhBTC(PULONG, ULONG);
  168. ULONG PRIVENTRY vdhBTR(PULONG, ULONG);
  169. ULONG PRIVENTRY vdhBTS(PULONG, ULONG);
  170. ULONG PRIVENTRY vdhBSF(ULONG);
  171. ULONG PRIVENTRY vdhBSR(ULONG);
  172. VOID  PRIVENTRY vdhOutSB(PORT, PBYTE, ULONG, BOOL);
  173. PSZ   PRIVENTRY vdhFindToken(PSZ);
  174. INT   PRIVENTRY vdhCompareStr(PSZ, PSZ, BOOL);
  175. VOID  PRIVENTRY vdhMoveMem(PVOID, PVOID, INT, INT, UINT, BOOL);
  176.  
  177. //c-begin
  178. #ifdef FUNCS
  179. #pragma function(inp, inpw, outp, outpw)
  180. #endif
  181.  
  182. #define STRTOKEN(p)       vdhFindToken(p)
  183. #define STRCOMPARE(p,q,f) vdhCompareStr(p,q,f)
  184.  
  185. #define DISABLE()       _disable()      // _disable() intrinsic fixed now
  186. #define ENABLE()        _enable()       // _enable() intrinsic fixed now
  187. #define SAVEFLAGS()     vdhSaveFlags()  // preserve flags
  188. #define RESTOREFLAGS(f) vdhRestoreFlags(f) // restore flags
  189. #define INT3()          _interrupt(3)   // execute an INT 3
  190.  
  191. #define INB(p)          ((BYTE)inp(p))
  192. #ifndef IO8BIT
  193. #define INW(p)          inpw(p)
  194. #else
  195. #define INW(p)          ((WORD)(inp(p) + (inp((p)+1)<<8)))
  196. #endif
  197.  
  198. #define OUTB(p,b)       outp(p,b)
  199. #define OUTSB(p,pb,n,f) vdhOutSB(p,pb,n,f)
  200. #ifndef IO8BIT
  201. #define OUTW(p,w)       outpw(p,w)
  202. #else
  203. #define OUTW(p,w)       (outp(p,(BYTE)(w)), outp((p)+1,(BYTE)((w)>>8)))
  204. #endif
  205. //c-end
  206.  
  207. //DISABLE macro               ;alias for CLI (similar to C)
  208. //        cli
  209. //        endm
  210. //
  211. //ENABLE  macro               ;alias for STI (similar to C)
  212. //        sti
  213. //        endm
  214. //
  215. //PUSHFLAGS macro             ;alias for PUSHF
  216. //        pushf
  217. //        endm
  218. //
  219. //POPFLAGS macro              ;alias for POPF
  220. //        popf
  221. //        endm
  222. //
  223. //INT3    macro               ;alias for INT 3
  224. //        int 3
  225. //        endm
  226. //
  227. //INB     macro   ral,rdx     ;alias for IN AL,DX (also supports IN AH,DX)
  228. //        ifidni  <ral>,<ah>
  229. //          xchg    al,ah
  230. //          in      al,rdx
  231. //          xchg    al,ah
  232. //        else
  233. //          in      ral,rdx
  234. //        endif
  235. //        endm
  236. //
  237. //INW     macro   rax,rdx     ;alias for IN AX,DX (provides support for IO8BIT)
  238. //        IFNDEF IO8BIT
  239. //        in      rax,rdx
  240. //        ELSE
  241. //        in      al,rdx
  242. //        xchg    al,ah
  243. //        inc     rdx
  244. //        jmp     $+2
  245. //        in      al,rdx
  246. //        xchg    al,ah
  247. //        dec     rdx
  248. //        ENDIF
  249. //        endm
  250. //
  251. //OUTB    macro   rdx,ral     ;alias for OUT DX,AL (also supports OUT DX,AH)
  252. //        ifidni  <ral>,<ah>
  253. //          xchg    al,ah
  254. //          out     rdx,al
  255. //          xchg    al,ah
  256. //        else
  257. //          out     rdx,ral
  258. //        endif
  259. //        endm
  260. //
  261. //OUTW    macro   rdx,rax     ;alias for OUT DX,AX (provides support for IO8BIT)
  262. //        IFNDEF IO8BIT
  263. //        out     rdx,rax
  264. //        ELSE
  265. //        out     rdx,al
  266. //        xchg    al,ah
  267. //        inc     rdx
  268. //        jmp     $+2
  269. //        out     rdx,al
  270. //        xchg    al,ah
  271. //        dec     rdx
  272. //        ENDIF
  273. //        endm
  274.  
  275.  
  276. #endif  // INCL_VDDHELPERS
  277.  
  278.  
  279. /*** MVDM-specific types
  280.  */
  281.  
  282. #ifdef  INCL_MVDMTYPES
  283.  
  284. typedef PVOID PVDM;             // linear pointer into VDM      /* pvdm */
  285.  
  286. typedef PBYTE PBVDM;            // same as PVDM, but often needs less casting
  287.  
  288. typedef BYTE VBREG;             // virtual byte register        /* vb */
  289.  
  290. #endif  // INCL_MVDMTYPES
  291.  
  292.  
  293. /*** MVDM-specific include files
  294.  */
  295.  
  296. #ifdef  INCL_VDH
  297. #include <vdmprop.h>            // DOS property services
  298. #include <vdmm.h>               // VDM Manager services
  299. #include <v8086.h>              // 8086 emulation services
  300. #include <vdos.h>               // DOS emulation services
  301. #endif
  302.  
  303. #ifdef  INCL_VDHVPIC
  304. #include <vpic.h>               // VPIC services
  305. #endif
  306.  
  307. #ifdef  INCL_VDHVKBD
  308. #include <vkbd.h>               // VKBD services
  309. #endif
  310.  
  311. #ifdef  INCL_VDHVLPT
  312. #include <vlpt.h>               // VLPT services
  313. #endif
  314.  
  315. #ifdef  INCL_VDHVDMA
  316. #include <vdma.h>               // VDMA services
  317. #endif
  318.  
  319. #ifdef  INCL_ROMBIOS            // ROM BIOS Data Area definitions
  320. #include <vdmbios.h>
  321. #include <vdmbiosj.h>
  322. #endif
  323.  
  324. #ifdef  INCL_MI                 // machine instructions
  325. typedef UCHAR  uchar_t;
  326. typedef USHORT ushort_t;
  327. typedef ULONG  ulong_t;
  328.  
  329. #include <mi.h>
  330. #endif
  331.  
  332. #endif  /* __MVDM__ */
  333.  
  334. #pragma checkout( suspend )
  335.    #ifndef __CHKHDR__
  336.       #pragma checkout( resume )
  337.    #endif
  338. #pragma checkout( resume )
  339.