[NTVDM]
[reactos.git] / reactos / subsystems / ntvdm / cpu / cpu.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 _CPU_H_
10 #define _CPU_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 #if 0
38 enum
39 {
40 EMULATOR_EXCEPTION_DIVISION_BY_ZERO,
41 EMULATOR_EXCEPTION_DEBUG,
42 EMULATOR_EXCEPTION_NMI,
43 EMULATOR_EXCEPTION_BREAKPOINT,
44 EMULATOR_EXCEPTION_OVERFLOW,
45 EMULATOR_EXCEPTION_BOUND,
46 EMULATOR_EXCEPTION_INVALID_OPCODE,
47 EMULATOR_EXCEPTION_NO_FPU,
48 EMULATOR_EXCEPTION_DOUBLE_FAULT,
49 EMULATOR_EXCEPTION_FPU_SEGMENT,
50 EMULATOR_EXCEPTION_INVALID_TSS,
51 EMULATOR_EXCEPTION_NO_SEGMENT,
52 EMULATOR_EXCEPTION_STACK_SEGMENT,
53 EMULATOR_EXCEPTION_GPF,
54 EMULATOR_EXCEPTION_PAGE_FAULT
55 };
56 #endif
57 extern FAST486_STATE EmulatorContext;
58 // extern BOOLEAN VdmRunning;
59
60 /* FUNCTIONS ******************************************************************/
61
62 #if 0
63 VOID EmulatorException(BYTE ExceptionNumber, LPWORD Stack);
64 #endif
65
66 VOID CpuExecute(WORD Segment, WORD Offset);
67 VOID CpuStep(VOID);
68 VOID CpuSimulate(VOID);
69 VOID CpuUnsimulate(VOID);
70 #if 0
71 VOID EmulatorTerminate(VOID);
72 #endif
73
74 BOOLEAN CpuInitialize(VOID);
75 VOID CpuCleanup(VOID);
76
77 #endif // _CPU_H_
78
79 /* EOF */