home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20345 < prev    next >
Encoding:
Text File  |  1992-12-28  |  1.9 KB  |  46 lines

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