Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!uokmax!munnari.oz.au!murtoa.cs.mu.oz.au!rob From: rob@cs.mu.oz.au (Robert Wallen) Newsgroups: comp.sys.mac.programmer Subject: Re: Access global variables from trap patches? Message-ID: <3112@murtoa.cs.mu.oz.au> Date: 25 Sep 90 22:15:06 GMT References: <1990Sep24.231618.29949@ifi.uio.no> Reply-To: rob@murtoa.UUCP (Robert Wallen) Organization: Comp Sci, Melbourne Uni, Australia Lines: 21 In article <1990Sep24.231618.29949@ifi.uio.no> pers@ifi.uio.no (Per Siljubergs}sen) writes: >I'm writing an extension to the system. It includes INIT >code, VBL task and a couple of trap patches. I need global >data so that the INIT and the patches can communicate. > 1) Save the A5 or the handle directly into my stand-alone > code resource. Will this work with new processors like > 68030 and 68040? These processors have intruction > cache on the chip. Isn't this solution almost like > selfmodifying code? I store globals like that at a known offset from by VBL control block and just walk along the VBLQueue looking for a key signature which identifies it. Seems to work fine for my cdev/INIT combination where I use a VBL with a 9 second timer (biggest figure I could fit -- I dont need the VBL except for mapping between cdev and INIT) There shouldnt be a CPU data/code protection problem because the control block is DATA and thus the code is not self-modifying. Even if it were though, you should be able to use whatever mechanism Apple implements which allows code to read in code resources from files (at which point they are data) and then map them to code -- iff this sort of memory protection ever arrives that is..