home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!psinntp!panix!rmah
- From: rmah@panix.com (Robert Mah)
- Subject: Re: Problem with patch to HFSDispatch
- Message-ID: <1992Dec28.022559.2496@panix.com>
- Date: Mon, 28 Dec 1992 02:25:59 GMT
- References: <1992Dec22.182710.26751@panix.com> <absurd-221292190600@seuss.apple.com>
- Organization: PANIX Public Access Unix, NYC
- Lines: 35
-
- In <absurd-221292190600@seuss.apple.com> absurd@apple.apple.com (Tim Dierks, software saboteur) writes:
-
- >Your problem is that you're destroying A1; it's used as a parameter by
- >some HFSDispatch selectors.
-
- >While you could do this by trashing a different register, which isn't
- >used, you could always use the slightly more complex but somewhat more
- >clever method.
-
- > clr.l -(sp) ; save room for forwarding address
- >> movem.l a4, -(sp) ; save registers
- >> lea main, a4 ; setup globals
- >> cmp.w #5, d0 ; if not CatMove
- >> bne.s @1
- >> move.w #1, gNeedsUpdate ; set the gNeedsUpdate flag
- >> @1 move.l realHFSDispatchTrap,4(a7) ; store forwarding address on stack
- >> movem.l (sp)+, a4 ; restore registers
- > rts ; jump to real HFSDispatch
-
- >Note that this preserves all the registers by using the trick of using
- >an RTS to pop the jump address off of the stack, allowing you to restore
- >all your registers first.
-
- Thanks I'll try it and see how it works. But won't changing the return
- address mess up some toolbox things. I seem to recall that that was why
- "tail patches" were not allowed -- of course, I could be totally confused
- here :->
-
- Thanks again,
- Rob
- --
- [--------------------------------------------------]
- [ Robert S. Mah | "Every day an adventure, ]
- [ rmah@panix.com | every moment a challenge." ]
- [--------------------------------------------------]
-