mirror of
https://github.com/reactos/reactos.git
synced 2026-05-07 06:29:46 +08:00
[HALPC98] Improve TSC calibration routine (#8860)
Do not rely on a hardcoded ASM instruction offset.
Addendum to commit 45e6d49a29.
CORE-17977
This commit is contained in:
@@ -97,6 +97,8 @@ _KeStallExecutionProcessor@4:
|
||||
* Force the in-order execution of the RDTSC instruction.
|
||||
* HAL will overwrite this with a no-op instruction on older processors.
|
||||
*/
|
||||
PUBLIC _HalpStallExecutionSerialize
|
||||
_HalpStallExecutionSerialize:
|
||||
xor eax, eax
|
||||
cpuid
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ HalpTscCalibrationISR(VOID);
|
||||
|
||||
extern volatile ULONG TscCalibrationPhase;
|
||||
extern ULONG64 TscCalibrationArray[NUM_SAMPLES];
|
||||
extern UCHAR HalpStallExecutionSerialize;
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
@@ -33,7 +34,7 @@ CODE_SEG("INIT")
|
||||
VOID
|
||||
HalpPrepareStallExecution(VOID)
|
||||
{
|
||||
PUCHAR Instruction = (PUCHAR)((ULONG_PTR)KeStallExecutionProcessor + 1);
|
||||
PUCHAR Instruction = &HalpStallExecutionSerialize;
|
||||
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||
|
||||
/* xor eax, eax; cpuid */
|
||||
@@ -48,7 +49,7 @@ HalpPrepareStallExecution(VOID)
|
||||
* Intel "Using the RDTSC Instruction for Performance Monitoring".
|
||||
*
|
||||
* Patch the KeStallExecutionProcessor function to remove the serializing instruction
|
||||
* for the Pentium and Pentium MMX processors.
|
||||
* for the Pentium and Pentium MMX processors because the CPUID instruction is slow.
|
||||
*/
|
||||
if ((Prcb->CpuType < 6) && !strcmp(Prcb->VendorString, "GenuineIntel"))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user