Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/include Add macros to encode the "unit number"...



details:   https://anonhg.NetBSD.org/src/rev/bcc75875c4ce
branches:  trunk
changeset: 535031:bcc75875c4ce
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Aug 08 20:40:49 2002 +0000

description:
Add macros to encode the "unit number" in the event selector.

diffstat:

 sys/arch/i386/include/pmc.h |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r 51fc190d0108 -r bcc75875c4ce sys/arch/i386/include/pmc.h
--- a/sys/arch/i386/include/pmc.h       Thu Aug 08 20:40:25 2002 +0000
+++ b/sys/arch/i386/include/pmc.h       Thu Aug 08 20:40:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmc.h,v 1.4 2002/08/08 18:37:39 thorpej Exp $  */
+/*     $NetBSD: pmc.h,v 1.5 2002/08/08 20:40:49 thorpej Exp $  */
 
 /*-
  * Copyright (c) 2000 Zembu Labs, Inc.
@@ -48,6 +48,17 @@
 #define        PMC_TYPE_K7_TSC         0x30001         /* cycle counter */
 #define        PMC_TYPE_K7_PMCx        0x30002         /* performance counter */
 
+/*
+ * Each PMC event on the x86 is associated with a processor unit.  We
+ * encode the unit in the upper 16 bits of the event ID.
+ */
+#define        __PMC_EVID_EVENT_MASK   0x0000ffff
+#define        __PMC_EVID_UNIT_MASK    0xffff0000
+
+#define        __PMC_UNIT(x)           ((x) << 16)
+#define        __PMC_GET_UNIT(x)       (((x) & __PMC_EVID_UNIT_MASK) >> 16)
+#define        __PMC_GET_EVENT(x)      ((x) & __PMC_EVID_EVENT_MASK)
+
 #if defined(_KERNEL)
 /*
  * LEGACY PMC support



Home | Main Index | Thread Index | Old Index