https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e2560a5cadb8449f3fb6a032bf06625f6074c897

commit e2560a5cadb8449f3fb6a032bf06625f6074c897
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun Apr 21 11:28:58 2019 +0200
Commit:     Timo Kreuzer <[email protected]>
CommitDate: Sat Jan 18 14:56:17 2020 +0100

    [XDK] Fix x64 version of KeGetCurrentProcessorNumber() and add 
KeGetCurrentProcessorIndex()
---
 sdk/include/xdk/amd64/ke.h | 14 +++++++++++++-
 sdk/include/xdk/kefuncs.h  | 13 -------------
 sdk/include/xdk/x86/ke.h   | 13 +++++++++++++
 3 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/sdk/include/xdk/amd64/ke.h b/sdk/include/xdk/amd64/ke.h
index 90abb703119..64212336702 100644
--- a/sdk/include/xdk/amd64/ke.h
+++ b/sdk/include/xdk/amd64/ke.h
@@ -152,6 +152,15 @@ KeRestoreFloatingPointState(
     return STATUS_SUCCESS;
 }
 
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+FORCEINLINE
+ULONG
+KeGetCurrentProcessorIndex(VOID)
+{
+    return __readgsdword(0x1a4);
+}
+#endif
+
 /* VOID
  * KeFlushIoBuffers(
  *   IN PMDL Mdl,
@@ -320,11 +329,14 @@ KeGetPcr(VOID)
     return (PKPCR)__readgsqword(FIELD_OFFSET(KPCR, Self));
 }
 
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+_CRT_DEPRECATE_TEXT("KeGetCurrentProcessorNumber is deprecated. Use 
KeGetCurrentProcessorNumberEx or KeGetCurrentProcessorIndex instead.")
+#endif
 FORCEINLINE
 ULONG
 KeGetCurrentProcessorNumber(VOID)
 {
-    return (ULONG)__readgsword(0x184);
+    return __readgsbyte(0x184);
 }
 
 $endif /* _NTDDK_ */
diff --git a/sdk/include/xdk/kefuncs.h b/sdk/include/xdk/kefuncs.h
index d33a8a4f34f..c710257751b 100644
--- a/sdk/include/xdk/kefuncs.h
+++ b/sdk/include/xdk/kefuncs.h
@@ -44,19 +44,6 @@ KeInvalidateRangeAllCaches(
   _In_ PVOID BaseAddress,
   _In_ ULONG Length);
 $endif (_NTDDK_)
-$if (_NTIFS_)
-
-NTSTATUS
-NTAPI
-KeGetProcessorNumberFromIndex(
-  _In_ ULONG ProcIndex,
-  _Out_ PPROCESSOR_NUMBER ProcNumber);
-
-ULONG
-NTAPI
-KeGetProcessorIndexFromNumber(
-  _In_ PPROCESSOR_NUMBER ProcNumber);
-$endif (_NTIFS_)
 
 #if (NTDDI_VERSION >= NTDDI_WIN2K)
 
diff --git a/sdk/include/xdk/x86/ke.h b/sdk/include/xdk/x86/ke.h
index 5578f7fca18..f7ef92c2972 100644
--- a/sdk/include/xdk/x86/ke.h
+++ b/sdk/include/xdk/x86/ke.h
@@ -169,6 +169,16 @@ NTAPI
 KeRestoreFloatingPointState(
   _In_ PKFLOATING_SAVE FloatSave);
 
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+FORCEINLINE
+ULONG
+NTAPI
+KeGetCurrentProcessorIndex(VOID)
+{
+    return __readfsbyte(0x51);
+}
+#endif
+
 /* VOID
  * KeFlushIoBuffers(
  *   IN PMDL Mdl,
@@ -315,6 +325,9 @@ typedef struct _KPCR {
   ULONG HalReserved[16];
 } KPCR, *PKPCR;
 
+#if (NTDDI_VERSION >= NTDDI_WIN7)
+_CRT_DEPRECATE_TEXT("KeGetCurrentProcessorNumber is deprecated. Use 
KeGetCurrentProcessorNumberEx or KeGetCurrentProcessorIndex instead.")
+#endif
 FORCEINLINE
 ULONG
 KeGetCurrentProcessorNumber(VOID)

Reply via email to