From: "ben franchuk"
<bfranchuk(a)jetnet.ab.ca>
Peter C. Wallace wrote:
Isn't self modifying code pretty much
deprecated these days (aside from
trampolines and such)
So what is a trampoline?
Peter Wallace
I have yet to see a good use for self-modifying code. Other than
subroutines and interupts placing data into a code segement the only
self modifying code I have seen was for the 8088.
Ben.
Hi
It is interesting that different people have different ideas
as to what self modifying code is. Actually, the ability to
load code and execute from a mass storage is self modifying.
Code that uses a variable value for a table to look up execution
addresses is self modifying. Most every multitasking system
I've seen are self modifying.
I think what people consider dangerous self modifying is
when the program alters the actual execution instructions in
memory and then executes them. It is strange that this form
gets such a large amount of emotional negative response while
other types are hardly considered issues.
No matter how the code is written, one can make bad code in
most any form. One can also make good code as well. There is
no reason why self modifying code should be any more dangerous
than any other type of coding if done with a complete understanding
of what the limitations are. What is the difference between
replacing one or two instructions and then executing them or
replacing an overlay and then executing that overlay? Other
than size, both are doing the same thing. One is forbidden
while the other is normal operation.
Dwight