[NTVDM] Sort out some global/emulator header info, and NDK headers inclusions.

This commit is contained in:
Hermès Bélusca-Maïto 2021-11-25 22:39:56 +01:00
parent 695900f51f
commit 6823878a02
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 44 additions and 29 deletions

View file

@ -15,7 +15,11 @@
/* DEFINES ********************************************************************/
/* Basic Memory Management */
/*
* Basic Memory Management
*/
#define NULL32 ((ULONG)0)
#define MEM_ALIGN_DOWN(ptr, align) (PVOID)((ULONG_PTR)(ptr) & ~((align) - 1l))
#define MEM_ALIGN_UP(ptr, align) MEM_ALIGN_DOWN((ULONG_PTR)(ptr) + (align) - 1l, (align))
@ -35,7 +39,9 @@ C_ASSERT(0x100000 <= MAX_ADDRESS); // A minimum of 1 MB is required for PC emul
#define ARRAY_INDEX(ptr, array) ((ULONG)(((ULONG_PTR)(ptr) - (ULONG_PTR)(array)) / sizeof(*array)))
/* BCD-Binary conversion */
/*
* BCD-Binary conversion
*/
FORCEINLINE
USHORT
@ -71,6 +77,11 @@ BCD_TO_BINARY(USHORT Value)
return Result;
}
/*
* Emulator state
*/
enum
{
EMULATOR_EXCEPTION_DIVISION_BY_ZERO,
@ -94,6 +105,7 @@ extern FAST486_STATE EmulatorContext;
extern LPVOID BaseAddress;
extern BOOLEAN VdmRunning;
/* FUNCTIONS ******************************************************************/
VOID DumpMemory(BOOLEAN TextFormat);

View file

@ -18,6 +18,7 @@
/* Extra PSDK/NDK Headers */
#include <ndk/iofuncs.h>
#include <ndk/obfuncs.h>
/* DDK Driver Headers */
#include <ntddbeep.h>

View file

@ -16,6 +16,9 @@
#include "emulator.h"
#include "memory.h"
/* Extra PSDK/NDK Headers */
#include <ndk/mmfuncs.h>
/* PRIVATE VARIABLES **********************************************************/
typedef struct _MEM_HOOK

View file

@ -9,6 +9,31 @@
#ifndef _NTVDM_H_
#define _NTVDM_H_
/* BUILD CONFIGURATION ********************************************************/
/*
* Activate this line if you want to run NTVDM in standalone mode with:
* ntvdm.exe <program>
*/
// #define STANDALONE
/*
* Activate this line for Win2k compliancy
*/
// #define WIN2K_COMPLIANT
/*
* Activate this line if you want advanced hardcoded debug facilities
* (called interrupts, etc...), that may break PC-AT compatibility.
* USE AT YOUR OWN RISK! (disabled by default)
*/
// #define ADVANCED_DEBUGGING
#ifdef ADVANCED_DEBUGGING
#define ADVANCED_DEBUGGING_LEVEL 1
#endif
/* INCLUDES *******************************************************************/
#include <stdio.h>
@ -36,38 +61,12 @@
DWORD WINAPI SetLastConsoleEventActive(VOID);
#define NTOS_MODE_USER
#include <ndk/kefuncs.h>
#include <ndk/mmfuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/kefuncs.h> // For NtQueryPerformanceCounter()
#include <ndk/rtlfuncs.h>
#include <ndk/rtltypes.h>
/* PSEH for SEH Support */
#include <pseh/pseh2.h>
/*
* Activate this line if you want to run NTVDM in standalone mode with:
* ntvdm.exe <program>
*/
// #define STANDALONE
/*
* Activate this line for Win2k compliancy
*/
// #define WIN2K_COMPLIANT
/*
* Activate this line if you want advanced hardcoded debug facilities
* (called interrupts, etc...), that break PC-AT compatibility.
* USE AT YOUR OWN RISK! (disabled by default)
*/
// #define ADVANCED_DEBUGGING
#ifdef ADVANCED_DEBUGGING
#define ADVANCED_DEBUGGING_LEVEL 1
#endif
#define NULL32 0
/* VARIABLES ******************************************************************/