aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/hwpmc/hwpmc_arm64.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/hwpmc/hwpmc_arm64.c')
-rw-r--r--sys/dev/hwpmc/hwpmc_arm64.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c
index 49375219a485..050f861a74fe 100644
--- a/sys/dev/hwpmc/hwpmc_arm64.c
+++ b/sys/dev/hwpmc/hwpmc_arm64.c
@@ -181,7 +181,9 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm,
}
pe = a->pm_ev;
- config = (pe & EVENT_ID_MASK);
+ config = (uint32_t)pe - PMC_EV_ARMV8_FIRST;
+ if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST))
+ return (EINVAL);
pm->pm_md.pm_arm64.pm_arm64_evsel = config;
PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config);