|
From: Jeremy F. <je...@go...> - 2003-11-19 21:06:59
|
On Wed, 2003-11-19 at 07:48, Nicholas Nethercote wrote: > The support for self-modifying code was removed because, IIRC, it was > clunky and rarely needed, and the VALGRIND_DISCARD_TRANSLATIONS macro was > good enough for eg. JIT-compilers and other programs that generate code at > runtime. > > But if runtime code-generation occurs and the user doesn't even realise > it, that's bad. It should be easy enough to tell when this is happening and we need to be extra-careful. If vg_translate finds itself reading instructions from near the %ESP, then we should note that we have cached code for the stack, and we need to be paranoid about stack writes/%ESP movement. Question: does gcc move %ESP up over the generated thunk when it is finished with it, or does it just overwrite the code? Presumably on other architectures it generates an icache invalidate for the memory it's modifying, which would be our cue to do something sensible. Pity x86 does all that stuff implicitly... J |