https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6823878a021ea7e42c98a1...
commit 6823878a021ea7e42c98a11835f5ba4e1f2630e3 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Thu Nov 25 22:39:56 2021 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Sun Nov 28 00:26:44 2021 +0100
[NTVDM] Sort out some global/emulator header info, and NDK headers inclusions. --- subsystems/mvdm/ntvdm/emulator.h | 16 +++++++- subsystems/mvdm/ntvdm/hardware/sound/speaker.c | 1 + subsystems/mvdm/ntvdm/memory.c | 3 ++ subsystems/mvdm/ntvdm/ntvdm.h | 53 +++++++++++++------------- 4 files changed, 44 insertions(+), 29 deletions(-)
diff --git a/subsystems/mvdm/ntvdm/emulator.h b/subsystems/mvdm/ntvdm/emulator.h index deff274d4fa..e4554289bb8 100644 --- a/subsystems/mvdm/ntvdm/emulator.h +++ b/subsystems/mvdm/ntvdm/emulator.h @@ -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); diff --git a/subsystems/mvdm/ntvdm/hardware/sound/speaker.c b/subsystems/mvdm/ntvdm/hardware/sound/speaker.c index f99918b0a0d..3817b004778 100644 --- a/subsystems/mvdm/ntvdm/hardware/sound/speaker.c +++ b/subsystems/mvdm/ntvdm/hardware/sound/speaker.c @@ -18,6 +18,7 @@
/* Extra PSDK/NDK Headers */ #include <ndk/iofuncs.h> +#include <ndk/obfuncs.h>
/* DDK Driver Headers */ #include <ntddbeep.h> diff --git a/subsystems/mvdm/ntvdm/memory.c b/subsystems/mvdm/ntvdm/memory.c index 3b53374afc2..c9de5d915d5 100644 --- a/subsystems/mvdm/ntvdm/memory.c +++ b/subsystems/mvdm/ntvdm/memory.c @@ -16,6 +16,9 @@ #include "emulator.h" #include "memory.h"
+/* Extra PSDK/NDK Headers */ +#include <ndk/mmfuncs.h> + /* PRIVATE VARIABLES **********************************************************/
typedef struct _MEM_HOOK diff --git a/subsystems/mvdm/ntvdm/ntvdm.h b/subsystems/mvdm/ntvdm/ntvdm.h index 17dbd8dfa1e..2b006c06c39 100644 --- a/subsystems/mvdm/ntvdm/ntvdm.h +++ b/subsystems/mvdm/ntvdm/ntvdm.h @@ -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 ******************************************************************/