This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 09/12] btrace: use the new cpu identifier
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: palves at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 14 Jul 2014 15:56:33 +0200
- Subject: [PATCH 09/12] btrace: use the new cpu identifier
- Authentication-results: sourceware.org; auth=none
- References: <1405346196-1804-1-git-send-email-markus dot t dot metzger at intel dot com>
The preceding patch added a cpu identifier. Use it.
2014-07-14 Markus Metzger <markus.t.metzger@intel.com>
* 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 <sys/syscall.h>
@@ -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