diff options
author | sjg <sjg@FreeBSD.org> | 2013-09-11 18:16:18 +0000 |
---|---|---|
committer | sjg <sjg@FreeBSD.org> | 2013-09-11 18:16:18 +0000 |
commit | ff87b5d1477fd150ff715e5c3c2a205deb66804f (patch) | |
tree | a3620d99f472deaa7f019c4324bb8f4e38ac4272 /sys/amd64/include/cpufunc.h | |
parent | 62bb1062226d3ce6a2350808256a25508978352d (diff) | |
parent | 4d92de31b23f33109e1fa7f0b1499ed6c3501ee1 (diff) | |
download | FreeBSD-src-ff87b5d1477fd150ff715e5c3c2a205deb66804f.zip FreeBSD-src-ff87b5d1477fd150ff715e5c3c2a205deb66804f.tar.gz |
Merge head
Diffstat (limited to 'sys/amd64/include/cpufunc.h')
-rw-r--r-- | sys/amd64/include/cpufunc.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index 3d381c6..5f8197b 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -461,6 +461,34 @@ invltlb(void) load_cr3(rcr3()); } +#ifndef CR4_PGE +#define CR4_PGE 0x00000080 /* Page global enable */ +#endif + +/* + * Perform the guaranteed invalidation of all TLB entries. This + * includes the global entries, and entries in all PCIDs, not only the + * current context. The function works both on non-PCID CPUs and CPUs + * with the PCID turned off or on. See IA-32 SDM Vol. 3a 4.10.4.1 + * Operations that Invalidate TLBs and Paging-Structure Caches. + */ +static __inline void +invltlb_globpcid(void) +{ + uint64_t cr4; + + cr4 = rcr4(); + load_cr4(cr4 & ~CR4_PGE); + /* + * Although preemption at this point could be detrimental to + * performance, it would not lead to an error. PG_G is simply + * ignored if CR4.PGE is clear. Moreover, in case this block + * is re-entered, the load_cr4() either above or below will + * modify CR4.PGE flushing the TLB. + */ + load_cr4(cr4 | CR4_PGE); +} + /* * TLB flush for an individual page (even if it has PG_G). * Only works on 486+ CPUs (i386 does not have PG_G). |