Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!apple!oracle!news From: omullarn@oracle.oracle.com (Oliver Mullarney) Newsgroups: comp.sys.mac.programmer Subject: Re: Tail patches Summary: Tail patching - if enough of us do it... Keywords: Patches, Tails, "The Right Thing To Do" Message-ID: <1989Nov7.212837.5146@oracle.com> Date: 7 Nov 89 21:28:37 GMT References: <1459@sequent.cs.qmc.ac.uk> <36250@apple.Apple.COM> <5056@internal.Apple.COM> Reply-To: omullarn@oracle.com (Oliver Mullarney) Followup-To: comp.sys.mac.programmer Organization: Oracle Corporation, Belmont, CA Lines: 25 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. While on the subject, anyone out there got assembly to do stack crawling? I need it for some of my tail patches... :-) (No, really - I would be grateful if someone's done it already, and wants to share their experience). Oliver | Oliver Mullarney | "I have knowledge of Digital Watches, and soon I | | Oracle Corporation | shall have knowledge of Video Cassette Recorders" | | omullarn@oracle.com | Time Bandits | --------------- "Universally acknowledged to work just fine" ----------------