From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: [PATCH v3] Add realmode test for jcxz instruction
Date: Tue, 24 Aug 2010 10:57:12 +0800 [thread overview]
Message-ID: <4C733508.7010608@cn.fujitsu.com> (raw)
In-Reply-To: <20100824000028.GH32690@amt.cnet>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
v2 -> v3: rebased
---
x86/realmode.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/x86/realmode.c b/x86/realmode.c
index 8c771fc..a833829 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1242,6 +1242,47 @@ void test_lds_lss()
outregs.ebx == desc.sel);
}
+void test_jcxz(void)
+{
+ MK_INSN(jcxz1, "jcxz 1f\n\t"
+ "mov $0x1234, %eax\n\t"
+ "1:\n\t");
+ MK_INSN(jcxz2, "mov $0x100, %ecx\n\t"
+ "jcxz 1f\n\t"
+ "mov $0x1234, %eax\n\t"
+ "mov $0, %ecx\n\t"
+ "1:\n\t");
+ MK_INSN(jcxz3, "mov $0x10000, %ecx\n\t"
+ "jcxz 1f\n\t"
+ "mov $0x1234, %eax\n\t"
+ "1:\n\t");
+ MK_INSN(jecxz1, "jecxz 1f\n\t"
+ "mov $0x1234, %eax\n\t"
+ "1:\n\t");
+ MK_INSN(jecxz2, "mov $0x10000, %ecx\n\t"
+ "jecxz 1f\n\t"
+ "mov $0x1234, %eax\n\t"
+ "mov $0, %ecx\n\t"
+ "1:\n\t");
+
+ inregs = (struct regs){ 0 };
+
+ exec_in_big_real_mode(&insn_jcxz1);
+ report("jcxz short 1", 0, 1);
+
+ exec_in_big_real_mode(&insn_jcxz2);
+ report("jcxz short 2", R_AX, outregs.eax == 0x1234);
+
+ exec_in_big_real_mode(&insn_jcxz3);
+ report("jcxz short 3", R_CX, outregs.ecx == 0x10000);
+
+ exec_in_big_real_mode(&insn_jecxz1);
+ report("jecxz short 1", 0, 1);
+
+ exec_in_big_real_mode(&insn_jecxz2);
+ report("jecxz short 2", R_AX, outregs.eax == 0x1234);
+}
+
void realmode_start(void)
{
test_null();
@@ -1274,6 +1315,7 @@ void realmode_start(void)
test_cwd_cdq();
test_das();
test_lds_lss();
+ test_jcxz();
exit(0);
}
--
1.7.0.4
next prev parent reply other threads:[~2010-08-24 2:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 6:25 [PATCH] KVM: x86 emulator: add JrCXZ instruction emulation Wei Yongjun
2010-08-19 6:28 ` [PATCH] Add realmode test for jcxz instruction Wei Yongjun
2010-08-19 13:05 ` Avi Kivity
2010-08-20 0:52 ` [PATCH v2] " Wei Yongjun
2010-08-24 0:00 ` Marcelo Tosatti
2010-08-24 2:57 ` Wei Yongjun [this message]
2010-08-24 13:18 ` [PATCH v3] " Marcelo Tosatti
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=4C733508.7010608@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.