From patchwork Thu Jun 6 07:38:29 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: 2677871 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 30DE3DF23A for ; Thu, 6 Jun 2013 07:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757859Ab3FFHiq (ORCPT ); Thu, 6 Jun 2013 03:38:46 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:58827 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754764Ab3FFHip (ORCPT ); Thu, 6 Jun 2013 03:38:45 -0400 Received: by mail-pd0-f182.google.com with SMTP id g10so2989875pdj.13 for ; Thu, 06 Jun 2013 00:38:45 -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=57ARCgB8ob72DlAIMA6VK27F4iL5X3oZP5TK5BvF8Rc=; b=MB0jRdJV65gyWdfH5fB52nZ5OQH/s/UOqiqmcMgOceyi7QMV/lBRYp4KILlOFdBbSy DcwCNSxKTrqBjcjuT6oBBT8cnx+NaktSZxhWPd2UumFJu7G7yB6YuTc3mnxaq8TmDtW2 emgkMME19rM9HOzXaT9/kIDrgWhRzcYZ6lQ/mrZXt4i7+Fra48nNuWFJOMREShPFv78w hxYag930M0GBF37qSWcZHuFvUd8QKb4RkDTYF7idQMWe2wyM1Z79FzCV5nfxja6o6Mt1 voDANam3r0JhTOMpgR6nJmtIWGxtJdzN1784z9vX6oPhnrN237HQfSqR1Wd+OjB8LWI5 VmoA== X-Received: by 10.66.246.131 with SMTP id xw3mr37167081pac.114.1370504325277; Thu, 06 Jun 2013 00:38:45 -0700 (PDT) Received: from Blade1-02.Blade1-02 ([162.105.146.101]) by mx.google.com with ESMTPSA id ov2sm71670952pbc.34.2013.06.06.00.38.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Jun 2013 00:38:44 -0700 (PDT) From: Arthur Chunqi Li To: kvm@vger.kernel.org Cc: gleb@redhat.com, pbonzini@redhat.com, Arthur Chunqi Li Subject: [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP Date: Thu, 6 Jun 2013 15:38:29 +0800 Message-Id: <1370504309-6985-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 (1 to 4-bytes) NOPL test case to kvm-unit-tests x86/realmode.c. This test only consist of 16-bit NOPL insn, other test cases (5 to 9-bytes NOPL) should be placed in x86/emulator.c. Signed-off-by: Arthur Chunqi Li --- x86/realmode.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/x86/realmode.c b/x86/realmode.c index 981be08..3546771 100644 --- a/x86/realmode.c +++ b/x86/realmode.c @@ -1504,6 +1504,19 @@ 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 + 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); + report("nopl", 0, 1); +} + void realmode_start(void) { test_null(); @@ -1548,6 +1561,7 @@ void realmode_start(void) test_xlat(); test_salc(); test_fninit(); + test_nopl(); exit(0); }