Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ig!bionet!agate!ucbvax!decwrl!purdue!iuvax!rutgers!att!pegasus!ech From: ech@pegasus.ATT.COM (Edward C Horvath) Newsgroups: comp.sys.mac.programmer Subject: Re: XFCN/XCMD string in LSC C v3.0 Message-ID: <2786@pegasus.ATT.COM> Date: 14 Apr 89 02:57:02 GMT References: <22027@dhw68k.cts.com> Organization: AT&T ISL Middletown NJ USA Lines: 39 In article <6944@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >The processor doesn't know resources from racehorses. What it knows is >that there are lots of numbered memory locations, and it's ordered to >execute some of them. These it may cache. Others it won't, at least >not in the instruction cache. Stashing data in code space is *not* >self-modifying code. From article <22027@dhw68k.cts.com>, by thecloud@dhw68k.cts.com (Ken McLeod): > What happens on 68030 machines, which have both instruction and data > caches? What SHOULD happen, naturally! Listen carefully, and re-read as necessary: The PC is used to fetch instructions, from the cache if there's a hit, from RAM otherwise. ALL other memory references are to/from the data cache if there is one, and all writes to the data cache are write-thru. Thus, for example, when you save an A5 or A4 or whathaveyou value, it is written to the data cache (if any) and RAM. This is so simple that it is hard to screw up. That doesn't mean that, at some point, you won't run under an OS that write-protects what it believes to be code. When that happens, code from Aztec C or MPW C with the -b will still be fine: only constants (which you aren't going to modify, right?) are in codespace, and they can be write protected. An attempt to store an Ax reg in codespace will cause a memory exception and termination with extreme prejudice. But, as Tim Maroney observed, there are things like IO Completion routines that CAN'T operate any other way under the present Mac regime: they MUST store the global base reg in a pc-relative place. I suspect that Tim has correctly predicted the future as well: there will be a bit in the BNDL or SIZE resource that says the app will deal properly with being loaded at (virtual) address 0 (like the Unix model). Since data is always at the same (virtual) address with this model, all that remains is for the app to be able to tell how it's loaded, say by a flag in SysEnvirons. =Ned Horvath=