From patchwork Wed Dec 3 15:44:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris J Arges X-Patchwork-Id: 5431661 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7802BEEA8 for ; Wed, 3 Dec 2014 15:44:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0C5E920376 for ; Wed, 3 Dec 2014 15:44:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC3F720375 for ; Wed, 3 Dec 2014 15:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751867AbaLCPoe (ORCPT ); Wed, 3 Dec 2014 10:44:34 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:52366 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750893AbaLCPoe (ORCPT ); Wed, 3 Dec 2014 10:44:34 -0500 Received: from cpe-173-174-67-34.austin.res.rr.com ([173.174.67.34] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XwC6R-0005AG-HB; Wed, 03 Dec 2014 15:44:31 +0000 From: Chris J Arges To: kvm@vger.kernel.org Cc: namit@cs.technion.ac.il, pbonzini@redhat.com, Chris J Arges Subject: [kvm-unit-tests PATCH v2] x86: emulator: Fix h_mem usage in tests_smsw Date: Wed, 3 Dec 2014 09:44:15 -0600 Message-Id: <1417621455-22031-1-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <547ED4B1.4080805@redhat.com> References: <547ED4B1.4080805@redhat.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In emulator.c/tests_smsw, smsw (3) fails because h_mem isn't being set correctly before smsw is called. By using the + constraint modifier for memory we can ensure the compiler no longer optimizes out the assignment before smsw. Signed-off-by: Chris J Arges --- x86/emulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86/emulator.c b/x86/emulator.c index 5aa4dbf..1e05574 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -359,7 +359,7 @@ void test_smsw(uint64_t *h_mem) /* Trigger exit on smsw */ *h_mem = 0x12345678abcdeful; - asm volatile("smsw %0" : "=m"(*h_mem)); + asm volatile("smsw %0" : "+m"(*h_mem)); report("smsw (3)", msw == (unsigned short)*h_mem && (*h_mem & ~0xfffful) == 0x12345678ab0000ul); }