From b98035306ceca38432c754847e3ef7474b1b778c Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Thu, 11 Dec 2025 15:44:00 +0700 Subject: Put in cpuid some definitions and declarations Declarations: `acquireInformation` for two extended cpuid commands. Overloading `operator&` for enum classes in `VersionInfo` structure to get proper bit value. All declarations from ==Cpuid.h== file are define in the corresponding cpp file. Signed-off-by: Alexey Gavrilov --- arch/x86/cpuid/Cpuid.h | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'arch/x86/cpuid/Cpuid.h') diff --git a/arch/x86/cpuid/Cpuid.h b/arch/x86/cpuid/Cpuid.h index 42fb692..a65cdc8 100644 --- a/arch/x86/cpuid/Cpuid.h +++ b/arch/x86/cpuid/Cpuid.h @@ -207,10 +207,46 @@ public: SS = (1 << 27), HTT = (1 << 28), TM = (1 << 29), - PBE = (1 << 31), + PBE = static_cast(1 << 31), }; }; +inline uint32 operator&(uint32 r, VersionInfo::EdxFlags flag) +{ + return r & static_cast(flag); +}; + +inline uint32 operator&(uint32 r, cpuid::VersionInfo::EcxFlags flag) +{ + return r & static_cast(flag); +}; + +struct ExtendedAddressSize : public CmdWithNoSubleaf +{ + constexpr static uint32 initialValue = 0x80000008; + + ExtendedAddressSize() : CmdWithNoSubleaf(initialValue){}; + +private: + struct AddressSize + { + uint8 physicalAddressBits, + linearAddressBits; + }; + +public: + AddressSize eax; + bool isWbnoinvdAvailable; +}; + +struct ExtendedMaxInputValue : public CmdWithNoSubleaf +{ + constexpr static uint32 initialValue = 0x80000000; + + ExtendedMaxInputValue() : CmdWithNoSubleaf(initialValue){}; + + uint32 eax; +}; /** * Getters are acquire information from cpuid instruction @@ -221,6 +257,8 @@ public: */ void acquireInformation(BasicInfo &cpuidRes); void acquireInformation(VersionInfo &cpuidRes); +void acquireInformation(ExtendedAddressSize &cpuidRes); +void acquireInformation(ExtendedMaxInputValue &cpuidRes); /** * Validators are check filling correctness for some cpuid command instance -- cgit v1.2.3