From patchwork Tue Apr 27 12:56:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 95412 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3RCuCAA021866 for ; Tue, 27 Apr 2010 12:56:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267Ab0D0M4K (ORCPT ); Tue, 27 Apr 2010 08:56:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14145 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752908Ab0D0M4G (ORCPT ); Tue, 27 Apr 2010 08:56:06 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o3RCu6fb016168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 27 Apr 2010 08:56:06 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3RCu5ox012333; Tue, 27 Apr 2010 08:56:05 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id BF5F818D450; Tue, 27 Apr 2010 15:56:04 +0300 (IDT) From: Gleb Natapov 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 Message-Id: <1272372964-4159-2-git-send-email-gleb@redhat.com> In-Reply-To: <1272372964-4159-1-git-send-email-gleb@redhat.com> References: <1272372964-4159-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 27 Apr 2010 12:56:12 +0000 (UTC) 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;