Kernel: CPUID can detect wether cpu supports nxe bit

This commit is contained in:
Bananymous 2023-07-13 14:24:58 +03:00
parent 65559a3e44
commit 297e65f19a
2 changed files with 12 additions and 0 deletions

View File

@ -77,5 +77,6 @@ namespace CPUID
const char* get_vendor();
void get_features(uint32_t& ecx, uint32_t& edx);
bool is_64_bit();
bool has_nxe();
}

View File

@ -39,6 +39,17 @@ namespace CPUID
return buffer[3] & (1 << 29);
}
bool has_nxe()
{
uint32_t buffer[4] {};
get_cpuid(0x80000000, buffer);
if (buffer[0] < 0x80000001)
return false;
get_cpuid(0x80000001, buffer);
return buffer[3] & (1 << 20);
}
const char* feature_string_ecx(uint32_t feat)
{
switch (feat)