public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: avi@redhat.com, mtosatti@redhat.com
Cc: kvm@vger.kernel.org
Subject: [PATCH 2/2] Add test for ljmp.
Date: Tue, 27 Apr 2010 15:56:04 +0300	[thread overview]
Message-ID: <1272372964-4159-2-git-send-email-gleb@redhat.com> (raw)
In-Reply-To: <1272372964-4159-1-git-send-email-gleb@redhat.com>

Test that ljmp with operand in IO memory works.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---
 kvm/user/test/x86/emulator.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/kvm/user/test/x86/emulator.c b/kvm/user/test/x86/emulator.c
index db84c13..4967d1f 100644
--- a/kvm/user/test/x86/emulator.c
+++ b/kvm/user/test/x86/emulator.c
@@ -183,6 +183,19 @@ void test_pop(void *mem)
 	report("ret", 1);
 }
 
+void test_ljmp(void *mem)
+{
+    unsigned char *m = mem;
+    volatile int res = 1;
+
+    *(unsigned long**)m = &&jmpf;
+    asm volatile ("data16/mov %%cs, %0":"=m"(*(m + sizeof(unsigned long))));
+    asm volatile ("rex64/ljmp *%0"::"m"(*m));
+    res = 0;
+jmpf:
+    report("ljmp", res);
+}
+
 unsigned long read_cr0(void)
 {
 	unsigned long cr0;
@@ -258,6 +271,7 @@ int main()
 
 	test_smsw();
 	test_lmsw();
+        test_ljmp(mem);
 
 	printf("\nSUMMARY: %d tests, %d failures\n", tests, fails);
 	return fails ? 1 : 0;
-- 
1.6.5


  reply	other threads:[~2010-04-27 12:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 12:56 [PATCH 1/2] Test cmps between two IO locations Gleb Natapov
2010-04-27 12:56 ` Gleb Natapov [this message]
2010-04-28 16:31   ` [PATCH 2/2] Add test for ljmp 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=1272372964-4159-2-git-send-email-gleb@redhat.com \
    --to=gleb@redhat.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