From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH] Add realmode test for LDS/LES/LFS/LGS/LSS instruction
Date: Mon, 23 Aug 2010 14:47:26 +0800 [thread overview]
Message-ID: <4C72197E.7040408@cn.fujitsu.com> (raw)
In-Reply-To: <4C70F3D7.3000407@redhat.com>
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
x86/realmode.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/x86/realmode.c b/x86/realmode.c
index b69e474..8c771fc 100644
--- a/x86/realmode.c
+++ b/x86/realmode.c
@@ -1184,6 +1184,64 @@ void test_cwd_cdq()
outregs.eax == 0x10000000 && outregs.edx == 0);
}
+static struct {
+ void *address;
+ unsigned short sel;
+} __attribute__((packed)) desc = {
+ (void *)0x1234,
+ 0x10,
+};
+
+void test_lds_lss()
+{
+ inregs = (struct regs){ .ebx = (unsigned long)&desc };
+
+ MK_INSN(lds, "push %ds\n\t"
+ "lds (%ebx), %eax\n\t"
+ "mov %ds, %ebx\n\t"
+ "pop %ds\n\t");
+ exec_in_big_real_mode(&insn_lds);
+ report("lds", R_AX | R_BX,
+ outregs.eax == (unsigned long)desc.address &&
+ outregs.ebx == desc.sel);
+
+ MK_INSN(les, "push %es\n\t"
+ "les (%ebx), %eax\n\t"
+ "mov %es, %ebx\n\t"
+ "pop %es\n\t");
+ exec_in_big_real_mode(&insn_les);
+ report("les", R_AX | R_BX,
+ outregs.eax == (unsigned long)desc.address &&
+ outregs.ebx == desc.sel);
+
+ MK_INSN(lfs, "push %fs\n\t"
+ "lfs (%ebx), %eax\n\t"
+ "mov %fs, %ebx\n\t"
+ "pop %fs\n\t");
+ exec_in_big_real_mode(&insn_lfs);
+ report("lfs", R_AX | R_BX,
+ outregs.eax == (unsigned long)desc.address &&
+ outregs.ebx == desc.sel);
+
+ MK_INSN(lgs, "push %gs\n\t"
+ "lgs (%ebx), %eax\n\t"
+ "mov %gs, %ebx\n\t"
+ "pop %gs\n\t");
+ exec_in_big_real_mode(&insn_lgs);
+ report("lgs", R_AX | R_BX,
+ outregs.eax == (unsigned long)desc.address &&
+ outregs.ebx == desc.sel);
+
+ MK_INSN(lss, "push %ss\n\t"
+ "lss (%ebx), %eax\n\t"
+ "mov %ss, %ebx\n\t"
+ "pop %ss\n\t");
+ exec_in_big_real_mode(&insn_lss);
+ report("lss", R_AX | R_BX,
+ outregs.eax == (unsigned long)desc.address &&
+ outregs.ebx == desc.sel);
+}
+
void realmode_start(void)
{
test_null();
@@ -1215,6 +1273,7 @@ void realmode_start(void)
test_cbw();
test_cwd_cdq();
test_das();
+ test_lds_lss();
exit(0);
}
--
1.7.0.4
next prev parent reply other threads:[~2010-08-23 6:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 9:03 [PATCH] KVM: x86 emulator: add LDS/LES/LFS/LGS/LSS instruction emulation Wei Yongjun
2010-08-20 3:17 ` [PATCH v2] " Wei Yongjun
2010-08-20 9:09 ` Paolo Bonzini
2010-08-22 9:54 ` Avi Kivity
2010-08-23 6:47 ` Wei Yongjun [this message]
2010-08-23 23:18 ` [PATCH] Add realmode test for LDS/LES/LFS/LGS/LSS instruction Marcelo Tosatti
2010-08-23 6:56 ` [PATCH v3] KVM: x86 emulator: add LDS/LES/LFS/LGS/LSS instruction emulation Wei Yongjun
2010-08-23 23:26 ` 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=4C72197E.7040408@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=avi@redhat.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