xref: /reactos/subsystems/mvdm/ntvdm/cpu/cpu.h (revision 84ccccab)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/cpu/cpu.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 <fast486.h>
15 
16 /* DEFINES ********************************************************************/
17 
18 /* FLAGS */
19 #define EMULATOR_FLAG_CF    (1 << 0)
20 #define EMULATOR_FLAG_PF    (1 << 2)
21 #define EMULATOR_FLAG_AF    (1 << 4)
22 #define EMULATOR_FLAG_ZF    (1 << 6)
23 #define EMULATOR_FLAG_SF    (1 << 7)
24 #define EMULATOR_FLAG_TF    (1 << 8)
25 #define EMULATOR_FLAG_IF    (1 << 9)
26 #define EMULATOR_FLAG_DF    (1 << 10)
27 #define EMULATOR_FLAG_OF    (1 << 11)
28 #define EMULATOR_FLAG_NT    (1 << 14)
29 #define EMULATOR_FLAG_RF    (1 << 16)
30 #define EMULATOR_FLAG_VM    (1 << 17)
31 #define EMULATOR_FLAG_AC    (1 << 18)
32 #define EMULATOR_FLAG_VIF   (1 << 19)
33 #define EMULATOR_FLAG_VIP   (1 << 20)
34 #define EMULATOR_FLAG_ID    (1 << 21)
35 
36 #if 0
37 enum
38 {
39     EMULATOR_EXCEPTION_DIVISION_BY_ZERO,
40     EMULATOR_EXCEPTION_DEBUG,
41     EMULATOR_EXCEPTION_NMI,
42     EMULATOR_EXCEPTION_BREAKPOINT,
43     EMULATOR_EXCEPTION_OVERFLOW,
44     EMULATOR_EXCEPTION_BOUND,
45     EMULATOR_EXCEPTION_INVALID_OPCODE,
46     EMULATOR_EXCEPTION_NO_FPU,
47     EMULATOR_EXCEPTION_DOUBLE_FAULT,
48     EMULATOR_EXCEPTION_FPU_SEGMENT,
49     EMULATOR_EXCEPTION_INVALID_TSS,
50     EMULATOR_EXCEPTION_NO_SEGMENT,
51     EMULATOR_EXCEPTION_STACK_SEGMENT,
52     EMULATOR_EXCEPTION_GPF,
53     EMULATOR_EXCEPTION_PAGE_FAULT
54 };
55 #endif
56 
57 extern BOOLEAN CpuRunning;
58 extern FAST486_STATE EmulatorContext;
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 */
80