From patchwork Wed Jun 5 16:02:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Chunqi Li X-Patchwork-Id: 2671041 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2842D3FD4F for ; Wed, 5 Jun 2013 16:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756384Ab3FEQDI (ORCPT ); Wed, 5 Jun 2013 12:03:08 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:52393 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755761Ab3FEQDG (ORCPT ); Wed, 5 Jun 2013 12:03:06 -0400 Received: by mail-pd0-f178.google.com with SMTP id w16so2039691pde.37 for ; Wed, 05 Jun 2013 09:03:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=ih4q+3bp1IQ1y4zcOUd1Qu39jSyyaX0i5cr4KFupPRY=; b=IAgp9T2S1xZRfmTYstfA9Iry+plkibWB1MSInqrBUIYTPtREmY1xxWqWvyd/zYjU8e IOW9nCHmMhQfh5o0DNTbj3tTiBwQWTG0Z5rZLspEtRfLRb+gN34V3BZ1lx+H0h+FS7Ob 0yzHMKtkZh1af3DBkBDBVrYsVIfQ2vclr6Q0yRPJmAFPzAIohvZv9gHaK8NQJC3S6/H+ N7Ho5MAwdFrdqGkck7JHvdw6cHac1umD8EQ68lCWzIm8H9RM/V/9rrJvfQLRoOfuY/P6 TXqOtd/SnUtxNsSqhixoy0uxs1diI2oEX2qyKETQ+0QhuP93WbJr6RwZbKMZD6tXuo9g LEBA== X-Received: by 10.66.155.102 with SMTP id vv6mr34664327pab.64.1370448185637; Wed, 05 Jun 2013 09:03:05 -0700 (PDT) Received: from Blade1-02.Blade1-02 ([162.105.146.101]) by mx.google.com with ESMTPSA id ue8sm73259196pac.14.2013.06.05.09.03.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 05 Jun 2013 09:03:04 -0700 (PDT) From: Arthur Chunqi Li To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, gleb@redhat.com, Arthur Chunqi Li Subject: [PATCH] Test case of emulating multibyte NOP Date: Thu, 6 Jun 2013 00:02:52 +0800 Message-Id: <1370448172-22960-1-git-send-email-yzt356@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Add multibyte NOP test case to kvm-unit-tests. This version adds test cases into x86/realmode.c. This can test one of bugs when booting RHEL5.9 64-bit. Signed-off-by: Arthur Chunqi Li --- x86/realmode.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/x86/realmode.c b/x86/realmode.c index 981be08..e103ca6 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1504,6 +1504,29 @@ static void test_fninit(void) report("fninit", 0, fsw == 0 && (fcw & 0x103f) == 0x003f); } +static void test_nopl(void) +{ + MK_INSN(nopl1, ".byte 0x90\n\r"); // 1 byte nop + MK_INSN(nopl2, ".byte 0x66, 0x90\n\r"); // 2 bytes nop + MK_INSN(nopl3, ".byte 0x0f, 0x1f, 0x00\n\r"); // 3 bytes nop + MK_INSN(nopl4, ".byte 0x0f, 0x1f, 0x40, 0x00\n\r"); // 4 bytes nop + MK_INSN(nopl5, ".byte 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); // 5 bytes nop + MK_INSN(nopl6, ".byte 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00\n\r"); // 6 bytes nop + MK_INSN(nopl7, ".byte 0x0f, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00\n\r"); // 7 bytes nop + MK_INSN(nopl8, ".byte 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); // 8 bytes nop + MK_INSN(nopl9, ".byte 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00\n\r"); // 9 bytes nop + exec_in_big_real_mode(&insn_nopl1); + exec_in_big_real_mode(&insn_nopl2); + exec_in_big_real_mode(&insn_nopl3); + exec_in_big_real_mode(&insn_nopl4); + exec_in_big_real_mode(&insn_nopl5); + exec_in_big_real_mode(&insn_nopl6); + exec_in_big_real_mode(&insn_nopl7); + exec_in_big_real_mode(&insn_nopl8); + exec_in_big_real_mode(&insn_nopl9); + report("nopl", 0, 1); +} + void realmode_start(void) { test_null(); @@ -1548,6 +1571,7 @@ void realmode_start(void) test_xlat(); test_salc(); test_fninit(); + test_nopl(); exit(0); }