From: Joerg Roedel Subject: [PATCH 5/7] svm: Add test for RSVD bit check in emulated NPT Date: Tue, 14 Sep 2010 17:59:10 +0200 Message-ID: <1284479952-4916-6-git-send-email-joerg.roedel@amd.com> References: <1284479952-4916-1-git-send-email-joerg.roedel@amd.com> Mime-Version: 1.0 Content-Type: text/plain Cc: , Joerg Roedel To: Avi Kivity Return-path: Received: from tx2ehsobe004.messaging.microsoft.com ([65.55.88.14]:1495 "EHLO TX2EHSOBE008.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752221Ab0INP6j (ORCPT ); Tue, 14 Sep 2010 11:58:39 -0400 In-Reply-To: <1284479952-4916-1-git-send-email-joerg.roedel@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: This patch adds a test to check if the RSVD bits are checked in the NPT emulation of KVM. Signed-off-by: Joerg Roedel --- x86/svm.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/x86/svm.c b/x86/svm.c index 04ca028..03e07e2 100644 --- a/x86/svm.c +++ b/x86/svm.c @@ -516,6 +516,22 @@ static bool npt_us_check(struct test *test) && (test->vmcb->control.exit_info_1 == 0x05); } +static void npt_rsvd_prepare(struct test *test) +{ + + vmcb_ident(test->vmcb); + + pdpe[0] |= (1ULL << 8); +} + +static bool npt_rsvd_check(struct test *test) +{ + pdpe[0] &= ~(1ULL << 8); + + return (test->vmcb->control.exit_code == SVM_EXIT_NPF) + && (test->vmcb->control.exit_info_1 == 0x0f); +} + static struct test tests[] = { { "null", default_supported, default_prepare, null_test, default_finished, null_check }, @@ -542,6 +558,8 @@ static struct test tests[] = { default_finished, npt_nx_check }, { "npt_us", npt_supported, npt_us_prepare, npt_us_test, default_finished, npt_us_check }, + { "npt_rsvd", npt_supported, npt_rsvd_prepare, null_test, + default_finished, npt_rsvd_check }, }; int main(int ac, char **av) -- 1.7.0.4