public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mohammed Gamal <m.gamal005@gmail.com>
To: kvm@vger.kernel.org
Cc: avi@qumranet.com
Subject: [PATCH] kvm: testsuite: Add test for 'call near absolute'
Date: Tue, 9 Sep 2008 17:39:39 +0300	[thread overview]
Message-ID: <20080909143939.GA7647@mohd-laptop> (raw)

Adds 'call near absolute' to the real mode test harness

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

diff --git a/user/test/x86/realmode.c b/user/test/x86/realmode.c
index 5f0ca0f..7da22a9 100644
--- a/user/test/x86/realmode.c
+++ b/user/test/x86/realmode.c
@@ -5,6 +5,14 @@ typedef unsigned short u16;
 typedef unsigned u32;
 typedef unsigned long long u64;
 
+void test_function(void);
+
+asm(
+	"test_function: \n\t"
+	"mov $0x1234, %eax \n\t"
+	"ret"
+   );
+
 static int strlen(const char *str)
 {
 	int n;
@@ -279,6 +287,18 @@ void test_io(struct regs *inregs, struct regs *outregs)
 
 }
 
+void test_call(struct regs *inregs, struct regs *outregs)
+{
+	MK_INSN(call1, "mov $test_function, %eax \n\t"
+		       "call *%eax\n\t");
+
+	exec_in_big_real_mode(inregs, outregs,
+		   	      insn_call1,
+			      insn_call1_end - insn_call1);
+	if(!regs_equal(inregs, outregs, R_AX) || outregs->eax != 0x1234)
+		print_serial("Call Test 1: FAIL\n");
+}
+
 void start(void)
 {
 	struct regs inregs = { 0 }, outregs;
@@ -287,6 +307,7 @@ void start(void)
 	exec_in_big_real_mode(&inregs, &outregs, 0, 0);
 	if (!regs_equal(&inregs, &outregs, 0))
 		print_serial("null test: FAIL\n");
+	test_call(&inregs, &outregs);
 	test_mov_imm(&inregs, &outregs);
 	test_io(&inregs, &outregs);
 	test_eflags_insn(&inregs, &outregs);
-- 
1.5.4.3



             reply	other threads:[~2008-09-09 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09 14:39 Mohammed Gamal [this message]
2008-09-10 15:31 ` [PATCH] kvm: testsuite: Add test for 'call near absolute' Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2008-09-08 18:46 Mohammed Gamal
2008-09-09 13:39 ` 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=20080909143939.GA7647@mohd-laptop \
    --to=m.gamal005@gmail.com \
    --cc=avi@qumranet.com \
    --cc=kvm@vger.kernel.org \
    /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