https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9feab8e95afd57e2a973c…
commit 9feab8e95afd57e2a973c4ef660dc3db55016552
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Thu Nov 26 00:17:50 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Thu Nov 26 00:29:34 2020 +0100
[NDK][XDK] Add some missing macros for run-time checks of X86 system architecture (NEC
support).
---
sdk/include/ndk/ketypes.h | 23 +++++++++++++++++++++++
sdk/include/xdk/ketypes.h | 1 +
sdk/include/xdk/x86/ke.h | 21 +++++++++++++++++++++
3 files changed, 45 insertions(+)
diff --git a/sdk/include/ndk/ketypes.h b/sdk/include/ndk/ketypes.h
index 7a8c614a8de..bd9409d5d26 100644
--- a/sdk/include/ndk/ketypes.h
+++ b/sdk/include/ndk/ketypes.h
@@ -221,6 +221,29 @@ typedef CCHAR KPROCESSOR_MODE;
//
#define SharedUserData ((KUSER_SHARED_DATA *)USER_SHARED_DATA)
+/* Macros for user-mode run-time checks of X86 system architecture */
+#ifdef _X86_
+
+#ifndef IsNEC_98
+#define IsNEC_98 (SharedUserData->AlternativeArchitecture == NEC98x86)
+#endif
+
+#ifndef IsNotNEC_98
+#define IsNotNEC_98 (SharedUserData->AlternativeArchitecture != NEC98x86)
+#endif
+
+/* User-mode cannot override the architecture */
+#ifndef SetNEC_98
+#define SetNEC_98
+#endif
+
+/* User-mode cannot override the architecture */
+#ifndef SetNotNEC_98
+#define SetNotNEC_98
+#endif
+
+#endif
+
//
// Maximum WOW64 Entries in KUSER_SHARED_DATA
//
diff --git a/sdk/include/xdk/ketypes.h b/sdk/include/xdk/ketypes.h
index d8abc4089c2..23a05de1b68 100644
--- a/sdk/include/xdk/ketypes.h
+++ b/sdk/include/xdk/ketypes.h
@@ -892,6 +892,7 @@ typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE {
EndAlternatives
} ALTERNATIVE_ARCHITECTURE_TYPE;
+/* Correctly define these run-time definitions for non X86 machines */
#ifndef _X86_
#ifndef IsNEC_98
diff --git a/sdk/include/xdk/x86/ke.h b/sdk/include/xdk/x86/ke.h
index c4be5220fa0..4b66e2a9d37 100644
--- a/sdk/include/xdk/x86/ke.h
+++ b/sdk/include/xdk/x86/ke.h
@@ -335,4 +335,25 @@ KeGetCurrentProcessorNumber(VOID)
return (ULONG)__readfsbyte(FIELD_OFFSET(KPCR, Number));
}
+/* Macros for kernel-mode run-time checks of X86 system architecture */
+#ifdef IsNEC_98
+#undef IsNEC_98
+#endif
+#define IsNEC_98 (SharedUserData->AlternativeArchitecture == NEC98x86)
+
+#ifdef IsNotNEC_98
+#undef IsNotNEC_98
+#endif
+#define IsNotNEC_98 (SharedUserData->AlternativeArchitecture != NEC98x86)
+
+#ifdef SetNEC_98
+#undef SetNEC_98
+#endif
+#define SetNEC_98 (SharedUserData->AlternativeArchitecture = NEC98x86)
+
+#ifdef SetNotNEC_98
+#undef SetNotNEC_98
+#endif
+#define SetNotNEC_98 (SharedUserData->AlternativeArchitecture = StandardDesign)
+
$endif (_NTDDK_)