Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/i386/i386 Fix a bug I introduced yesterday. The arg...
details: https://anonhg.NetBSD.org/src/rev/793894c0befa
branches: trunk
changeset: 351580:793894c0befa
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Feb 18 15:56:03 2017 +0000
description:
Fix a bug I introduced yesterday. The arguments are 8-bit ints, so the unit
gets truncated. By luck, the counters I was testing could accept a null
unit.
diffstat:
sys/arch/i386/i386/pmc.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diffs (41 lines):
diff -r 1887a8d51657 -r 793894c0befa sys/arch/i386/i386/pmc.c
--- a/sys/arch/i386/i386/pmc.c Sat Feb 18 14:48:43 2017 +0000
+++ b/sys/arch/i386/i386/pmc.c Sat Feb 18 15:56:03 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmc.c,v 1.22 2017/02/17 12:10:40 maxv Exp $ */
+/* $NetBSD: pmc.c,v 1.23 2017/02/18 15:56:03 maxv Exp $ */
/*
* Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.22 2017/02/17 12:10:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmc.c,v 1.23 2017/02/18 15:56:03 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -156,6 +156,8 @@
static void
pmc_start(pmc_state_t *pmc, struct x86_pmc_startstop_args *args)
{
+ uint64_t event, unit;
+
pmc->running = true;
/*
@@ -185,10 +187,10 @@
break;
case PMC_TYPE_K7:
- args->event &= K7_EVTSEL_EVENT;
- args->unit = (args->unit << K7_EVTSEL_UNIT_SHIFT) &
+ event = (args->event & K7_EVTSEL_EVENT);
+ unit = (args->unit << K7_EVTSEL_UNIT_SHIFT) &
K7_EVTSEL_UNIT;
- pmc->evtval = args->event | args->unit | K7_EVTSEL_EN |
+ pmc->evtval = event | unit | K7_EVTSEL_EN |
((args->flags & PMC_SETUP_KERNEL) ? K7_EVTSEL_OS : 0) |
((args->flags & PMC_SETUP_USER) ? K7_EVTSEL_USR : 0) |
((args->flags & PMC_SETUP_EDGE) ? K7_EVTSEL_E : 0) |
Home |
Main Index |
Thread Index |
Old Index