Skip to content

Commit 572a0a6

Browse files
jarkkojshansendc
authored andcommitted
selftests/sgx: Fix corrupted cpuid macro invocation
The SGX selftest fails to build on tip/x86/sgx: main.c: In function ‘get_total_epc_mem’: main.c:296:17: error: implicit declaration of function ‘__cpuid’ [-Werror=implicit-function-declaration] 296 | __cpuid(&eax, &ebx, &ecx, &edx); | ^~~~~~~ Include cpuid.h and use __cpuid_count() macro in order to fix the compilation issue. [ dhansen: tweak commit message ] Fixes: f0ff244 ("selftests/sgx: Add a new kselftest: Unclobbered_vdso_oversubscribed") Signed-off-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Acked-by: Reinette Chatre <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Cc: Shuah Khan <[email protected]>
1 parent 50468e4 commit 572a0a6

File tree

1 file changed

+2
-3
lines changed
  • tools/testing/selftests/sgx

1 file changed

+2
-3
lines changed

tools/testing/selftests/sgx/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Copyright(c) 2016-20 Intel Corporation. */
33

4+
#include <cpuid.h>
45
#include <elf.h>
56
#include <errno.h>
67
#include <fcntl.h>
@@ -291,9 +292,7 @@ static unsigned long get_total_epc_mem(void)
291292
int section = 0;
292293

293294
while (true) {
294-
eax = SGX_CPUID;
295-
ecx = section + SGX_CPUID_EPC;
296-
__cpuid(&eax, &ebx, &ecx, &edx);
295+
__cpuid_count(SGX_CPUID, section + SGX_CPUID_EPC, eax, ebx, ecx, edx);
297296

298297
type = eax & SGX_CPUID_EPC_MASK;
299298
if (type == SGX_CPUID_EPC_INVALID)

0 commit comments

Comments
 (0)