diff options
| author | Alexey Gavrilov <alexey.gavrilov@mail.com> | 2025-12-11 16:04:35 +0700 |
|---|---|---|
| committer | Alexey Gavrilov <alexey.gavrilov@mail.com> | 2025-12-11 16:04:35 +0700 |
| commit | e3e68862bbc731802efc39cbfb1b6df7ab255204 (patch) | |
| tree | 1537b0885e7fa3d16eb169de2b9811bac6858fdb /arch/x86/msr/Msr.cpp | |
| parent | b98035306ceca38432c754847e3ef7474b1b778c (diff) | |
Defines refactoring in msr modulecpuid_refactor
New cpuid model uses instead of old in some
msr definitions.
Signed-off-by: Alexey Gavrilov <alexey.gavrilov@mail.com>
Diffstat (limited to 'arch/x86/msr/Msr.cpp')
| -rw-r--r-- | arch/x86/msr/Msr.cpp | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/arch/x86/msr/Msr.cpp b/arch/x86/msr/Msr.cpp index 6d21b54..7420ab7 100644 --- a/arch/x86/msr/Msr.cpp +++ b/arch/x86/msr/Msr.cpp @@ -1,11 +1,14 @@ #include "Msr.h" +#include "../cpuid/Cpuid.h" Msr::Msr() { - Cpuinfo cpuinfo; - cpuinfo.cpuid(Cpuinfo::VersionInfo); + cpuid::VersionInfo vinfo; + cpuid::Executor executor; - msrSupport = cpuinfo.getRegs().edx & Cpuinfo::MSR; + executor.cpuid(vinfo); + + msrSupport = vinfo.edx & cpuid::VersionInfo::EdxFlags::MSR; }; bool Msr::rdmsr(MsrCommand *cmd) @@ -50,18 +53,26 @@ bool Msr::wrmsr(MsrCommand *cmd) Ia32ApicBase::Ia32ApicBase() { - Cpuinfo cpuinfo; - bool cpuidAddrSzNotSupport = cpuinfo.cpuid(Cpuinfo::AddressSize); - cpuidOutputRegisters AddrSzRegs = cpuinfo.getRegs(); - - cpuinfo.cpuid(Cpuinfo::VersionInfo); - if(cpuinfo.getRegs().edx & Cpuinfo::PAE - and cpuidAddrSzNotSupport) maxPhyAddr = 36; - else if(cpuidAddrSzNotSupport) maxPhyAddr = 32; - else if(!cpuidAddrSzNotSupport) maxPhyAddr = (uint8)AddrSzRegs.edx; - - bspFlag = enableFlag = false; - baseField = NULL; + cpuid::Executor executor; + cpuid::VersionInfo verInfo; + cpuid::ExtendedAddressSize addrSize; + executor.cpuid(verInfo); + executor.cpuid(addrSize); + + if(verInfo.isValid + and verInfo.edx & cpuid::VersionInfo::EdxFlags::PAE + and !addrSize.isValid) + { + maxPhyAddr = 36; + } + else if(!addrSize.isValid) + { + maxPhyAddr = 32; + } + else if(addrSize.isValid) + { + maxPhyAddr = addrSize.eax.physicalAddressBits; + } }; uint32 Ia32ApicBase::getCommand() |
