Newsgroups: comp.arch
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Self-modifying code
Message-ID: <1988Jul23.232604.22919@utzoo.uucp>
Organization: U of Toronto Zoology
References: <5254@june.cs.washington.edu> <76700032@p.cs.uiuc.edu> <1276@edge.UUCP> <361@scolex> <572@tuck.nott-cs.UUCP>
Date: Sat, 23 Jul 88 23:26:04 GMT

In article <572@tuck.nott-cs.UUCP> anw@maths.nott.ac.uk (Dr A. N. Walker) writes:
>...self-initialising random number generator.  First time through, it
>initialised itself, either from the clock or from the user-supplied seed,
>then pulled the real code in on top of itself...

Let us not forget, also, that self-modifying code wasn't uncommon in
bootstraps, back in the days when ROMs were expensive or unavailable.
The disk bootstrap for a late-model PDP-8 was two instructions, so
brief that nobody ever bothered putting it in ROM, and it was about
as self-modifying as you could get:  power-up-reset happened to leave
the disk controller in just the right state for reading block 0 into
memory starting at 0, so the bootstrap -- toggled in at a specific place
in low core -- was "kick the disk controller; branch to self".  It
got overwritten as block 0 came in, and of course block 0 was carefully
crafted to catch control as the "branch to self" was overwritten!
-- 
Anyone who buys Wisconsin cheese is|  Henry Spencer at U of Toronto Zoology
a traitor to mankind.  --Pournelle |uunet!mnetor!utzoo! henry @zoo.toronto.edu
