From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32077 invoked by alias); 20 Nov 2014 10:47:38 -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 32009 invoked by uid 89); 20 Nov 2014 10:47:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,T_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, 20 Nov 2014 10:47:34 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 20 Nov 2014 02:45:18 -0800 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 20 Nov 2014 02:47:29 -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 sAKAlTfn008504; Thu, 20 Nov 2014 10:47:29 GMT Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id sAKAlSt6010287; Thu, 20 Nov 2014 11:47:28 +0100 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id sAKAlSWD010280; Thu, 20 Nov 2014 11:47:28 +0100 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v2 10/13] btrace: use the new cpu identifier Date: Thu, 20 Nov 2014 10:47:00 -0000 Message-Id: <1416480444-9943-11-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com> References: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-11/txt/msg00469.txt.bz2 The preceding patch added a cpu identifier. Use it. 2014-11-20 Markus Metzger * nat/linux-btrace.c: Remove include x86-cpuid.h. (intel_supports_bts): Update parameters. (cpu_supports_bts): Call btrace_this_cpu. --- gdb/nat/linux-btrace.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c index 66f37ea..6948522 100644 --- a/gdb/nat/linux-btrace.c +++ b/gdb/nat/linux-btrace.c @@ -23,7 +23,6 @@ #include "linux-btrace.h" #include "common-regcache.h" #include "gdb_wait.h" -#include "x86-cpuid.h" #ifdef HAVE_SYS_SYSCALL_H #include @@ -302,22 +301,12 @@ kernel_supports_bts (void) /* Check whether an Intel cpu supports BTS. */ static int -intel_supports_bts (void) +intel_supports_bts (const struct btrace_cpu *cpu) { - unsigned int cpuid, model, family; - - if (!x86_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: @@ -345,17 +334,18 @@ intel_supports_bts (void) static int cpu_supports_bts (void) { - unsigned int ebx, ecx, edx; + struct btrace_cpu cpu; - if (!x86_cpuid (0, NULL, &ebx, &ecx, &edx)) - return 0; - - if (ebx == signature_INTEL_ebx && ecx == signature_INTEL_ecx - && edx == signature_INTEL_edx) - return intel_supports_bts (); + cpu = btrace_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_bts (&cpu); + } } /* Check whether the linux target supports BTS. */ -- 1.8.3.1