From patchwork Thu Feb 20 19:42:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25089 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 302D4203C6 for ; Thu, 20 Feb 2014 19:42:57 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf1669576yho.1 for ; Thu, 20 Feb 2014 11:42:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=V+XdHWng5T3ND5+Ve+pTv/HHet2Mi5GO1o033lN5Mkw=; b=TlrR5B/9hKtQBH30k7K1cBa/dPyNz1ehcI9YDkp1RsJvw1+tsWBqYaSBRugjaY3M2q 478nGr/Vq0nJicZi0bJ4wFaW9qpOozrr1FrlMdx/oJtznz5djTn9vUbijBaKiR1u+dNq lokwOS8p5j4hTNaEELfrtcolw0kLVjF4mlphXj5HHhT8fJ2rwL+yMJ0AVRBx1dAowy9l fuDxey9BIqPPLqng7ocqyLWOwkmuYfIiyyoUNwo62t/0+q+1IJP5XgFEM7mlrWGemvpn x0mp165vhdsio9BC1/mbZxxCBZhytIlkZjbawBZv7N6MS8yEFs7thmKebxiP9oiL/m5t z6VQ== X-Gm-Message-State: ALoCoQn54JTy3qk5zSghUYwy40iXBdszPLkVHvRu1bTJmx78JpQ7vqunXB2j439RXAOUecDqoEf8 X-Received: by 10.236.88.231 with SMTP id a67mr1490692yhf.2.1392925376635; Thu, 20 Feb 2014 11:42:56 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.98 with SMTP id b89ls677775qgd.9.gmail; Thu, 20 Feb 2014 11:42:56 -0800 (PST) X-Received: by 10.52.179.198 with SMTP id di6mr1783566vdc.7.1392925376452; Thu, 20 Feb 2014 11:42:56 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id fi9si1903832vcb.39.2014.02.20.11.42.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 11:42:56 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id jx11so2311560veb.38 for ; Thu, 20 Feb 2014 11:42:56 -0800 (PST) X-Received: by 10.52.246.227 with SMTP id xz3mr1723998vdc.95.1392925376351; Thu, 20 Feb 2014 11:42:56 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp83774vcz; Thu, 20 Feb 2014 11:42:55 -0800 (PST) X-Received: by 10.180.101.230 with SMTP id fj6mr8541173wib.27.1392925375521; Thu, 20 Feb 2014 11:42:55 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id cq8si490072wib.56.2014.02.20.11.42.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 20 Feb 2014 11:42:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WGZWH-0003kc-R9; Thu, 20 Feb 2014 19:42:53 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Richard Henderson Subject: [PATCH v2] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32) Date: Thu, 20 Feb 2014 19:42:53 +0000 Message-Id: <1392925373-14393-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Win32 doesn't have a cpuid.h, and MacOSX may have one but without the __cpuid() function we use, which means that commit 9d2eec20 broke the build for those platforms. Fix this by tightening up our configure cpuid.h check to test that the functions we need are present, and adding some missing #ifdef guards in tcg/i386/tcg-target.c. Signed-off-by: Peter Maydell --- Changes v1->v2: fix typo in commit message, add __cpuid_count() to the configure test configure | 13 ++++++++++++- tcg/i386/tcg-target.c | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4648117..79eb54c 100755 --- a/configure +++ b/configure @@ -3564,7 +3564,18 @@ cpuid_h=no cat > $TMPC << EOF #include int main(void) { - return 0; + unsigned a, b, c, d; + int max = __get_cpuid_max(0, 0); + + if (max >= 1) { + __cpuid(1, a, b, c, d); + } + + if (max >= 7) { + __cpuid_count(7, 0, a, b, c, d); + } + + return 0; } EOF if compile_prog "" "" ; then diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c index fef1717..f832282 100644 --- a/tcg/i386/tcg-target.c +++ b/tcg/i386/tcg-target.c @@ -115,7 +115,7 @@ static const int tcg_target_call_oarg_regs[] = { is available. */ #if TCG_TARGET_REG_BITS == 64 # define have_cmov 1 -#elif defined(CONFIG_CPUID_H) +#elif defined(CONFIG_CPUID_H) && defined(bit_CMOV) static bool have_cmov; #else # define have_cmov 0 @@ -2295,6 +2295,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) static void tcg_target_init(TCGContext *s) { +#ifdef CONFIG_CPUID_H unsigned a, b, c, d; int max = __get_cpuid_max(0, 0); @@ -2323,6 +2324,7 @@ static void tcg_target_init(TCGContext *s) have_bmi2 = (b & bit_BMI2) != 0; #endif } +#endif if (TCG_TARGET_REG_BITS == 64) { tcg_regset_set32(tcg_target_available_regs[TCG_TYPE_I32], 0, 0xffff);