kernel/x86: stores cpu number in TSC_AUX if rdtscp is available
On modern x86, one can use __rdtscp to get the current cpu in userland. Change-Id: I1767e379606230a75e4622637c7a5aed9cdf9ab0 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2248 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
b9db31f649
commit
073e295aa6
@@ -1145,6 +1145,12 @@ arch_cpu_init_percpu(kernel_args* args, int cpu)
|
||||
gCpuIdleFunc = halt_idle;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
// if RDTSCP is available write cpu number in TSC_AUX
|
||||
if (x86_check_feature(IA32_FEATURE_AMD_EXT_RDTSCP, FEATURE_EXT_AMD))
|
||||
x86_write_msr(IA32_MSR_TSC_AUX, cpu);
|
||||
#endif
|
||||
|
||||
return __x86_patch_errata_percpu(cpu);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user