Harvard vs. vonNeuman

From: Paul Koning <pkoning_at_equallogic.com>
Date: Tue Sep 28 13:23:24 2004

>>>>> "Dwight" == Dwight K Elvey <dwight.elvey_at_amd.com> writes:

 Dwight> Hi It is interesting that different people have different
 Dwight> ideas as to what self modifying code is. Actually, the
 Dwight> ability to load code and execute from a mass storage is self
 Dwight> modifying.

Indeed.

 Dwight> Code that uses a variable value for a table to
 Dwight> look up execution addresses is self modifying.

Not as the term is usually used. You're changing a pointer, and
pointers are data. Ask yourself "do I have to flush the I-cache for
this to work?" The answer in this case is NO.

 Dwight> Most every
 Dwight> multitasking system I've seen are self modifying. I think
 Dwight> what people consider dangerous self modifying is when the
 Dwight> program alters the actual execution instructions in memory
 Dwight> and then executes them. It is strange that this form gets
 Dwight> such a large amount of emotional negative response while
 Dwight> other types are hardly considered issues. No matter how the
 Dwight> code is written, one can make bad code in most any form.

True.

Part of the issue, for modern machines, is that the hardware gets in
the way. If you change code, the I-cache doesn't change (in machines
I'm familiar with) so the old instruction may still execute. This
makes instruction modification a tricky business. Debuggers do it,
operating systems do it -- and both have to pay attention to all the
cache magic you have to perform for it to be right.

      paul
Received on Tue Sep 28 2004 - 13:23:24 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:32 BST