Skip to content

Commit 94de6eb

Browse files
committed
[HALPC98] Improve TSC calibration routine
Do not rely on a hardcoded ASM instruction offset Addendum to commit 45e6d49
1 parent aa8d624 commit 94de6eb

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

hal/halx86/pc98/delay.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ _KeStallExecutionProcessor@4:
9797
* Force the in-order execution of the RDTSC instruction.
9898
* HAL will overwrite this with a no-op instruction on older processors.
9999
*/
100+
PUBLIC _HalpStallExecutionStart
101+
_HalpStallExecutionStart:
100102
xor eax, eax
101103
cpuid
102104

hal/halx86/pc98/delay.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ HalpTscCalibrationISR(VOID);
2525

2626
extern volatile ULONG TscCalibrationPhase;
2727
extern ULONG64 TscCalibrationArray[NUM_SAMPLES];
28+
extern UCHAR HalpStallExecutionStart;
2829

2930
/* FUNCTIONS *****************************************************************/
3031

@@ -33,7 +34,7 @@ CODE_SEG("INIT")
3334
VOID
3435
HalpPrepareStallExecution(VOID)
3536
{
36-
PUCHAR Instruction = (PUCHAR)((ULONG_PTR)KeStallExecutionProcessor + 1);
37+
PUCHAR Instruction = &HalpStallExecutionStart;
3738
PKPRCB Prcb = KeGetCurrentPrcb();
3839

3940
/* xor eax, eax; cpuid */

0 commit comments

Comments
 (0)