Andi Kleen wrote: >> Relying this on current processors is fine, but I >> don't believe it is guaranteed to never break on future cores. >> > > It is - unless they implement something else that's not x86. > Actually it's not. You need a jump or a serializing instruction. You're fine with modules because you have a jump in between, so it is hard to make this actually be a problem (but my VMI patches got dangerously close). Volume 3A, section 7.1.3: To write self-modifying code and ensure that it is compliant with current and future versions of the IA-32 architecture, one of the following two coding options must be chosen: (* OPTION 1 *) Store modified code (as data) into code segment; Jump to new code or an intermediate location; Execute new code; (* OPTION 2 *) Store modified code (as data) into code segment; Execute a serializing instruction; (* For example, CPUID instruction *) Execute new code; (The use of one of these options is not required for programs intended to run on the Pentium or Intel486 processors, but are recommended to insure compatibility with the Pentium 4, Intel Xeon, and P6 family processors.)