Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jan 2018 04:53:04 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327911 - head/lib/libpmc
Message-ID:  <201801130453.w0D4r4jD038019@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Sat Jan 13 04:53:04 2018
New Revision: 327911
URL: https://svnweb.freebsd.org/changeset/base/327911

Log:
  Replace the PMC class struct copy with an explicit memcpy()
  
  This should be effectively a nop for all archs, but for some reason the codegen
  difference on the PowerPC 970 is such that the struct assignment doesn't work
  (unless a printf() using one of the elements in the copied struct follows it),
  while the memcpy() succeeds.  On all archs the memcpy() should be expanded to an
  inline copy, since the copy is bounded to ~16 bytes.
  
  MFC after:	3 weeks

Modified:
  head/lib/libpmc/libpmc.c

Modified: head/lib/libpmc/libpmc.c
==============================================================================
--- head/lib/libpmc/libpmc.c	Sat Jan 13 04:00:55 2018	(r327910)
+++ head/lib/libpmc/libpmc.c	Sat Jan 13 04:53:04 2018	(r327911)
@@ -3270,7 +3270,8 @@ pmc_init(void)
 	cpu_info.pm_npmc    = op_cpu_info.pm_npmc;
 	cpu_info.pm_nclass  = op_cpu_info.pm_nclass;
 	for (n = 0; n < cpu_info.pm_nclass; n++)
-		cpu_info.pm_classes[n] = op_cpu_info.pm_classes[n];
+		memcpy(&cpu_info.pm_classes[n], &op_cpu_info.pm_classes[n],
+		    sizeof(cpu_info.pm_classes[n]));
 
 	pmc_class_table = malloc(PMC_CLASS_TABLE_SIZE *
 	    sizeof(struct pmc_class_descr *));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801130453.w0D4r4jD038019>