From patchwork Tue Apr 13 14:26:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naphtali Sprei X-Patchwork-Id: 92200 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 o3DEQtkV012713 for ; Tue, 13 Apr 2010 14:26:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063Ab0DMO0u (ORCPT ); Tue, 13 Apr 2010 10:26:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751973Ab0DMO0u (ORCPT ); Tue, 13 Apr 2010 10:26:50 -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 o3DEQok8027398 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 13 Apr 2010 10:26:50 -0400 Received: from [10.35.0.60] (dhcp-0-60.tlv.redhat.com [10.35.0.60]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3DEQlw6032061 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 13 Apr 2010 10:26:49 -0400 Message-ID: <4BC47F27.4010509@redhat.com> Date: Tue, 13 Apr 2010 17:26:47 +0300 From: Naphtali Sprei User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: kvm@vger.kernel.org CC: Avi Kivity , Marcelo Tosatti Subject: [PATCH] qemu-kvm: emulator tests: fix msr test 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, 13 Apr 2010 14:27:18 +0000 (UTC) diff --git a/kvm/user/test/x86/msr.c b/kvm/user/test/x86/msr.c index 92102fa..0d6f286 100644 --- a/kvm/user/test/x86/msr.c +++ b/kvm/user/test/x86/msr.c @@ -17,23 +17,25 @@ static void report(const char *name, int passed) static void wrmsr(unsigned index, unsigned long long value) { - asm volatile ("wrmsr" : : "c"(index), "A"(value)); + unsigned a = value, d = value >> 32; + + asm volatile("wrmsr" : : "a"(a), "d"(d), "c"(index)); } static unsigned long long rdmsr(unsigned index) { - unsigned long long value; - - asm volatile ("rdmsr" : "=A"(value) : "c"(index)); + unsigned a, d; - return value; + asm volatile("rdmsr" : "=a"(a), "=d"(d) : "c"(index)); + return ((unsigned long long)d << 32) | a; } + #endif static void test_kernel_gs_base(void) { #ifdef __x86_64__ - unsigned long long v1 = 0x123456789abcdef, v2; + unsigned long long v1 = 0x0000123456789abc, v2; wrmsr(MSR_KERNEL_GS_BASE, v1); v2 = rdmsr(MSR_KERNEL_GS_BASE);