forked from Bananymous/banan-os
Kernel: CPUID can detect wether cpu supports nxe bit
This commit is contained in:
parent
65559a3e44
commit
297e65f19a
|
@ -77,5 +77,6 @@ namespace CPUID
|
||||||
const char* get_vendor();
|
const char* get_vendor();
|
||||||
void get_features(uint32_t& ecx, uint32_t& edx);
|
void get_features(uint32_t& ecx, uint32_t& edx);
|
||||||
bool is_64_bit();
|
bool is_64_bit();
|
||||||
|
bool has_nxe();
|
||||||
|
|
||||||
}
|
}
|
|
@ -39,6 +39,17 @@ namespace CPUID
|
||||||
return buffer[3] & (1 << 29);
|
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)
|
const char* feature_string_ecx(uint32_t feat)
|
||||||
{
|
{
|
||||||
switch (feat)
|
switch (feat)
|
||||||
|
|
Loading…
Reference in New Issue