Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!umn-cs!berlin!grg From: grg@berlin.acss.umn.edu (George Gonzalez) Newsgroups: comp.sys.mac.programmer Subject: Re: How to do a LEGAL tail-patch Summary: Another way to (maybe) do a tail patch Message-ID: <293@berlin.acss.umn.edu> Date: 16 Feb 89 15:56:43 GMT References: <1272@ccnysci.UUCP> <6541@hoptoad.uucp> Organization: U of M MicroGroup, Minneapolis Lines: 24 I've thought about this problem too. Here's a scheme that might work. RealTrapAddr := GetTrapAddress( TheTrap ); SetTrapAddress( TheTrap, OurHookProc ); PokeLong( @MyTailPatch, SingleStepInterruptVector ); proc OurHookProc; ; gets called by the trap dispatcher. bset #TrapBit,XXX(SP) ; set single step trap bit in ret flags PushL RealReapAddress ; a registerless "jump" RTS ... the trap code runs, then when it returns, the CPU does a single step trap to your tail patch: proc MyTailPatch ... do my post processing... bclr #TrapBit,YYY(SP) ; turn off single stepping RTE Besides the obvious problem of being able to patch only one trap at a time, and needing different XXX and YYY offsets for 68000 and 68020+, this idea *might* just work.