public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mohammed Gamal <m.gamal005@gmail.com>
To: avi@redhat.com
Cc: mtosatti@redhat.com, kvm@vger.kernel.org,
	Mohammed Gamal <m.gamal005@gmail.com>
Subject: [PATCH] test: Add real mode int n instruction test
Date: Wed,  4 Aug 2010 05:45:14 +0300	[thread overview]
Message-ID: <1280889914-25784-1-git-send-email-m.gamal005@gmail.com> (raw)

This adds a test for int n (opcode 0xcd) instruction in the real mode
test harness

Signed-off-by: Mohammed Gamal <m.gamal005@gmail.com>
---
 x86/realmode.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/x86/realmode.c b/x86/realmode.c
index bb161ac..7534da5 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -947,6 +947,25 @@ void test_iret()
 		print_serial("iret Test 4: PASS\n");
 }
 
+void test_int()
+{
+	struct regs inregs = { 0 }, outregs;
+	
+	*(u32 *)(0x11 * 4) = 0x1000; /* Store a pointer to address 0x1000 in IDT entry 0x11 */
+	*(u8 *)(0x1000) = 0xcf; /* 0x1000 contains an IRET instruction */
+
+	MK_INSN(int11, "int $0x11\n\t");
+
+	exec_in_big_real_mode(&inregs, &outregs,
+			      insn_int11,
+			      insn_int11_end - insn_int11);
+
+	if (!regs_equal(&inregs, &outregs, 0))
+		print_serial("int Test 1: FAIL\n");
+	else
+		print_serial("int Test 1: PASS\n");
+}
+
 void realmode_start(void)
 {
 	test_null();
@@ -969,6 +988,7 @@ void realmode_start(void)
 	test_long_jmp();
 	test_xchg();
 	test_iret();
+	test_int();
 
 	exit(0);
 }
-- 
1.7.0.4


             reply	other threads:[~2010-08-04  2:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04  2:45 Mohammed Gamal [this message]
2010-08-05  9:26 ` [PATCH] test: Add real mode int n instruction test Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1280889914-25784-1-git-send-email-m.gamal005@gmail.com \
    --to=m.gamal005@gmail.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox