Author: ion
Date: Tue Oct 24 02:01:25 2006
New Revision: 24639
URL:
http://svn.reactos.org/svn/reactos?rev=24639&view=rev
Log:
- Properly implement inline versions of KeGetCurrentThread and
KeGetPreviousMode/ExGetPreviousMode, as well as KeGetPcr. This should significantly
increase performance. (KeGetPreviousMode is reduced to 2 lines of code instead of 15 lines
with 2 expensive jumps).
Modified:
trunk/reactos/include/ddk/winddk.h
trunk/reactos/include/ndk/ketypes.h
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/include/internal/ex.h
trunk/reactos/ntoskrnl/include/internal/ke_x.h
trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
trunk/reactos/ntoskrnl/ke/thrdobj.c
Modified: trunk/reactos/include/ddk/winddk.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=2…
==============================================================================
--- trunk/reactos/include/ddk/winddk.h (original)
+++ trunk/reactos/include/ddk/winddk.h Tue Oct 24 02:01:25 2006
@@ -8679,12 +8679,6 @@
VOID);
NTKERNELAPI
-KPROCESSOR_MODE
-NTAPI
-KeGetPreviousMode(
- VOID);
-
-NTKERNELAPI
ULONG
NTAPI
KeGetRecommendedSharedDataAlignment(
Modified: trunk/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h (original)
+++ trunk/reactos/include/ndk/ketypes.h Tue Oct 24 02:01:25 2006
@@ -95,7 +95,7 @@
//
#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
#define PCR ((volatile KPCR * const)K0IPCR)
-#ifdef _WE_USE_THE_SAME_PCR_ADDRESS
+#if !defined(CONFIG_SMP) && !defined(NT_BUILD)
#define KeGetPcr() PCR
#else
#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c Tue Oct 24 02:01:25 2006
@@ -30,11 +30,12 @@
/*
* @implemented
*/
+#undef ExGetPreviousMode
KPROCESSOR_MODE
NTAPI
ExGetPreviousMode (VOID)
{
- return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode;
+ return KeGetPreviousMode();
}
/*
Modified: trunk/reactos/ntoskrnl/include/internal/ex.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ex.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ex.h Tue Oct 24 02:01:25 2006
@@ -47,6 +47,7 @@
#define ExInitializeRundownProtection _ExInitializeRundownProtection
#define ExWaitForRundownProtectionRelease
_ExWaitForRundownProtectionRelease
#define ExRundownCompleted _ExRundownCompleted
+#define ExGetPreviousMode KeGetPreviousMode
/* INITIALIZATION FUNCTIONS *************************************************/
Modified: trunk/reactos/ntoskrnl/include/internal/ke_x.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ke_x.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ke_x.h Tue Oct 24 02:01:25 2006
@@ -1263,3 +1263,18 @@
return Priority;
}
+PRKTHREAD
+FORCEINLINE
+KeGetCurrentThread(VOID)
+{
+ /* Return the current thread */
+ return ((PKIPCR)KeGetPcr())->PrcbData.CurrentThread;
+}
+
+UCHAR
+FORCEINLINE
+KeGetPreviousMode(VOID)
+{
+ /* Return the current mode */
+ return KeGetCurrentThread()->PreviousMode;
+}
Modified: trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/ntoskrnl.h Tue Oct 24 02:01:25 2006
@@ -16,6 +16,9 @@
#endif
#ifdef _NTOSKRNL_
+
+#define KeGetCurrentThread _KeGetCurrentThread
+#define KeGetPreviousMode _KeGetPreviousMode
#include "ke.h"
#include "i386/mm.h"
Modified: trunk/reactos/ntoskrnl/ke/thrdobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/thrdobj.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/thrdobj.c (original)
+++ trunk/reactos/ntoskrnl/ke/thrdobj.c Tue Oct 24 02:01:25 2006
@@ -882,18 +882,19 @@
KeGetCurrentThread(VOID)
{
/* Return the current thread on this PCR */
- return ((PKIPCR)KeGetPcr())->PrcbData.CurrentThread;
+ return _KeGetCurrentThread();
}
/*
* @implemented
*/
-KPROCESSOR_MODE
+#undef KeGetPreviousMode
+UCHAR
NTAPI
KeGetPreviousMode(VOID)
{
/* Return the previous mode of this thread */
- return KeGetCurrentThread()->PreviousMode;
+ return _KeGetPreviousMode();
}
/*