[NDK][XDK] Add some missing macros for run-time checks of X86 system architecture (NEC support).

This commit is contained in:
Hermès Bélusca-Maïto 2020-11-26 00:17:50 +01:00
parent c295fb95e9
commit 9feab8e95a
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 45 additions and 0 deletions

View file

@ -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
//

View file

@ -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

View file

@ -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_)