From patchwork Tue Jul 27 23:03:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammed Gamal X-Patchwork-Id: 114656 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6RN46QH013859 for ; Tue, 27 Jul 2010 23:04:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830Ab0G0XD4 (ORCPT ); Tue, 27 Jul 2010 19:03:56 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:52837 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751194Ab0G0XD4 (ORCPT ); Tue, 27 Jul 2010 19:03:56 -0400 Received: by wyf19 with SMTP id 19so3613941wyf.19 for ; Tue, 27 Jul 2010 16:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=7JMRFXZFOq/ScAagtSuL6BT7q8/p0DgipsNPWBvuj5A=; b=mFGUXQNnqE721N//DnNTz0/j3wsd/L+mD5gXtMj0sD1pNgY+4Gob/A3d16b0c8IJJp fzx//Ff+BYvYbojNS9UzOVHSkjr4nVF+ae4Pwh8BcbaeA2EgqKx353iArtHpPwxtofjs H8OW2GiXSCtVgi+S8nYMCVy5I4PLeOPlPIpY0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=kuIo5sVl1Nky5a8QfotQZR9S4DiqaMX0ELRUXvfB7tL/pP8Qs1NDreuuHgM4eYsTUD 0foeqOCdOW/9XjVte8goXmjZzpFmXQ+IWaivbj6rAaibCA006ASLxX6Q6MHTtEIq9fdj Mo8ug2w9vngnsmaV9hoYlDUE0fKP91efPnb/Y= Received: by 10.216.236.146 with SMTP id w18mr9682169weq.19.1280271834452; Tue, 27 Jul 2010 16:03:54 -0700 (PDT) Received: from localhost.localdomain ([41.238.119.123]) by mx.google.com with ESMTPS id k83sm3088375weq.38.2010.07.27.16.03.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jul 2010 16:03:53 -0700 (PDT) From: Mohammed Gamal To: avi@redhat.com Cc: mtosatti@redhat.com, kvm@vger.kernel.org, Mohammed Gamal Subject: [PATCH] test: Add emulator test for iret instruction Date: Wed, 28 Jul 2010 02:03:31 +0300 Message-Id: <1280271811-1350-1-git-send-email-m.gamal005@gmail.com> X-Mailer: git-send-email 1.7.0.4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 27 Jul 2010 23:04:07 +0000 (UTC) diff --git a/kvm/test/x86/realmode.c b/kvm/test/x86/realmode.c index bd79348..564116a 100644 --- a/kvm/test/x86/realmode.c +++ b/kvm/test/x86/realmode.c @@ -865,6 +865,28 @@ void test_pusha_popa() print_serial("Pusha/Popa Test2: PASS\n"); } +void test_iret() +{ + struct regs inregs = { 0 }, outregs; + + MK_INSN(iret, "pushf\n\t" + "pushl %cs\n\t" + "call 1f\n\t" /* a near call will push eip onto the stack */ + "jmp 2f\n\t" + "1:iret\n\t" + "2:\n\t" + ); + + exec_in_big_real_mode(&inregs, &outregs, + insn_iret, + insn_iret_end - insn_iret); + + if (!regs_equal(&inregs, &outregs, R_AX)) + print_serial("iret Test 1: FAIL\n"); + else + print_serial("iret Test 1: PASS\n"); +} + void realmode_start(void) { test_null(); @@ -886,6 +908,7 @@ void realmode_start(void) /* long jmp test uses call near so test it after testing call */ test_long_jmp(); test_xchg(); + test_iret(); exit(0); }