FreeBSD/sys/dev/hwpmc/hwpmc_amd.c
/*
 * Machine dependent actions taken during the context switch in of a
 * thread.
 */
Machine dependent actions taken during the context switch in of a
thread.
Machine dependent actions taken during the context switch in of a thread .
static int
amd_switch_in(struct pmc_cpu *pc, struct pmc_process *pp)
{
	(void) pc;
	PMCDBG3(MDP,SWI,1, "pc=%p pp=%p enable-msr=%d", pc, pp,
	    (pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS) != 0);
	if (pp->pp_flags & PMC_PP_ENABLE_MSR_ACCESS)
		load_cr4(rcr4() | CR4_PCE);
	return 0;
}
static int amd_switch_in ( struct pmc_cpu * pc , struct pmc_process * pp ) { ( void ) pc ; PMCDBG3 ( MDP , SWI , 1 , " " , pc , pp , ( pp -> pp_flags & PMC_PP_ENABLE_MSR_ACCESS ) != 0 ) ; if ( pp -> pp_flags & PMC_PP_ENABLE_MSR_ACCESS ) load_cr4 ( rcr4 ( ) | CR4_PCE ) ; return 0 ; }
Machine dependent actions taken during the context switch in of a
 thread.
Machine dependent actions taken during the context switch in of a thread .
/* enable the RDPMC instruction if needed */