ReactOS 0.4.16-dev-303-g11d5cb8
cpu.h File Reference
#include <fast486.h>
Include dependency graph for cpu.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EMULATOR_FLAG_CF   (1 << 0)
 
#define EMULATOR_FLAG_PF   (1 << 2)
 
#define EMULATOR_FLAG_AF   (1 << 4)
 
#define EMULATOR_FLAG_ZF   (1 << 6)
 
#define EMULATOR_FLAG_SF   (1 << 7)
 
#define EMULATOR_FLAG_TF   (1 << 8)
 
#define EMULATOR_FLAG_IF   (1 << 9)
 
#define EMULATOR_FLAG_DF   (1 << 10)
 
#define EMULATOR_FLAG_OF   (1 << 11)
 
#define EMULATOR_FLAG_NT   (1 << 14)
 
#define EMULATOR_FLAG_RF   (1 << 16)
 
#define EMULATOR_FLAG_VM   (1 << 17)
 
#define EMULATOR_FLAG_AC   (1 << 18)
 
#define EMULATOR_FLAG_VIF   (1 << 19)
 
#define EMULATOR_FLAG_VIP   (1 << 20)
 
#define EMULATOR_FLAG_ID   (1 << 21)
 

Functions

VOID CpuExecute (WORD Segment, WORD Offset)
 
VOID CpuStep (VOID)
 
VOID CpuSimulate (VOID)
 
VOID CpuUnsimulate (VOID)
 
BOOLEAN CpuInitialize (VOID)
 
VOID CpuCleanup (VOID)
 

Variables

BOOLEAN CpuRunning
 
FAST486_STATE EmulatorContext
 

Macro Definition Documentation

◆ EMULATOR_FLAG_AC

#define EMULATOR_FLAG_AC   (1 << 18)

Definition at line 31 of file cpu.h.

◆ EMULATOR_FLAG_AF

#define EMULATOR_FLAG_AF   (1 << 4)

Definition at line 21 of file cpu.h.

◆ EMULATOR_FLAG_CF

#define EMULATOR_FLAG_CF   (1 << 0)

Definition at line 19 of file cpu.h.

◆ EMULATOR_FLAG_DF

#define EMULATOR_FLAG_DF   (1 << 10)

Definition at line 26 of file cpu.h.

◆ EMULATOR_FLAG_ID

#define EMULATOR_FLAG_ID   (1 << 21)

Definition at line 34 of file cpu.h.

◆ EMULATOR_FLAG_IF

#define EMULATOR_FLAG_IF   (1 << 9)

Definition at line 25 of file cpu.h.

◆ EMULATOR_FLAG_NT

#define EMULATOR_FLAG_NT   (1 << 14)

Definition at line 28 of file cpu.h.

◆ EMULATOR_FLAG_OF

#define EMULATOR_FLAG_OF   (1 << 11)

Definition at line 27 of file cpu.h.

◆ EMULATOR_FLAG_PF

#define EMULATOR_FLAG_PF   (1 << 2)

Definition at line 20 of file cpu.h.

◆ EMULATOR_FLAG_RF

#define EMULATOR_FLAG_RF   (1 << 16)

Definition at line 29 of file cpu.h.

◆ EMULATOR_FLAG_SF

#define EMULATOR_FLAG_SF   (1 << 7)

Definition at line 23 of file cpu.h.

◆ EMULATOR_FLAG_TF

#define EMULATOR_FLAG_TF   (1 << 8)

Definition at line 24 of file cpu.h.

◆ EMULATOR_FLAG_VIF

#define EMULATOR_FLAG_VIF   (1 << 19)

Definition at line 32 of file cpu.h.

◆ EMULATOR_FLAG_VIP

#define EMULATOR_FLAG_VIP   (1 << 20)

Definition at line 33 of file cpu.h.

◆ EMULATOR_FLAG_VM

#define EMULATOR_FLAG_VM   (1 << 17)

Definition at line 30 of file cpu.h.

◆ EMULATOR_FLAG_ZF

#define EMULATOR_FLAG_ZF   (1 << 6)

Definition at line 22 of file cpu.h.

Function Documentation

◆ CpuCleanup()

VOID CpuCleanup ( VOID  )

Definition at line 243 of file cpu.c.

244{
245 // Fast486Cleanup();
246}

Referenced by EmulatorCleanup().

◆ CpuExecute()

VOID CpuExecute ( WORD  Segment,
WORD  Offset 
)

Definition at line 102 of file cpu.c.

103{
104 /* Tell Fast486 to move the instruction pointer */
106}
VOID NTAPI Fast486ExecuteAt(PFAST486_STATE State, USHORT Segment, ULONG Offset)
Definition: fast486.c:212
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
FAST486_STATE EmulatorContext
Definition: cpu.c:39
_Inout_ PVOID Segment
Definition: exfuncs.h:1101

Referenced by DosLoadExecutableInternal(), setEIP(), and setIP().

◆ CpuInitialize()

BOOLEAN CpuInitialize ( VOID  )

Definition at line 216 of file cpu.c.

217{
218 // /* Initialize the internal clock */
219 // if (!ClockInitialize())
220 // {
221 // wprintf(L"FATAL: Failed to initialize the clock\n");
222 // return FALSE;
223 // }
224
225 /* Initialize the CPU */
234 NULL /* TODO: Use a TLB */);
235
236 /* Initialize the software callback system and register the emulator BOPs */
237 // RegisterBop(BOP_DEBUGGER , EmulatorDebugBreakBop);
239
240 return TRUE;
241}
VOID FASTCALL EmulatorBiosOperation(PFAST486_STATE State, UCHAR BopCode)
Definition: bop.c:34
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
UCHAR FASTCALL EmulatorIntAcknowledge(PFAST486_STATE State)
Definition: emulator.c:71
VOID FASTCALL EmulatorFpu(PFAST486_STATE State)
Definition: emulator.c:79
VOID NTAPI Fast486Initialize(PFAST486_STATE State, FAST486_MEM_READ_PROC MemReadCallback, FAST486_MEM_WRITE_PROC MemWriteCallback, FAST486_IO_READ_PROC IoReadCallback, FAST486_IO_WRITE_PROC IoWriteCallback, FAST486_BOP_PROC BopCallback, FAST486_INT_ACK_PROC IntAckCallback, FAST486_FPU_PROC FpuCallback, PULONG Tlb)
Definition: fast486.c:103
#define BOP_UNSIMULATE
Definition: isvbop.h:31
static VOID WINAPI CpuUnsimulateBop(LPWORD Stack)
Definition: cpu.c:209
VOID FASTCALL EmulatorReadIo(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Definition: io.c:349
VOID FASTCALL EmulatorWriteIo(PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize)
Definition: io.c:424
VOID FASTCALL EmulatorReadMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:142
VOID FASTCALL EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:186

Referenced by EmulatorInitialize().

◆ CpuSimulate()

VOID CpuSimulate ( VOID  )

Definition at line 167 of file cpu.c.

168{
170 {
171 DisplayMessage(L"Too many CPU levels of recursion (%d, expected maximum %d)",
173
174 /* Stop the VDM */
176 return;
177 }
178 CpuCallLevel++;
179 DPRINT("CpuSimulate --> Level %d\n", CpuCallLevel);
180
182 while (VdmRunning && CpuRunning)
183 {
185 {
186 while (VdmRunning && CpuRunning) ClockUpdate();
187 }
189 {
190 DPRINT("VDM exception handler called\n");
191 }
192 _SEH2_END;
193 }
194
195 DPRINT("CpuSimulate <-- Level %d\n", CpuCallLevel);
196 CpuCallLevel--;
197 if (!VdmRunning || CpuCallLevel < 0) CpuCallLevel = 0;
198
199 /* This takes into account for reentrance */
200 if (VdmRunning && (CpuCallLevel > 0)) CpuRunning = TRUE;
201}
INT __cdecl DisplayMessage(_In_opt_ HWND hWnd, _In_ UINT uType, _In_opt_ PCWSTR pszTitle, _In_opt_ PCWSTR pszFormatMessage,...)
Definition: reactos.c:211
VOID EmulatorTerminate(VOID)
Definition: emulator.c:503
BOOLEAN VdmRunning
Definition: emulator.c:49
#define L(x)
Definition: ntvdm.h:50
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define DPRINT
Definition: sndvol32.h:73
VOID ClockUpdate(VOID)
Definition: clock.c:76
BOOLEAN CpuRunning
Definition: cpu.c:40
LONG CpuExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
Definition: cpu.c:117
static INT CpuCallLevel
Definition: cpu.c:44
static const INT MaxCpuCallLevel
Definition: cpu.c:43

Referenced by Call16(), VDDSimulate16(), and wmain().

◆ CpuStep()

VOID CpuStep ( VOID  )

Definition at line 108 of file cpu.c.

109{
110 /* Dump the state for debugging purposes */
111 // Fast486DumpState(&EmulatorContext);
112
113 /* Execute the next instruction */
115}
VOID NTAPI Fast486StepInto(PFAST486_STATE State)
Definition: debug.c:248

Referenced by ClockUpdate().

◆ CpuUnsimulate()

VOID CpuUnsimulate ( VOID  )

Definition at line 203 of file cpu.c.

204{
205 /* Stop simulation */
207}
#define FALSE
Definition: types.h:117

Referenced by CpuUnsimulateBop(), DosTerminateProcess(), and EmulatorTerminate().

Variable Documentation

◆ CpuRunning

BOOLEAN CpuRunning
extern

Definition at line 40 of file cpu.c.

Referenced by ClockUpdate(), CpuSimulate(), and CpuUnsimulate().

◆ EmulatorContext

FAST486_STATE EmulatorContext
extern

Definition at line 39 of file cpu.c.