Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!cmcl2!ccnysci!alexis From: alexis@ccnysci.UUCP (Alexis Rosen) Newsgroups: comp.sys.mac.programmer Subject: How to do a LEGAL tail-patch Message-ID: <1272@ccnysci.UUCP> Date: 15 Feb 89 08:07:41 GMT Reply-To: alexis@ccnysci.UUCP (Alexis Rosen) Organization: City College of New York Lines: 19 I've been thinking about this for a couple of days now. Here's my scheme. Does anyone see any flaws? Procedure MyPatch SetTrapAddress to original trap address Trap to original trap using A-line instruction SetTrapAddress back to @MyPatch (&MyPatch for C people) Fixup stack and return It seems very simple. The only trick is that you have to store the original trap address in code-relative space (stick it after the end of the patch code). This is not a difficult thing to do, though it will break in a virtual-memory system (by that point there will have to be legitimate ways to do this anyway). So, what's the verdict? Alexis Rosen alexis@ccnysci.uucp