On 28 December 2011 10:42, Avi Kivity <a...@redhat.com> wrote: > It's possible to check for an interrupt before every instruction, > without any overhead: > > - when a signal arrives, check the instruction pointer. If it points > outside tcg code, set a flag and return. > - consult a table indexed by the instruction pointer, that gives the > number of bytes to the next guest instruction boundary > - if nonzero, set a breakpoint at that boundary, and resume > - remove the breakpoint (if set) > - adjust the TB to return on the current instruction pointer > - return
This assumes you have hardware breakpoints on your host, so it's not portable. (You also need to add a check-and-handle-flag for every return from a helper function to TCG code, and of course you need to actually create the instruction-boundary table. These are both overheads.) -- PMM