x86 WBINVD prefix allocations
Christian Ludloff <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <CAKSQd8V-m4oi-JhyxH3Y4KsLhf_CNFaVqbyJbNdd237FspndGA@mail.gmail.com> |
If the use of x86 prefixes on WBINVD is not of your concern, you can stop reading. -------------------- 8< ------------------- I was asked to relay this to binutils/LKML. Existing Behavior ----------------- WBINVD has been using opcode 0x0F,0x09 ever since the 486 days, to perform a write back and invalidation of the on-chip cache. WBNOINVD -- that is, using WBINVD with 0xF3 as a prefix to hint that the INVD operation should be skipped -- was added a while ago, with a CPUID flag, by AMD, then Intel. When not supported, a normal WBINVD ensues. New Skip Hints -------------- As of 2025, the following are in active use by a corporate entity other than Intel/AMD; therefore they shouldn't be redefined. 0x67 = no CODE hint => skip L0i/L1i cache 0x66 = no DATA hint => skip L0d/L1d cache 0xF3 = no INVD hint => skip invalidations 0xF2 = no LLC hint => skip LLC cache While CODE and DATA hint that the operation should skip code and data caches, LLC hints that the operation should skip a last-level cache, and INVD does remain unchanged. More New Hints -------------- In addition the six implementation-specific hints select up to six or 2^6=64 behaviors, depending on the particular processor. 0x26 = ES implementation-specific hint 0x2E = CS implementation-specific hint 0x36 = SS implementation-specific hint 0x3E = DS implementation-specific hint 0x64 = FS implementation-specific hint 0x65 = GS implementation-specific hint One particular implemention might use these to target CODE vs DATA vs STREAMING STORES, as well as cache level L1 vs L2 vs L3. Another particular implementation might use these to target programmable behavior. Miscellaneous ------------- All ten prefixes can be combined, resulting in an instruction up to 12 bytes long. The LOCK prefix remains unchanged; that is, with WBINVD it causes a #UD exception. No new CPUID flag is introduced. If the new hints are not supported, classic WBINVD and WBNOINVD behavior ensues, as expected. I have updated https://sandpile.org/x86/opc_2.htm to reflect all these new WBINVD hints. -------------------- 8< ------------------- -- C.