From 29c65cc4bd1f4beaca8d92acb0e1a3c39120e556 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Thu, 31 Mar 2022 09:58:54 +0300 Subject: [PATCH 3/7] svm: add svm_suported --- lib/x86/svm_lib.h | 5 +++++ x86/svm.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/x86/svm_lib.h b/lib/x86/svm_lib.h index cdc93408..1c35d4a9 100644 --- a/lib/x86/svm_lib.h +++ b/lib/x86/svm_lib.h @@ -4,6 +4,11 @@ #include #include "processor.h" +static inline bool svm_supported(void) +{ + return this_cpu_has(X86_FEATURE_SVM); +} + static inline bool npt_supported(void) { return this_cpu_has(X86_FEATURE_NPT); diff --git a/x86/svm.c b/x86/svm.c index 009d2d8c..7a654425 100644 --- a/x86/svm.c +++ b/x86/svm.c @@ -375,7 +375,7 @@ int main(int ac, char **av) __setup_vm(&opt_mask); - if (!this_cpu_has(X86_FEATURE_SVM)) { + if (!svm_supported()) { printf("SVM not availble\n"); return report_summary(); } -- 2.26.3