Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!mtxinu!sybase!okra!dg From: dg@okra.sybase.com (David Gould) Newsgroups: comp.sys.mac.programmer Subject: Re: XFCN/XCMD string in LSC C v3.0 Keywords: A4-relative data, blessing or curse? Message-ID: <3756@sybase.sybase.com> Date: 9 Apr 89 23:31:33 GMT References: <12964@dartvax.Dartmouth.EDU> <28737@ucbvax.BERKELEY.EDU> <12968@dartvax.Dartmouth.EDU> <6944@hoptoad.uucp> Sender: news@sybase.sybase.com Reply-To: dg@okra.UUCP (David Gould) Organization: Sybase, Inc. Lines: 35 In article <6944@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >In article <12968@dartvax.Dartmouth.EDU> earleh@eleazar.dartmouth.edu (Earle >R. Horton) writes: >> Several problems exist with this approach. The chief one is >>writing to the code resource. This is bad. It can lead to strange >>bugs on 68020 machines. > >Sorry, Earle, you're generally one of the better informed voices here >and one well worth reading, but you seem to be having a bad luck streak >this week. There would only be a problem if the address where A4 is >stashed were executed. That's the only way the address could find >its way into the instruction cache and cause problems: by being executed. >Since it's just being handled as data, there's no problem. [ other cogent discussion omitted...] >Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim Sorry, Tim, but Earle is right, even if for the wrong reasons. In a protected or virtual memory environment, it is very common to use the MMU to map 'pure' code and constant data pages as read only. - Pure code and data pages can be shared by all programs without using extra physical memory. - The paging mechanism knowns in advance that pure pages will never be written to the pagefile, so it doesn't need pagefile space for them. - It helps system reliability to have OS enforced memory access protection. This helps catch pointer runaways and other system subversion (eg virii). It is quite likely that in Apple's future multitasking virtual memory system that code resources will be mapped read only. Thus, under system N.0 (for some large N) any code that writes on code resources will break. ...dg David Gould Sybase, Incorporated (415) 596-3414 sybase!dg@sun.com 6475 Christie Ave. Emeryville, CA 94608 {sun,lll-tis,pyramid,pacbell}!sybase!dg