1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +00:00

Add a simple /proc/cpuinfo that includes some info from CPUID.

This commit is contained in:
Andreas Kling 2018-11-02 09:25:23 +01:00
parent 90ddbca127
commit 812e7940e2
5 changed files with 81 additions and 3 deletions

View file

@ -175,3 +175,16 @@ inline constexpr dword pageBaseOf(dword address)
return address & 0xfffff000;
}
class CPUID {
public:
CPUID(dword function) { asm volatile("cpuid" : "=a" (m_eax), "=b" (m_ebx), "=c" (m_ecx), "=d" (m_edx) : "a" (function), "c" (0)); }
dword eax() const { return m_eax; }
dword ebx() const { return m_ebx; }
dword ecx() const { return m_ecx; }
dword edx() const { return m_edx; }
private:
dword m_eax { 0xffffffff };
dword m_ebx { 0xffffffff };
dword m_ecx { 0xffffffff };
dword m_edx { 0xffffffff };
};