diff options
Diffstat (limited to 'sys/amd64/amd64/pmap.c')
-rw-r--r-- | sys/amd64/amd64/pmap.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index fd5e21d..238f0b4 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -732,6 +732,30 @@ pmap_invalidate_all(pmap_t pmap) else critical_exit(); } + +void +pmap_invalidate_cache(void) +{ + + if (smp_started) { + if (!(read_rflags() & PSL_I)) + panic("%s: interrupts disabled", __func__); + mtx_lock_spin(&smp_ipi_mtx); + } else + critical_enter(); + /* + * We need to disable interrupt preemption but MUST NOT have + * interrupts disabled here. + * XXX we may need to hold schedlock to get a coherent pm_active + * XXX critical sections disable interrupts again + */ + wbinvd(); + smp_cache_flush(); + if (smp_started) + mtx_unlock_spin(&smp_ipi_mtx); + else + critical_exit(); +} #else /* !SMP */ /* * Normal, non-SMP, invalidation functions. @@ -762,6 +786,13 @@ pmap_invalidate_all(pmap_t pmap) if (pmap == kernel_pmap || pmap->pm_active) invltlb(); } + +PMAP_INLINE void +pmap_invalidate_cache(void) +{ + + wbinvd(); +} #endif /* !SMP */ /* |