Kernel: 'cpuinfo' command in shell now shows wheter you are running on 64-bit cpu
This commit is contained in:
parent
267367333e
commit
3c92aa45fb
|
@ -46,4 +46,18 @@ namespace CPUID
|
||||||
edx = buffer[3];
|
edx = buffer[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Is64Bit()
|
||||||
|
{
|
||||||
|
if (!IsAvailable())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32_t buffer[4] {};
|
||||||
|
get_cpuid(0x80000000, buffer);
|
||||||
|
if (buffer[0] < 0x80000001)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
get_cpuid(0x80000001, buffer);
|
||||||
|
return buffer[3] & (1 << 29);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,5 +151,6 @@ namespace CPUID
|
||||||
bool IsAvailable();
|
bool IsAvailable();
|
||||||
const char* GetVendor();
|
const char* GetVendor();
|
||||||
void GetFeatures(uint32_t& ecx, uint32_t& edx);
|
void GetFeatures(uint32_t& ecx, uint32_t& edx);
|
||||||
|
bool Is64Bit();
|
||||||
|
|
||||||
}
|
}
|
|
@ -120,6 +120,7 @@ namespace Kernel
|
||||||
CPUID::GetFeatures(ecx, edx);
|
CPUID::GetFeatures(ecx, edx);
|
||||||
|
|
||||||
TTY_PRINTLN("Vendor: '{}'", vendor);
|
TTY_PRINTLN("Vendor: '{}'", vendor);
|
||||||
|
TTY_PRINTLN("64-bit: {}", CPUID::Is64Bit());
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
if (ecx & ((uint32_t)1 << i))
|
if (ecx & ((uint32_t)1 << i))
|
||||||
|
|
Loading…
Reference in New Issue