🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #2254

Re: Writing code at run-time

#2254
From: Andrew Derry
Date: Mon, 06 Jun 1994 23:28
23 lines
2282 bytes
iiitac@uk.ac.swan.pyr (Alan Cox) writes:

>1) will not work the way you want - you can't go off writing self modifying
>code or you'll get attacked by cache problems - especially on the newer chips.

You probably know more about this sort of thing than I do, but at
least from the '486 programmers reference (12.2.3 - Self-modifying Code):

     A write to an instruction in the cache will modify it in both
     cache and memory, but if the instruction was prefetched before
     the write, the old version of the instruction could be the one
     executed.  To prevent this, flush the instruction prefetch unit
     by coding a jump instruction immediately after any write that
     modifies an instruction. 

So at least on the '486 (don't have a Pentium reference, sorry), it's
not that one _can't_ do such things, but more that one has to be aware
of what's going on and deal with it appropriately.

Cheers

--
Andrew Derry - derry@sfu.ca
Technical Details
Message-ID: <telnet.770945312@sfu.ca>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!newsserver.sfu.ca!sfu.ca!telnet
References: <2suogv$s60@harbinger.cc.monash.edu.au> <1994Jun6.115625.10787@uk.ac.swan.pyr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10f6aa,e6b2b5751c2b9056
X-Google-Attributes: gid10f6aa,public
X-Google-Thread: fe306,e6b2b5751c2b9056
X-Google-Attributes: gidfe306,public
X-Google-Thread: 1103af,e6b2b5751c2b9056
X-Google-Attributes: gid1103af,public
X-Google-Thread: f9382,e6b2b5751c2b9056
X-Google-Attributes: gidf9382,public
X-Google-Thread: 102bfa,e6b2b5751c2b9056
X-Google-Attributes: gid102bfa,public
X-Google-Thread: 10a997,e6b2b5751c2b9056
X-Google-Attributes: gid10a997,public
X-Google-Thread: 102983,e6b2b5751c2b9056
X-Google-Attributes: gid102983,public
X-Google-ArrivalTime: 1994-06-06 16:41:31 PST
Newsgroups: rec.games.programmer,alt.uu.comp.os.linux.questions,aus.computers.linux,comp.os.linux,comp.os.linux.misc,alt.msdos.programmer,comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!nntp.gmd.de!xlink.net!howland.reston.ans.net!math.ohio-state.edu!cyber2.cyberstore.ca!nntp.cs.ubc.ca!newsserver.sfu.ca!sfu.ca!telnet
From: derry@beaufort.sfu.ca (Andrew Derry)
Subject: Re: Writing code at run-time
Message-ID: <telnet.770945312@sfu.ca>
Sender: news@sfu.ca (seymour news)
Organization: Simon Fraser University, Burnaby, B.C., Canada
References: <2suogv$s60@harbinger.cc.monash.edu.au> <1994Jun6.115625.10787@uk.ac.swan.pyr>
Date: Mon, 6 Jun 1994 23:28:32 GMT
Lines: 23