Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
2.4 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1994 Microsoft Corporation
  3. Module Name:
  4. xm86.h
  5. Abstract:
  6. This module contains the public header file that describes the
  7. interfaces to the 386/486 real mode emulator.
  8. Author:
  9. David N. Cutler (davec) 13-Nov-1994
  10. Revision History:
  11. --*/
  12. #ifndef _XM86_
  13. #define _XM86_
  14. //
  15. // Define internal error codes.
  16. //
  17. typedef enum _XM_STATUS {
  18. XM_SUCCESS = 1,
  19. XM_DIVIDE_BY_ZERO,
  20. XM_DIVIDE_QUOTIENT_OVERFLOW,
  21. XM_EMULATOR_NOT_INITIALIZED,
  22. XM_HALT_INSTRUCTION,
  23. XM_ILLEGAL_CODE_SEGMENT,
  24. XM_ILLEGAL_INDEX_SPECIFIER,
  25. XM_ILLEGAL_LEVEL_NUMBER,
  26. XM_ILLEGAL_PORT_NUMBER,
  27. XM_ILLEGAL_GENERAL_SPECIFIER,
  28. XM_ILLEGAL_REGISTER_SPECIFIER,
  29. XM_ILLEGAL_INSTRUCTION_OPCODE,
  30. XM_INDEX_OUT_OF_BOUNDS,
  31. XM_SEGMENT_LIMIT_VIOLATION,
  32. XM_STACK_OVERFLOW,
  33. XM_STACK_UNDERFLOW,
  34. XM_MAXIMUM_INTERNAL_CODE
  35. } XM_STATUS;
  36. //
  37. // Define operand data types.
  38. //
  39. typedef enum _XM_OPERATION_DATATYPE {
  40. BYTE_DATA = 0,
  41. WORD_DATA = 1,
  42. LONG_DATA = 3
  43. } XM_OPERATION_DATATYPE;
  44. //
  45. // Define emulator context structure.
  46. //
  47. typedef struct _XM86_CONTEXT {
  48. ULONG Eax;
  49. ULONG Ecx;
  50. ULONG Edx;
  51. ULONG Ebx;
  52. ULONG Ebp;
  53. ULONG Esi;
  54. ULONG Edi;
  55. USHORT SegDs;
  56. USHORT SegEs;
  57. } XM86_CONTEXT, *PXM86_CONTEXT;
  58. //
  59. // Define address translation callback function type.
  60. //
  61. typedef
  62. PVOID
  63. (*PXM_TRANSLATE_ADDRESS) (
  64. IN USHORT Segment,
  65. IN USHORT Offset
  66. );
  67. //
  68. // Define read and write I/O space callback function types.
  69. //
  70. typedef
  71. ULONG
  72. (*PXM_READ_IO_SPACE) (
  73. IN XM_OPERATION_DATATYPE DataType,
  74. IN USHORT PortNumber
  75. );
  76. typedef
  77. VOID
  78. (*PXM_WRITE_IO_SPACE) (
  79. IN XM_OPERATION_DATATYPE DataType,
  80. IN USHORT PortNumber,
  81. IN ULONG Value
  82. );
  83. //
  84. // Define emulator public interface function prototypes.
  85. //
  86. XM_STATUS
  87. XmEmulateFarCall (
  88. IN USHORT Segment,
  89. IN USHORT Offset,
  90. IN OUT PXM86_CONTEXT Context
  91. );
  92. XM_STATUS
  93. XmEmulateInterrupt (
  94. IN UCHAR Interrupt,
  95. IN OUT PXM86_CONTEXT Context
  96. );
  97. VOID
  98. XmInitializeEmulator (
  99. IN USHORT StackSegment,
  100. IN USHORT StackOffset,
  101. IN PXM_READ_IO_SPACE ReadIoSpace,
  102. IN PXM_WRITE_IO_SPACE WriteIoSpace,
  103. IN PXM_TRANSLATE_ADDRESS TranslateAddress
  104. );
  105. #endif // _XM86_