[NTVDM]: We know that .h files are header files ;)
[reactos.git] / subsystems / ntvdm / emulator.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: emulator.h
5 * PURPOSE: Minimal x86 machine emulator for the VDM
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _EMULATOR_H_
10 #define _EMULATOR_H_
11
12 /* INCLUDES *******************************************************************/
13
14 #include "ntvdm.h"
15 #include <fast486.h>
16
17 /* DEFINES ********************************************************************/
18
19 /* FLAGS */
20 #define EMULATOR_FLAG_CF (1 << 0)
21 #define EMULATOR_FLAG_PF (1 << 2)
22 #define EMULATOR_FLAG_AF (1 << 4)
23 #define EMULATOR_FLAG_ZF (1 << 6)
24 #define EMULATOR_FLAG_SF (1 << 7)
25 #define EMULATOR_FLAG_TF (1 << 8)
26 #define EMULATOR_FLAG_IF (1 << 9)
27 #define EMULATOR_FLAG_DF (1 << 10)
28 #define EMULATOR_FLAG_OF (1 << 11)
29 #define EMULATOR_FLAG_NT (1 << 14)
30 #define EMULATOR_FLAG_RF (1 << 16)
31 #define EMULATOR_FLAG_VM (1 << 17)
32 #define EMULATOR_FLAG_AC (1 << 18)
33 #define EMULATOR_FLAG_VIF (1 << 19)
34 #define EMULATOR_FLAG_VIP (1 << 20)
35 #define EMULATOR_FLAG_ID (1 << 21)
36
37 #define STACK_COUNTER 0
38 #define STACK_INT_NUM 1
39 #define STACK_IP 2
40 #define STACK_CS 3
41 #define STACK_FLAGS 4
42
43 enum
44 {
45 EMULATOR_EXCEPTION_DIVISION_BY_ZERO,
46 EMULATOR_EXCEPTION_DEBUG,
47 EMULATOR_EXCEPTION_NMI,
48 EMULATOR_EXCEPTION_BREAKPOINT,
49 EMULATOR_EXCEPTION_OVERFLOW,
50 EMULATOR_EXCEPTION_BOUND,
51 EMULATOR_EXCEPTION_INVALID_OPCODE,
52 EMULATOR_EXCEPTION_NO_FPU,
53 EMULATOR_EXCEPTION_DOUBLE_FAULT,
54 EMULATOR_EXCEPTION_FPU_SEGMENT,
55 EMULATOR_EXCEPTION_INVALID_TSS,
56 EMULATOR_EXCEPTION_NO_SEGMENT,
57 EMULATOR_EXCEPTION_STACK_SEGMENT,
58 EMULATOR_EXCEPTION_GPF,
59 EMULATOR_EXCEPTION_PAGE_FAULT
60 };
61
62 extern FAST486_STATE EmulatorContext;
63
64 /* FUNCTIONS ******************************************************************/
65
66 VOID WINAPI EmulatorReadMemory
67 (
68 PFAST486_STATE State,
69 ULONG Address,
70 PVOID Buffer,
71 ULONG Size
72 );
73
74 VOID WINAPI EmulatorWriteMemory
75 (
76 PFAST486_STATE State,
77 ULONG Address,
78 PVOID Buffer,
79 ULONG Size
80 );
81
82 UCHAR WINAPI EmulatorIntAcknowledge
83 (
84 PFAST486_STATE State
85 );
86
87 BOOLEAN EmulatorInitialize(VOID);
88 VOID EmulatorExecute(WORD Segment, WORD Offset);
89 VOID EmulatorInterrupt(BYTE Number);
90 VOID EmulatorInterruptSignal(VOID);
91 VOID EmulatorStep(VOID);
92 VOID EmulatorCleanup(VOID);
93 VOID EmulatorSetA20(BOOLEAN Enabled);
94
95 #endif // _EMULATOR_H_
96
97 /* EOF */