From patchwork Thu Aug 13 11:54:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 506979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id ED1C014027F for ; Thu, 13 Aug 2015 21:54:27 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=OkoGYVnl; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=FPt6sOhM4PgRtR3fX2MnzUHRF4wmJ 2zEXNn7WQLpjXDHfcMOOzo3oZD3QEzguJ/J2HAcYUdhP7K/MR3wuHIzh5vBMrry9 EMpnabM3u+u3Cz6Nv6+jgc1IDUboByeRw6tmN5nqUkzEcn9jw6XgicAqgarmOzoa 8i5hxMqBN6Uz54= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=CZ5sCP5rCPcodb9dsaFxBRuV4R0=; b=Oko GYVnlpFB1+jiOEqzZDfx5uNBgYpRRP2OzTXy8aNtltvBOKyvqtesUQJUzokSdawR gpbuaN8CJgGE3e8LYCkC16v1G99AiYdZfYVC3gprvIxoJlI4gkIM9WgwUw/AsXCL tEz5S/fDX3UtHRmdkWR4p1oUA7Vch5fKiZl7AoPs= Received: (qmail 26507 invoked by alias); 13 Aug 2015 11:54:22 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 26494 invoked by uid 89); 13 Aug 2015 11:54:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f52.google.com X-Received: by 10.68.117.77 with SMTP id kc13mr77810537pbb.92.1439466853932; Thu, 13 Aug 2015 04:54:13 -0700 (PDT) Date: Thu, 13 Aug 2015 04:54:12 -0700 From: "H.J. Lu" To: GNU C Library Subject: [committed, PATCH] Check if cpuid is available in init_cpu_features Message-ID: <20150813115412.GA22865@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Since not all i486 processors support cpuid, we call __get_cpuid_max to check if cpuid is available before using it if not compiling for i586, i686 nor x86-64. * sysdeps/x86/cpu-features.c (init_cpu_features): Call __get_cpuid_max if not compiling for i586, i686 nor x86-64. --- sysdeps/x86/cpu-features.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 587080c..582a8f5 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -40,6 +40,14 @@ init_cpu_features (struct cpu_features *cpu_features) unsigned int model = 0; enum cpu_features_kind kind; +#if !defined __i586__ && !defined __i686__ && !defined __x86_64__ + if (__get_cpuid_max (0, 0) == 0) + { + kind = arch_kind_other; + goto no_cpuid; + } +#endif + __cpuid (0, cpu_features->max_cpuid, ebx, ecx, edx); /* This spells out "GenuineIntel". */ @@ -196,6 +204,10 @@ init_cpu_features (struct cpu_features *cpu_features) } } +#if !defined __i586__ && !defined __i686__ && !defined __x86_64__ +no_cpuid: +#endif + cpu_features->family = family; cpu_features->model = model; cpu_features->kind = kind;