From patchwork Thu Feb 20 17:50:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25073 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 5E27C203C6 for ; Thu, 20 Feb 2014 17:50:37 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf1351287yho.5 for ; Thu, 20 Feb 2014 09:50:36 -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=MX10+533Sm/2aJYK9YnwNsSaDH42oAOkgR9cOf86sRw=; b=VyXFU03YIpmgki4ci4XhAwtB84smDrKlA/ta8tm58qHlDF0s989LJ0vyG4rzbnV2+I DRRa9xB0NA4dnkIKlRIF+s6nfJBT09J9Si9X4qBcuWtFOm/cm7fQI3UFGfAT3r/6HpUc 1cQTHugsiUmdvcKGc7n9mN28E0Se0xurCuV9YPXZKsaoha1pI3sic9V3pWeQfkWd3Wcv BZNPg/j1R6+kLjC6psvJk4ZV7kO6KPKHspV635mVcaqKV6wVqNZWbh9GLmXO97Gdj7u3 pWslkMEOFDBgps/uGrsjN7/spDvPOt+eC9LyJPTzUVAWOalWJBf5oGcbtw2yvFuPoP7f dsXw== X-Gm-Message-State: ALoCoQlbweGaQhxDRNTnDR4Zi/dkelCeZze+/5WUGL7jhzVrINAEXSDY17M+p3HJrJiriMIqLCAH X-Received: by 10.236.228.228 with SMTP id f94mr1093386yhq.43.1392918636232; Thu, 20 Feb 2014 09:50:36 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.165 with SMTP id e34ls733272qgf.29.gmail; Thu, 20 Feb 2014 09:50:36 -0800 (PST) X-Received: by 10.220.11.141 with SMTP id t13mr1799175vct.30.1392918636083; Thu, 20 Feb 2014 09:50:36 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id e9si1764321vct.109.2014.02.20.09.50.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Feb 2014 09:50:36 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 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.180; Received: by mail-ve0-f180.google.com with SMTP id cz12so910735veb.25 for ; Thu, 20 Feb 2014 09:50:36 -0800 (PST) X-Received: by 10.52.164.39 with SMTP id yn7mr1452663vdb.25.1392918635989; Thu, 20 Feb 2014 09:50:35 -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 u4csp77213vcz; Thu, 20 Feb 2014 09:50:35 -0800 (PST) X-Received: by 10.194.87.104 with SMTP id w8mr3338693wjz.90.1392918634593; Thu, 20 Feb 2014 09:50:34 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id cd16si197929wib.35.2014.02.20.09.50.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 20 Feb 2014 09:50:34 -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 1WGXlX-0003i3-ST; Thu, 20 Feb 2014 17:50:31 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Richard Henderson Subject: [PATCH] tcg/i386: Fix build for systems without working cpuid.h (MacOSX, Win32) Date: Thu, 20 Feb 2014 17:50:31 +0000 Message-Id: <1392918631-14234-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.180 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 guerds in tcg/i386/tcg-target.c. Signed-off-by: Peter Maydell --- Tested with Linux x86/64 gcc build, Linux x86/64 clang build, W32 cross-build and MacOSX 10.8 build. If somebody would like to review this I'll apply it directly to unbreak things. Apologies for not catching it before I pushed the tcg pullreq; I had forgotten to add the 'build on w32' command to my script. configure | 8 +++++++- tcg/i386/tcg-target.c | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 4648117..a2af9db 100755 --- a/configure +++ b/configure @@ -3564,7 +3564,13 @@ 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); + } + 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);