interchangeability of code and data (was Re: Insecure hardware)

David Goodenough dg at lakart.UUCP
Thu Dec 1 08:27:17 AEST 1988


>From article <1988Nov28.204018.2079 at utzoo.uucp>, by henry at utzoo.uucp (Henry Spencer):
> One should remember that dynamic code generation (necessarily into the
> data space) followed by execution of the resulting code can be a very
> valuable technique for things like interpreters.  One can finesse that
> with a "change data to code" system call, but the system-call overhead
> can hurt badly.

I have to smile a tiny little bit (maybe 1% :-) ) at the comments about
separating data and code. Way back when in 1944 (or thereabouts) when
John Von Neumann & Co. were doing things with the Eniac, someone came
up with a rather clever idea: Why not put the programs in the same memory
as the data ....... the rest (as they say) is history. [1]

[1] Don't quote me on this, it's about 10 years since I took the history
of computing course at university - my memory has got a bit rusty over the
years.

Seriously, I can think of one place where allowing dynamic code generation
has saved me (i.e. Self modifying code) - when writing a single step
utility for a nameless 8 bit micro. Trying to do conditional jumps
without S.M.C. would have been horriffic, as it was I just "patched"
a subroutine w/ the conditional jump I was testing and ..... But then
of course, I'm one of those slightly strange programmers that still uses
assembler when the need arises (Can you handle interrupts from 8 uarts
for incoming data at 38.4 Kbaud in C - I didn't think you could.)
-- 
	dg at lakart.UUCP - David Goodenough		+---+
							| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at harvard.harvard.edu	  	  +---+



More information about the Comp.lang.c mailing list