svn commit: r327911 - head/lib/libpmc

Justin Hibbits jhibbits at FreeBSD.org
Sat Jan 13 04:53:05 UTC 2018


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 *));


More information about the svn-src-all mailing list