1677d4530SJoseph Koshy.\" Copyright (c) 2007 Joseph Koshy. All rights reserved. 2677d4530SJoseph Koshy.\" 3677d4530SJoseph Koshy.\" Redistribution and use in source and binary forms, with or without 4677d4530SJoseph Koshy.\" modification, are permitted provided that the following conditions 5677d4530SJoseph Koshy.\" are met: 6677d4530SJoseph Koshy.\" 1. Redistributions of source code must retain the above copyright 7677d4530SJoseph Koshy.\" notice, this list of conditions and the following disclaimer. 8677d4530SJoseph Koshy.\" 2. Redistributions in binary form must reproduce the above copyright 9677d4530SJoseph Koshy.\" notice, this list of conditions and the following disclaimer in the 10677d4530SJoseph Koshy.\" documentation and/or other materials provided with the distribution. 11677d4530SJoseph Koshy.\" 12*026dbd29SChristian Brueffer.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13*026dbd29SChristian Brueffer.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14*026dbd29SChristian Brueffer.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15*026dbd29SChristian Brueffer.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16*026dbd29SChristian Brueffer.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17*026dbd29SChristian Brueffer.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18*026dbd29SChristian Brueffer.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19*026dbd29SChristian Brueffer.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20*026dbd29SChristian Brueffer.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21*026dbd29SChristian Brueffer.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22*026dbd29SChristian Brueffer.\" SUCH DAMAGE. 23677d4530SJoseph Koshy.\" 24677d4530SJoseph Koshy.Dd November 25, 2007 25677d4530SJoseph Koshy.Dt PMC_GET_MSR 3 26aa12cea2SUlrich Spörlein.Os 27677d4530SJoseph Koshy.Sh NAME 28677d4530SJoseph Koshy.Nm pmc_get_msr 29677d4530SJoseph Koshy.Nd x86 architecture-specific PMC operations 30677d4530SJoseph Koshy.Sh LIBRARY 31677d4530SJoseph Koshy.Lb libpmc 32677d4530SJoseph Koshy.Sh SYNOPSIS 33677d4530SJoseph Koshy.In pmc.h 34677d4530SJoseph Koshy.Ft int 35677d4530SJoseph Koshy.Fn pmc_get_msr "pmc_id_t pmc" "uint32_t *msr" 36677d4530SJoseph Koshy.Sh DESCRIPTION 37677d4530SJoseph KoshyThe function 38677d4530SJoseph Koshy.Fn pmc_get_msr 39677d4530SJoseph Koshyreturns the processor model specific register number associated with 40677d4530SJoseph Koshya PMC for subsequent use with RDPMC instructions. 41677d4530SJoseph KoshyArgument 42677d4530SJoseph Koshy.Fa pmc 43677d4530SJoseph Koshyspecifies a process scope counting PMC. 44677d4530SJoseph KoshyThe function will write the model specific register number associated 45677d4530SJoseph Koshywith the PMC to the location pointed to by argument 46677d4530SJoseph Koshy.Fa msr . 47677d4530SJoseph Koshy.Pp 48677d4530SJoseph KoshyAfter successful completion of this function, applications 49677d4530SJoseph Koshycan directly read the contents of PMC hardware using 50677d4530SJoseph KoshyRDPMC instructions. 51677d4530SJoseph Koshy.Sh RETURN VALUES 52677d4530SJoseph Koshy.Rv -std pmc_get_msr 53677d4530SJoseph Koshy.Sh ERRORS 54677d4530SJoseph KoshyA call to 55677d4530SJoseph Koshy.Fn pmc_get_msr 56677d4530SJoseph Koshymay fail with the following errors: 57677d4530SJoseph Koshy.Bl -tag -width Er 58677d4530SJoseph Koshy.It Bq Er EINVAL 59677d4530SJoseph KoshyThe PMC handle specified was invalid. 60677d4530SJoseph Koshy.It Bq Er EINVAL 61677d4530SJoseph KoshyThe PMC specified did not have process scope or counting mode. 62677d4530SJoseph Koshy.It Bq Er EINVAL 63677d4530SJoseph KoshyThe PMC specified was allocated with the 64677d4530SJoseph Koshy.Dv PMC_F_DESCENDANTS 65677d4530SJoseph Koshyflag. 66677d4530SJoseph Koshy.It Bq Er EINVAL 67677d4530SJoseph KoshyThe specified PMC is already attached to target processes other 68677d4530SJoseph Koshythan the owner. 69677d4530SJoseph Koshy.It Bq Er ENOSYS 70677d4530SJoseph KoshyThe underlying hardware does not support an RDPMC instruction. 71677d4530SJoseph Koshy.El 72677d4530SJoseph Koshy.Sh SEE ALSO 73677d4530SJoseph Koshy.Xr pmc 3 , 74677d4530SJoseph Koshy.Xr hwpmc 4 75