home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20239 < prev    next >
Encoding:
Internet Message Format  |  1992-12-23  |  1.6 KB

  1. Path: sparky!uunet!enterpoop.mit.edu!eru.mt.luth.se!kth.se!hemul.nada.kth.se!d88-jwa
  2. From: d88-jwa@hemul.nada.kth.se (Jon Wtte)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: Problem with patch to HFSDispatch
  5. Message-ID: <1992Dec23.110545.7251@kth.se>
  6. Date: 23 Dec 92 11:05:45 GMT
  7. References: <1992Dec22.182710.26751@panix.com>
  8. Sender: usenet@kth.se (Usenet)
  9. Organization: Royal Institute of Technology, Stockholm, Sweden
  10. Lines: 40
  11. Nntp-Posting-Host: hemul.nada.kth.se
  12.  
  13. In <1992Dec22.182710.26751@panix.com> rmah@panix.com (Robert Mah) writes:
  14.  
  15. >I'm using register a1 to hold the adress of the real trap -- is there
  16. >something wrong with this?  Anyone care to comment?
  17.  
  18. >@1      move.l   realHFSDispatchTrap, a1   ; grab the addr of the real thing
  19. >        movem.l  (sp)+, a4                 ; restore registers
  20. >        jmp      (a1)                      ; jump to real HFSDispatch
  21.  
  22. Yes, this trashes register a1.
  23.  
  24. Instead, you should "reserve space" on the stack for the
  25. chain address, save the registers, do your thing, put
  26. the registers back into shape and RTS _to_the_next_routine_.
  27.  
  28. Something like:
  29.  
  30.     subq #4, a7
  31.     movem.l    a1/a4, -(a7)
  32.     ...
  33.     do stuff
  34.     ...
  35.     move.l realHFSDispatchTrap, a1
  36.     move.l a1, 8(a7)
  37.     movem.l (a7)+, a1/a4
  38.     rts
  39.  
  40. Note that this _IS_ a head patch, since the "RTS" actually
  41. is used as a jump to the next function, leaving stack and
  42. registers intact.
  43.  
  44. Cheers,
  45.  
  46.                         / h+
  47.  
  48. -- 
  49.  -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
  50.   "It was, in fact, cool as all get-out.  Fortunately it was a little
  51.    too late (historically speaking) to be groovy."
  52.                      -- Dennis Pelton
  53.