From: Gleb Natapov <gleb@redhat.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH] kvm-unit-test: fix cpuid test
Date: Mon, 4 Nov 2013 16:04:30 +0200 [thread overview]
Message-ID: <20131104140430.GF7513@redhat.com> (raw)
If cpuid is called with function value greater than max supported one
max supported value is used instead and index parameter is honored. That
is why we need to initialize index to same value in the test to get
same result from both cpuid invocations.
diff --git a/x86/realmode.c b/x86/realmode.c
index c57e033..0e1cd37 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1375,6 +1375,7 @@ static void test_cpuid(void)
unsigned eax, ebx, ecx, edx;
inregs.eax = eax = function;
+ inregs.ecx = ecx = 0;
asm("cpuid" : "+a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx));
exec_in_big_real_mode(&insn_cpuid);
report("cpuid", R_AX|R_BX|R_CX|R_DX,
--
Gleb.
next reply other threads:[~2013-11-04 14:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 14:04 Gleb Natapov [this message]
2013-11-04 14:06 ` [PATCH] kvm-unit-test: fix cpuid test Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131104140430.GF7513@redhat.com \
--to=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox