-tlb_flush_global(void) {
- uintptr_t cr4 = get_cr4();
- pmap_assert(ml_get_interrupts_enabled() == FALSE || get_preemption_level() !=0);
- pmap_assert2(((cr4 & CR4_PGE) || ml_at_interrupt_context()), "CR4: 0x%lx", cr4);
- /*
- * We are, unfortunately, forced to rely on this expensive
- * read-modify-write-write scheme due to the inadequate
- * TLB invalidation ISA. The read is necessary as
- * the kernel does not "own" the contents of CR4, the VMX
- * feature in particular. It may be possible to
- * avoid a global flush and instead track a generation
- * count of kernel invalidations, but that scheme
- * has its disadvantages as well.
- */
- if (cr4 & CR4_PGE) {
- set_cr4(cr4 & ~CR4_PGE);
- set_cr4(cr4 | CR4_PGE);
- } else {
- set_cr3_raw(get_cr3_raw());
- }
- return;
-}
-
-static inline void pmap_pcid_invalidate_all_cpus(pmap_t tpmap) {