From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31937 invoked by alias); 13 Feb 2014 12:30:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 31917 invoked by uid 89); 13 Feb 2014 12:30:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga09.intel.com Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 13 Feb 2014 12:30:20 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 13 Feb 2014 04:26:02 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 13 Feb 2014 04:30:17 -0800 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s1DCUGue017460; Thu, 13 Feb 2014 12:30:16 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id s1DCUGvU016694; Thu, 13 Feb 2014 13:30:16 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id s1DCUGqV016690; Thu, 13 Feb 2014 13:30:16 +0100 From: Markus Metzger To: jan.kratochvil@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH 2/2] btrace: use i386-cpuid's cpu identifier Date: Thu, 13 Feb 2014 12:30:00 -0000 Message-Id: <1392294615-16416-2-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1392294615-16416-1-git-send-email-markus.t.metzger@intel.com> References: <1392294615-16416-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00463.txt.bz2 2014-02-13 Markus Metzger * common/linux-btrace.c (intel_supports_btrace): Update parameters. (cpu_supports_btrace): Call i386_this_cpu. --- gdb/common/linux-btrace.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/gdb/common/linux-btrace.c b/gdb/common/linux-btrace.c index 218e0ce..46b28bd 100644 --- a/gdb/common/linux-btrace.c +++ b/gdb/common/linux-btrace.c @@ -348,22 +348,12 @@ kernel_supports_btrace (void) /* Check whether an Intel cpu supports branch tracing. */ static int -intel_supports_btrace (void) +intel_supports_btrace (const struct i386_cpu *cpu) { - unsigned int cpuid, model, family; - - if (!i386_cpuid (1, &cpuid, NULL, NULL, NULL)) - return 0; - - family = (cpuid >> 8) & 0xf; - model = (cpuid >> 4) & 0xf; - - switch (family) + switch (cpu->family) { case 0x6: - model += (cpuid >> 12) & 0xf0; - - switch (model) + switch (cpu->model) { case 0x1a: /* Nehalem */ case 0x1f: @@ -391,17 +381,18 @@ intel_supports_btrace (void) static int cpu_supports_btrace (void) { - unsigned int ebx, ecx, edx; + struct i386_cpu cpu; - if (!i386_cpuid (0, NULL, &ebx, &ecx, &edx)) - return 0; - - if (ebx == signature_INTEL_ebx && ecx == signature_INTEL_ecx - && edx == signature_INTEL_edx) - return intel_supports_btrace (); + cpu = i386_this_cpu (); + switch (cpu.vendor) + { + default: + /* Don't know about others. Let's assume they do. */ + return 1; - /* Don't know about others. Let's assume they do. */ - return 1; + case CV_INTEL: + return intel_supports_btrace (&cpu); + } } /* See linux-btrace.h. */ -- 1.8.3.1