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 984CC3858C2D; Tue, 8 Nov 2022 06:49:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 984CC3858C2D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667890169; x=1699426169; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=siFNv/UMUSJheTVWHiL9UIPAN9evUw+tsJP4TF0H6IE=; b=WEWePmYE5uH7L7X5sUJTZJYur+lNBv/kJyYitV2J7nmIz9AVFBpsGEIL F2ka3rEa0YtBq/AGQYQg4i9cB9ggnGR4mlQEwsKmUq1snAbnNlCXgea/o DWYpN3jpOphveDWrkNWRJoPNYqjhT+0910uNe8xyB9MVAerRdvjgJi094 Mc3GDNYTo0jXabEzDyL6hqrOWSksjHBO2Y4RLP4ZaflTQ2arGnWnd+3q4 kH8eFBn6Gfmbek7rZaQqtZrzEwSuwomU+O/P8KQfk3cqDcx42QrDXI/Wv JeKZKzWq5jNl6t1DtYuRwJJp1Ayd6UIcyPE9lCVagExELok0BWpBG5a04 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="396916975" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="396916975" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 22:49:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10524"; a="699805744" X-IronPort-AV: E=Sophos;i="5.96,147,1665471600"; d="scan'208";a="699805744" Received: from labpc2407.iul.intel.com (HELO localhost) ([172.28.48.175]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2022 22:49:27 -0800 From: Markus Metzger To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH 1/2] gprofng: make cpu identification available to others Date: Tue, 8 Nov 2022 06:45:29 +0100 Message-Id: <20221108054530.796968-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.7 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 List-Id: I ran gprofng.display/display.exp on Fedora 36 x86-64 and I got UNSUPPORTED: jsynprog ERROR: comparison of results in mttest failed UNRESOLVED: mttest ERROR: comparison of results in mttest failed UNRESOLVED: mttest PASS: synprog PASS: synprog with and without this patch. --- gprofng/common/hwcdrv.c | 2 +- gprofng/common/cpuid.c => include/cpuident.h | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) rename gprofng/common/cpuid.c => include/cpuident.h (96%) diff --git a/gprofng/common/hwcdrv.c b/gprofng/common/hwcdrv.c index 03c3a71c8e2..115638aa623 100644 --- a/gprofng/common/hwcdrv.c +++ b/gprofng/common/hwcdrv.c @@ -32,7 +32,7 @@ /* macros */ #define IS_GLOBAL /* Mark global symbols */ -#include "cpuid.c" /* ftns for identifying a chip */ +#include "cpuident.h" /* ftns for identifying a chip */ static hdrv_pcbe_api_t hdrv_pcbe_core_api; static hdrv_pcbe_api_t hdrv_pcbe_opteron_api; diff --git a/gprofng/common/cpuid.c b/include/cpuident.h similarity index 96% rename from gprofng/common/cpuid.c rename to include/cpuident.h index 211e09aa8ac..7ab6fc1f2b1 100644 --- a/gprofng/common/cpuid.c +++ b/include/cpuident.h @@ -18,6 +18,11 @@ Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef _CPUIDENT_H +#define _CPUIDENT_H + +#include + #if defined(__i386__) || defined(__x86_64) #include /* GCC-provided */ #elif defined(__aarch64__) @@ -85,7 +90,7 @@ typedef struct #if defined(__i386__) || defined(__x86_64) -static uint_t +static unsigned int cpuid_vendorstr_to_vendorcode (char *vendorstr) { if (strcmp (vendorstr, X86_VENDORSTR_Intel) == 0) @@ -101,8 +106,10 @@ my_cpuid (unsigned int op, cpuid_regs_t *regs) { regs->eax = regs->ebx = regs->ecx = regs->edx = 0; int ret = __get_cpuid (op, ®s->eax, ®s->ebx, ®s->ecx, ®s->edx); +#ifdef DBG_LT1 TprintfT (DBG_LT1, "my_cpuid: __get_cpuid(0x%x, 0x%x, 0x%x, 0x%x, 0x%x) returns %d\n", op, regs->eax, regs->ebx, regs->ecx, regs->edx, ret); +#endif return ret; } #endif @@ -184,20 +191,22 @@ get_cpuid_info () return cpi; } -static inline uint_t +static inline unsigned int cpuid_getvendor () { return get_cpuid_info ()->cpi_vendor; } -static inline uint_t +static inline unsigned int cpuid_getfamily () { return get_cpuid_info ()->cpi_family; } -static inline uint_t +static inline unsigned int cpuid_getmodel () { return get_cpuid_info ()->cpi_model; } + +#endif /* _CPUIDENT_H */ -- 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