| 164 | } |
| 165 | |
| 166 | static int is_sgx_supported(int cpunum) |
| 167 | { |
| 168 | cpuid_result_t cpuid_regs; |
| 169 | msr_t msr; |
| 170 | |
| 171 | /* CPUID leaf 0x7 subleaf 0x0 to detect SGX support |
| 172 | details are mentioned in Intel SDM Chap.36- section 36.7 */ |
| 173 | cpuid_regs = cpuid_ext(0x7, 0x0); |
| 174 | msr = rdmsr_from_cpu(cpunum, MTRR_CAP_MSR); |
| 175 | return ((cpuid_regs.ebx & SGX_SUPPORTED) && (msr.lo & PRMRR_SUPPORTED)); |
| 176 | } |
| 177 | |
| 178 | static int is_sgx_enabled(int cpunum) |
| 179 | { |
no test coverage detected