public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Markus Metzger <mmetzger@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb, btrace: fix family and model computation
Date: Fri, 28 Oct 2022 06:47:54 +0000 (GMT)	[thread overview]
Message-ID: <20221028064801.6DAB43857837@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d9757bcd43534875d2003962944d3d130289f82c

commit d9757bcd43534875d2003962944d3d130289f82c
Author: Markus Metzger <markus.t.metzger@intel.com>
Date:   Thu Oct 20 16:27:34 2022 +0200

    gdb, btrace: fix family and model computation
    
    In gdb/nat/linux-btrace.c:btrace_this_cpu() we initialize the cpu
    structure given to the libipt btrace decoder.
    
    We only consider the extended model field for family 0x6 and forget about
    family 0xf and we don't consider the extended family field.  Fix it.

Diff:
---
 gdb/nat/linux-btrace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index 4911630ba5c..a951f3b56aa 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -84,9 +84,11 @@ btrace_this_cpu (void)
 	      cpu.vendor = CV_INTEL;
 
 	      cpu.family = (cpuid >> 8) & 0xf;
-	      cpu.model = (cpuid >> 4) & 0xf;
+	      if (cpu.family == 0xf)
+		cpu.family += (cpuid >> 20) & 0xff;
 
-	      if (cpu.family == 0x6)
+	      cpu.model = (cpuid >> 4) & 0xf;
+	      if ((cpu.family == 0x6) || ((cpu.family & 0xf) == 0xf))
 		cpu.model += (cpuid >> 12) & 0xf0;
 	    }
 	}

                 reply	other threads:[~2022-10-28  6:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221028064801.6DAB43857837@sourceware.org \
    --to=mmetzger@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).