Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!vu-vlsi!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: How can a CDEV "talk" to its INIT? Message-ID: <1989Dec13.132242.18502@cs.swarthmore.edu> Date: 13 Dec 89 13:22:42 GMT References: <8183@cs.yale.edu> <1617@intercon.com> Reply-To: jackiw@cs.swarthmore.edu (Nick Jackiw) Organization: Visual Geometry Project, Swarthmore College, PA Lines: 43 amanda@mermaid.intercon.com (Amanda Walker) writes: > In article <8183@cs.yale.edu>, kishon-amir@CS.Yale.EDU (amir kishon) writes: > > How can I have both the CDEV and the patch (INIT) point to the same > > global variables, so the CDEV can change those values? Or are there > > any other ways to do that? > > Well, your INIT could install a little driver that accepted control calls > to change your variables. This seems like the simplest way to me. Drivers > actually aren't any harder than INITs as long as they don't actually do > I/O :-)... > > Amanda Walker > InterCon Systems Corporation > -- Another popular method is to have the INIT allocate these globals in a block in the system heap. The first component of this block should be some sort of identification code with an extremely high probability of being unique within the system heap. (A good bet is a string containing your CDEV's name, your name, and your mother's name, separated by abstruse control characters...) Then when your CDEV needs to find the appropriate variables, you step through each block in the heap (not at all difficult, cf. IM#II:20-25) and check if the block has your "signature string" at the beginning, assume its your global variables. Check them for reasonableness, appropriate size, and proceed with caution. PowerStation uses this technique, for instance. [Some people shudder at this notion, because you are "guessing" where your globals are. On the other hand, the limit of probability is certainty, and if your signature is more than a few bytes, the chance of some random bitpattern matching it rapidly reaches the 1-in-billions-and-billions. For ultimate saftey, you could walk through the rest of the system zone and confirm that no one else has a block starting with that signature. If they do, how your cdev chooses to wig out in a big way is up to you.] -- _ _|\____ Nick Jackiw | Visual Geometry Project | Math Department / /_/ O> \ ------------+-------------------------+ Swarthmore College | O> | 215-328-8225| jackiw@cs.swarthmore.edu| Swarthmore PA 19081 \_Guernica_/ ------------+-------------------------+ USA