From patchwork Thu Dec 20 15:00:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 1900211 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 781B7DF23A for ; Thu, 20 Dec 2012 15:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751305Ab2LTPA7 (ORCPT ); Thu, 20 Dec 2012 10:00:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751031Ab2LTPA6 (ORCPT ); Thu, 20 Dec 2012 10:00:58 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qBKF0vuK019198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 20 Dec 2012 10:00:58 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-4-26.tlv.redhat.com [10.35.4.26]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qBKF0u7t013854; Thu, 20 Dec 2012 10:00:57 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 16A6218D414; Thu, 20 Dec 2012 17:00:56 +0200 (IST) Date: Thu, 20 Dec 2012 17:00:56 +0200 From: Gleb Natapov To: kvm@vger.kernel.org Cc: mtosatti@redhat.com Subject: [PATCH kvm-unit-test]: test fninit/fnstsw/fnstcw instructions emulation Message-ID: <20121220150056.GJ17584@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add test for fninit/fnstsw/fnstcw instructions emulation. This exact code sequence is executed by Linux kernel during boot and sometimes gets emulated by KVM. Signed-off-by: Gleb Natapov --- Gleb. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/x86/realmode.c b/x86/realmode.c index 549b36a..f5426e0 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1384,6 +1384,18 @@ static void test_aad(void) report("aad", R_AX, outregs.eax == 0x123400d4); } +static void test_fninit(void) +{ + u16 fcw = -1, fsw = -1; + MK_INSN(fninit, "fninit ; fnstsw (%eax) ; fnstcw (%ebx)"); + + inregs.eax = (u32)&fsw; + inregs.ebx = (u32)&fcw; + + exec_in_big_real_mode(&insn_fninit); + report("fninit", 0, fsw == 0 && (fcw & 0x103f) == 0x003f); +} + void realmode_start(void) { test_null(); @@ -1424,6 +1436,7 @@ void realmode_start(void) test_movzx_movsx(); test_bswap(); test_aad(); + test_fninit(); exit(0); }