From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPWYA-00024O-Et for qemu-devel@nongnu.org; Thu, 26 May 2011 05:08:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPWY9-00015z-Iw for qemu-devel@nongnu.org; Thu, 26 May 2011 05:08:14 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:49380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPWY9-00014I-Dw for qemu-devel@nongnu.org; Thu, 26 May 2011 05:08:13 -0400 Date: Thu, 26 May 2011 02:08:06 -0700 From: Josh Triplett Message-ID: <20110526090804.GA32647@leaf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] target-i386: GPF on invalid MSRs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org qemu currently returns 0 for rdmsr on invalid MSRs, and ignores wrmsr on invalid MSRs. Real x86 processors GPF on invalid MSRs, which allows software to detect unavailable MSRs. Emulate this behavior correctly in qemu. Bug discovered via the BIOS Implementation Test Suite ; fix tested the same way, for both 32-bit and 64-bit x86. Signed-off-by: Josh Triplett --- op_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff -Naur a/target-i386/op_helper.c b/target-i386/op_helper.c --- a/target-i386/op_helper.c 2011-02-07 15:13:34.000000000 -0800 +++ b/target-i386/op_helper.c 2011-05-26 00:08:49.608636117 -0700 @@ -3135,7 +3135,7 @@ env->mce_banks[offset] = val; break; } - /* XXX: exception ? */ + raise_exception(EXCP0D_GPF); break; } } @@ -3266,7 +3266,7 @@ val = env->mce_banks[offset]; break; } - /* XXX: exception ? */ + raise_exception(EXCP0D_GPF); val = 0; break; }