提交 439688e0 编写于 作者: V vit9696

OcCpuLib: Added privilege detection to CPU frequency detection

上级 86d9e488
......@@ -20,8 +20,11 @@
/**
Assumed CPU frequency when it cannot be detected.
Can be overridden by e.g. emulator.
**/
#ifndef OC_FALLBACK_CPU_FREQUENCY
#define OC_FALLBACK_CPU_FREQUENCY 1000000000
#endif
typedef struct {
//
......
......@@ -140,6 +140,13 @@ InternalCalculateTSCFromPMTimer (
EFI_TPL PrevTpl;
EFI_STATUS Status;
//
// Do not use ACPI PM timer in ring 3 (e.g. emulator).
//
if ((AsmReadCs () & 3U) == 3) {
return EFI_UNSUPPORTED;
}
//
// Decide whether we need to store the frequency.
//
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册