home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!enterpoop.mit.edu!eru.mt.luth.se!kth.se!hemul.nada.kth.se!d88-jwa
- From: d88-jwa@hemul.nada.kth.se (Jon Wtte)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Problem with patch to HFSDispatch
- Message-ID: <1992Dec23.110545.7251@kth.se>
- Date: 23 Dec 92 11:05:45 GMT
- References: <1992Dec22.182710.26751@panix.com>
- Sender: usenet@kth.se (Usenet)
- Organization: Royal Institute of Technology, Stockholm, Sweden
- Lines: 40
- Nntp-Posting-Host: hemul.nada.kth.se
-
- In <1992Dec22.182710.26751@panix.com> rmah@panix.com (Robert Mah) writes:
-
- >I'm using register a1 to hold the adress of the real trap -- is there
- >something wrong with this? Anyone care to comment?
-
- >@1 move.l realHFSDispatchTrap, a1 ; grab the addr of the real thing
- > movem.l (sp)+, a4 ; restore registers
- > jmp (a1) ; jump to real HFSDispatch
-
- Yes, this trashes register a1.
-
- Instead, you should "reserve space" on the stack for the
- chain address, save the registers, do your thing, put
- the registers back into shape and RTS _to_the_next_routine_.
-
- Something like:
-
- subq #4, a7
- movem.l a1/a4, -(a7)
- ...
- do stuff
- ...
- move.l realHFSDispatchTrap, a1
- move.l a1, 8(a7)
- movem.l (a7)+, a1/a4
- rts
-
- Note that this _IS_ a head patch, since the "RTS" actually
- is used as a jump to the next function, leaving stack and
- registers intact.
-
- Cheers,
-
- / h+
-
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
- "It was, in fact, cool as all get-out. Fortunately it was a little
- too late (historically speaking) to be groovy."
- -- Dennis Pelton
-