From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by sourceware.org (Postfix) with ESMTPS id F1B863856DC0 for ; Fri, 21 Oct 2022 13:17:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1B863856DC0 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="393301096" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="393301096" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 06:17:05 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="755796109" X-IronPort-AV: E=Sophos;i="5.95,200,1661842800"; d="scan'208";a="755796109" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.48.175]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 06:17:04 -0700 From: Markus Metzger To: gdb-patches@sourceware.org Subject: [PATCH] gdb, btrace: fix family and model computation Date: Fri, 21 Oct 2022 14:13:08 +0200 Message-Id: <20221021121308.294059-1-markus.t.metzger@intel.com> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2022 13:17:09 -0000 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. --- 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; } } -- 2.37.3 Intel Deutschland GmbH Registered Address: Am Campeon 10, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928