Exemplo n.º 1
0
/*
 * Reconfigure specified per-CPU timer on other CPU. Called from IPI handler.
 */
inline static int
doconfigtimer(int i)
{
	tc *conf;

	conf = DPCPU_PTR(configtimer);
	if (atomic_load_acq_int(*conf + i)) {
		if (i == 0 ? timer1hz : timer2hz)
			et_start(timer[i], NULL, &timerperiod[i]);
		else
			et_stop(timer[i]);
		atomic_store_rel_int(*conf + i, 0);
		return (1);
	}
	return (0);
}
Exemplo n.º 2
0
static void
pefs_aesni_enter(struct pefs_session *xses)
{
	struct pefs_aesni_ses *ses = &xses->o.ps_aesni;

	if (is_fpu_kern_thread(0)) {
		ses->fpu_saved = 0;
		return;
	}

	critical_enter();
	ses->fpu_ctx = (void *)atomic_swap_ptr(
	    (volatile void *)DPCPU_PTR(pefs_aesni_fpu), (uintptr_t)NULL);
	if (ses->fpu_ctx != NULL) {
		ses->td = curthread;
		ses->fpu_cpuid = curcpu;
		fpu_kern_enter(ses->td, ses->fpu_ctx, FPU_KERN_NORMAL);
		ses->fpu_saved = 1;
	} else {
		ses->fpu_saved = -1;
	}
	critical_exit();
}