keith@ssc-vax.UUCP (Keith Nemitz) (08/12/86)
I am just now completing a port of the Icon programming language to the Macintosh and the last thing to be implemented is the context switching. My problem is that Icon keeps track of it's own stacks with in the heap, and suprise of suprises, the stack sniffer on the mac keeps blowing me out of the water. Doing my own heap zones would be very difficult to surgically implant into the Icon source, and I'm sure MPW wouldn't like it's tools to do that. My only hope is to turn off the blasted sniffer. Can someone help me? I can't imagine that Apple would allow a marginally useful thing like the stack sniffer to be undisableable (???) ** It has been said that if you give a man enough rope, he will hang himself. ** We sell rope ** keith uw-beaver!ssc-vax!keith
shebanow@ernie.Berkeley.EDU (Mike Shebanow) (08/14/86)
(la de da de da) There is a low memory global called StkLowPt (address $110) which contains the address of the lowest value of SP detected by the stack sniffer. A while ago, someone posted a note saying that the stack sniffer could be disabled by setting this variable to 0 or -1 (I forget which). Good Luck... Andrew Shebanow
tim@hoptoad.uucp (Tim Maroney) (08/14/86)
Mark Sherman ran into this problem when he was doing the original MacIP multitasking, and I am currently doing a UNIX-like multitasking system for the Mac and working on the same problem. I have not yet actually tried to disable the stack sniffer, but here are some approaches: (1) Patch SysError to return when it is called with the relevant error. This would likely not be an RTS, but a trickier stack pop. Problem: future ROM versions. (2) Find the sniffer task in the retrace queue and remove it. It would have to be found by hand for each version of the ROM, and an INIT resource installed that removed the appropriate task depending on ROM version. problem: future ROM versions. (3) Laborious but possibly workable solution: remove each task from the vertical retrace queue (inside an INIT resource) and then put them back, running each as the only task in the queue. While doing this, run your stack in the application heap. When one is running, SysError will be called with the appropriate error status. Patch SysError to hand control back to your INIT resource and bingo, you've found the stack sniffer. This isn't so hot if Apple decides to hard-wire the sniffer into the vertical retrace manager or something equally gross. (4) Do what Mark did in MacIP: allocate your stacks from the stack region, above the application heap. This could be done either using your own allocation routines (as Mark did) or by creating a new heap zone above the application heap and below the main stack (which I always meant to do but never got around to). (5) Make the application run in user mode on the 68000 and create a separate system stack. Then the vertical retrace interrupt will shift onto the system stack, which you can set to be above BufPtr somewhere. This requires a lot of hard work, hacking the trap dispatcher. (6) Depending on your environment, you can fool it in other ways. For instance, you might be able to dispense with an application heap entirely, setting the low-memory globals to some low value, so the stack sniffer will be fooled. I hope this helps. Unfortunately, Apple did not include any documented way to disable the stack sniffer. -- Tim Maroney, Electronic Village Idiot {ihnp4,sun,well,ptsfa,lll-crg,frog}!hoptoad!tim (uucp) hoptoad!tim@lll-crg (arpa) Give me food, or give me slack (or kill me).
dwb@well.UUCP (David W. Berry) (08/14/86)
In order to disable the stack sniffer write a 0 to the long at 0x110 (StkLowPt). -- David W. Berry dwb@well.uucp dwb@Delphi dwb@GEnie 293-0752@408.MaBell
lsr@apple.UUCP (08/18/86)
In article <827@ssc-vax.UUCP> keith@ssc-vax.UUCP (Keith Nemitz) writes: > >My problem is that Icon keeps track of it's own stacks with in the heap, and >suprise of suprises, the stack sniffer on the mac keeps blowing me out of the >water. > >My only hope is to turn off the blasted sniffer. Can someone help me? > I can't imagine that Apple would allow a marginally useful thing like the >stack sniffer to be undisableable (???) You can turn off the "stack sniffer" by setting the low memory global StkLowPt to 0. The VBL interrupt routine stores the "low-water" stack point in this variable, and compares it to the end of the application heap. Be sure to re-enable this by setting it to FFFFFFFF when your application leaves. -- Larry Rosenstein Object Specialist Apple Computer AppleLink: Rosenstein1 UUCP: {sun, voder, nsc, mtxinu, dual}!apple!lsr CSNET: lsr@Apple.CSNET