mirror of
https://github.com/reactos/reactos.git
synced 2025-06-25 23:09:43 +00:00
- 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).
svn path=/trunk/; revision=24639
This commit is contained in:
parent
2dae9ef970
commit
edaa6996f4
7 changed files with 26 additions and 11 deletions
|
@ -8678,12 +8678,6 @@ NTAPI
|
||||||
KeGetCurrentThread(
|
KeGetCurrentThread(
|
||||||
VOID);
|
VOID);
|
||||||
|
|
||||||
NTKERNELAPI
|
|
||||||
KPROCESSOR_MODE
|
|
||||||
NTAPI
|
|
||||||
KeGetPreviousMode(
|
|
||||||
VOID);
|
|
||||||
|
|
||||||
NTKERNELAPI
|
NTKERNELAPI
|
||||||
ULONG
|
ULONG
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -95,7 +95,7 @@ Author:
|
||||||
//
|
//
|
||||||
#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
|
#define K0IPCR ((ULONG_PTR)(KIP0PCRADDRESS))
|
||||||
#define PCR ((volatile KPCR * const)K0IPCR)
|
#define PCR ((volatile KPCR * const)K0IPCR)
|
||||||
#ifdef _WE_USE_THE_SAME_PCR_ADDRESS
|
#if !defined(CONFIG_SMP) && !defined(NT_BUILD)
|
||||||
#define KeGetPcr() PCR
|
#define KeGetPcr() PCR
|
||||||
#else
|
#else
|
||||||
#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
|
#define KeGetPcr() ((volatile KPCR * const)__readfsdword(0x1C))
|
||||||
|
|
|
@ -30,11 +30,12 @@ LIST_ENTRY ExpFirmwareTableProviderListHead;
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
#undef ExGetPreviousMode
|
||||||
KPROCESSOR_MODE
|
KPROCESSOR_MODE
|
||||||
NTAPI
|
NTAPI
|
||||||
ExGetPreviousMode (VOID)
|
ExGetPreviousMode (VOID)
|
||||||
{
|
{
|
||||||
return (KPROCESSOR_MODE)PsGetCurrentThread()->Tcb.PreviousMode;
|
return KeGetPreviousMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -47,6 +47,7 @@ PVOID ExpNlsSectionPointer;
|
||||||
#define ExInitializeRundownProtection _ExInitializeRundownProtection
|
#define ExInitializeRundownProtection _ExInitializeRundownProtection
|
||||||
#define ExWaitForRundownProtectionRelease _ExWaitForRundownProtectionRelease
|
#define ExWaitForRundownProtectionRelease _ExWaitForRundownProtectionRelease
|
||||||
#define ExRundownCompleted _ExRundownCompleted
|
#define ExRundownCompleted _ExRundownCompleted
|
||||||
|
#define ExGetPreviousMode KeGetPreviousMode
|
||||||
|
|
||||||
/* INITIALIZATION FUNCTIONS *************************************************/
|
/* INITIALIZATION FUNCTIONS *************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1263,3 +1263,18 @@ KiComputeNewPriority(IN PKTHREAD Thread)
|
||||||
return Priority;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,9 @@
|
||||||
|
|
||||||
#ifdef _NTOSKRNL_
|
#ifdef _NTOSKRNL_
|
||||||
|
|
||||||
|
#define KeGetCurrentThread _KeGetCurrentThread
|
||||||
|
#define KeGetPreviousMode _KeGetPreviousMode
|
||||||
|
|
||||||
#include "ke.h"
|
#include "ke.h"
|
||||||
#include "i386/mm.h"
|
#include "i386/mm.h"
|
||||||
#include "i386/fpu.h"
|
#include "i386/fpu.h"
|
||||||
|
|
|
@ -882,18 +882,19 @@ NTAPI
|
||||||
KeGetCurrentThread(VOID)
|
KeGetCurrentThread(VOID)
|
||||||
{
|
{
|
||||||
/* Return the current thread on this PCR */
|
/* Return the current thread on this PCR */
|
||||||
return ((PKIPCR)KeGetPcr())->PrcbData.CurrentThread;
|
return _KeGetCurrentThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
KPROCESSOR_MODE
|
#undef KeGetPreviousMode
|
||||||
|
UCHAR
|
||||||
NTAPI
|
NTAPI
|
||||||
KeGetPreviousMode(VOID)
|
KeGetPreviousMode(VOID)
|
||||||
{
|
{
|
||||||
/* Return the previous mode of this thread */
|
/* Return the previous mode of this thread */
|
||||||
return KeGetCurrentThread()->PreviousMode;
|
return _KeGetPreviousMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue