From: Markus Metzger <markus.t.metzger@intel.com>
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 [thread overview]
Message-ID: <1416480444-9943-11-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1416480444-9943-1-git-send-email-markus.t.metzger@intel.com>
The preceding patch added a cpu identifier. Use it.
2014-11-20 Markus Metzger <markus.t.metzger@intel.com>
* 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 <sys/syscall.h>
@@ -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
next prev parent reply other threads:[~2014-11-20 10:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-20 10:47 [PATCH v2 00/13] record btrace: prepare for a new trace format Markus Metzger
2014-11-20 10:47 ` [PATCH v2 07/13] btrace: extend struct btrace_insn Markus Metzger
2014-11-20 10:47 ` [PATCH v2 11/13] record-btrace: indicate gaps Markus Metzger
2014-11-20 17:32 ` Metzger, Markus T
2014-11-20 17:36 ` Eli Zaretskii
2014-11-20 10:47 ` [PATCH v2 12/13] configure: check for libipt Markus Metzger
2014-11-20 10:47 ` [PATCH v2 06/13] btrace: update btrace_compute_ftrace parameters Markus Metzger
2014-11-20 10:47 ` [PATCH v2 01/13] btrace: add struct btrace_data Markus Metzger
2015-01-27 11:29 ` Pedro Alves
2014-11-20 10:47 ` [PATCH v2 13/13] [wip] btrace: support Intel(R) Processor Trace Markus Metzger
2014-11-20 16:32 ` Eli Zaretskii
2014-11-20 10:47 ` [PATCH v2 05/13] record-btrace: add bts buffer size configuration option Markus Metzger
2014-11-20 16:25 ` Eli Zaretskii
2014-11-20 10:47 ` Markus Metzger [this message]
2014-11-20 10:47 ` [PATCH v2 04/13] record btrace: add configuration struct Markus Metzger
2014-11-20 10:47 ` [PATCH v2 02/13] btrace: add format argument to supports_btrace Markus Metzger
2014-11-20 10:47 ` [PATCH v2 08/13] btrace: move and rename btrace-common Markus Metzger
2015-01-27 11:25 ` Pedro Alves
2015-01-28 17:58 ` Metzger, Markus T
2014-11-20 10:47 ` [PATCH v2 03/13] btrace, linux: add perf event buffer abstraction Markus Metzger
2015-01-27 15:31 ` Pedro Alves
2015-01-27 18:14 ` Metzger, Markus T
2015-01-27 18:15 ` Pedro Alves
2015-01-28 16:50 ` Metzger, Markus T
2014-11-20 10:47 ` [PATCH v2 09/13] btrace: identify cpu Markus Metzger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416480444-9943-11-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox