hwpmc_ppro.c (145338) | hwpmc_ppro.c (145615) |
---|---|
1/*- 2 * Copyright (c) 2003-2005 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2003-2005 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_ppro.c 145338 2005-04-20 20:26:39Z marcel $"); | 28__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_ppro.c 145615 2005-04-28 08:13:19Z jkoshy $"); |
29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/pmc.h> 34#include <sys/pmckern.h> 35#include <sys/smp.h> 36#include <sys/systm.h> --- 290 unchanged lines hidden (view full) --- 327 if ((pcs = pmc_pcpu[cpu]) != NULL) 328 FREE(pcs, M_PMC); 329 pmc_pcpu[cpu] = NULL; 330 331 return 0; 332} 333 334static int | 29 30#include <sys/param.h> 31#include <sys/lock.h> 32#include <sys/mutex.h> 33#include <sys/pmc.h> 34#include <sys/pmckern.h> 35#include <sys/smp.h> 36#include <sys/systm.h> --- 290 unchanged lines hidden (view full) --- 327 if ((pcs = pmc_pcpu[cpu]) != NULL) 328 FREE(pcs, M_PMC); 329 pmc_pcpu[cpu] = NULL; 330 331 return 0; 332} 333 334static int |
335p6_switch_in(struct pmc_cpu *pc) | 335p6_switch_in(struct pmc_cpu *pc, struct pmc_process *pp) |
336{ 337 (void) pc; | 336{ 337 (void) pc; |
338 339 /* allow the RDPMC instruction if needed */ 340 if (pp->pp_flags & PMC_FLAG_ENABLE_MSR_ACCESS) 341 load_cr4(rcr4() | CR4_PCE); |
|
338 return 0; 339} 340 341static int | 342 return 0; 343} 344 345static int |
342p6_switch_out(struct pmc_cpu *pc) | 346p6_switch_out(struct pmc_cpu *pc, struct pmc_process *pp) |
343{ 344 (void) pc; | 347{ 348 (void) pc; |
349 (void) pp; /* can be NULL */ 350 351 /* always turn off the RDPMC instruction */ 352 load_cr4(rcr4() & ~CR4_PCE); 353 |
|
345 return 0; 346} 347 348static int 349p6_read_pmc(int cpu, int ri, pmc_value_t *v) 350{ 351 struct pmc_hw *phw; 352 struct pmc *pm; --- 389 unchanged lines hidden --- | 354 return 0; 355} 356 357static int 358p6_read_pmc(int cpu, int ri, pmc_value_t *v) 359{ 360 struct pmc_hw *phw; 361 struct pmc *pm; --- 389 unchanged lines hidden --- |