Kernel: CPUID can detect wether cpu supports nxe bit
This commit is contained in:
		
							parent
							
								
									3748f0304f
								
							
						
					
					
						commit
						bca7e9a1e8
					
				|  | @ -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(); | ||||
| 
 | ||||
| } | ||||
|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue