On Tue, 22 Aug 2006 16:12:32 +1000 Rusty Russell <rusty at rustcorp.com.au> wrote: > It turns out that the most called ops, by several orders of magnitude, > are the interrupt manipulation ops. These are obvious candidates for > patching, so mark them up and create infrastructure for it. > > The method used is that the ops structure has a patch function, which > is called for each place which needs to be patched: this returns a > number of instructions (the rest are NOP-padded). > > Usually we can spare a register (%eax) for the binary patched code to > use, but in a couple of critical places in entry.S we can't: we make > the clobbers explicit at the call site, and manually clobber the > allowed registers in debug mode as an extra check. Looks good to me. > + > + /* Sync in case we patched this coming "sti" last. */ > + sync_core(); I guess this needs more comments -- in particular that it is only safe because the other CPUs are not executing any of this yet and preempt does synchronize anyways. -Andi