Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!apple.com!chewy From: chewy@apple.com (Paul Snively) Newsgroups: comp.sys.mac.programmer Subject: Re: Tail patches Message-ID: <5080@internal.Apple.COM> Date: 8 Nov 89 17:34:28 GMT Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 36 References:<1459@sequent.cs.qmc.ac.uk> <36250@apple.Apple.COM> <5056@internal.Apple.COM> <1989Nov7.212837.5146@oracle.com> In article <1989Nov7.212837.5146@oracle.com> omullarn@oracle.oracle.com (Oliver Mullarney) writes: > OK - I understand why we shouldn't use tail patches, but sometimes > you just gotta. How else can you catch a function result from a > trap call? > Now why doesn't Apple keep everyone happy by being a little bit > more inventive in their scheme for hacking patches called by traps > called by patches called by ... > Instead of maintaining hard coded return addresses (a bad move anyway, > considering TN 110, "Processor Compatibility", final para.) it would > be possible to examine the trap table for the address of the trap of > interest (in case it has been patched), scan forward from this address > to find the RTS, and check to see if the return address on the stack > lies between the trap/patch start and the RTS. Not lightning fast, but... > Maybe in the 50Hz machine we wouldn't even notice. As for "sometimes you just gotta," all I can say is: don't do whatever it is you're doing that's "just gotta." Find a "more inventive" way. As for finding the trap address and looking "just within that trap" for the return address, I can only assume that you've never disassembled our ROMs. Essentially what you're saying is that we should write a 680x0 global flow-analysis routine that gets called for EVERY patch in the system. Even at 50 MHz that would be UNBELIEVABLY slow, and that's assuming that your flow-analysis heuristic for 680x0 code was totally flawless. Anyone here ever write a 680x0 flow-analysis program (Steve Jasik excepted)? Didn't think so. Don't tail patch. __________________________________________________________________________ Just because I work for Apple Computer, Inc. doesn't mean that they believe what I believe or vice-versa. __________________________________________________________________________ C++ -- The language in which only friends can access your private members. __________________________________________________________________________