From patchwork Tue Dec 2 22:22:42 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: 5424791 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 455199F1C5 for ; Tue, 2 Dec 2014 22:24:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73F1D2028D for ; Tue, 2 Dec 2014 22:24:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E0B4201BC for ; Tue, 2 Dec 2014 22:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933240AbaLBWYw (ORCPT ); Tue, 2 Dec 2014 17:24:52 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:47917 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932550AbaLBWYv (ORCPT ); Tue, 2 Dec 2014 17:24:51 -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 1XvvsE-0001gz-KA; Tue, 02 Dec 2014 22:24:47 +0000 From: Chris J Arges To: kvm@vger.kernel.org Cc: pbonzini@redhat.com, namit@cs.technion.ac.il Subject: [kvm-unit-tests PATCH] x86: emulator: Fix h_mem usage in tests_smsw Date: Tue, 2 Dec 2014 16:22:42 -0600 Message-Id: <1417558962-28481-1-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 1.9.1 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 declaring the h_mem function parameter as volatile, 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..570628f 100644 --- a/x86/emulator.c +++ b/x86/emulator.c @@ -337,7 +337,7 @@ void test_incdecnotneg(void *mem) report("lock notb", *mb == vb); } -void test_smsw(uint64_t *h_mem) +void test_smsw(volatile uint64_t *h_mem) { char mem[16]; unsigned short msw, msw_orig, *pmsw;