From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8063 invoked by alias); 14 Jul 2014 13:56:45 -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 7953 invoked by uid 89); 14 Jul 2014 13:56:44 -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,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga14.intel.com Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 14 Jul 2014 13:56:42 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 14 Jul 2014 06:50:26 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 14 Jul 2014 06:56:39 -0700 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 s6EDucIN009241; Mon, 14 Jul 2014 14:56:38 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id s6EDuctL002141; Mon, 14 Jul 2014 15:56:38 +0200 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id s6EDuch9002137; Mon, 14 Jul 2014 15:56:38 +0200 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH 09/12] btrace: use the new cpu identifier Date: Mon, 14 Jul 2014 13:56:00 -0000 Message-Id: <1405346196-1804-10-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1405346196-1804-1-git-send-email-markus.t.metzger@intel.com> References: <1405346196-1804-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00324.txt.bz2 The preceding patch added a cpu identifier. Use it. 2014-07-14 Markus Metzger * common/linux-btrace.c: Remove include i386-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 628358f..b52106e 100644 --- a/gdb/nat/linux-btrace.c +++ b/gdb/nat/linux-btrace.c @@ -31,7 +31,6 @@ #include "regcache.h" #include "gdbthread.h" #include "gdb_wait.h" -#include "i386-cpuid.h" #ifdef HAVE_SYS_SYSCALL_H #include @@ -405,22 +404,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 (!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: @@ -448,17 +437,18 @@ intel_supports_bts (void) static int cpu_supports_bts (void) { - unsigned int ebx, ecx, edx; + struct btrace_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_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