Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!samsung!usc!oxy!sonenbli From: sonenbli@oxy.edu (Andrew D. Sonenblick) Newsgroups: comp.sys.mac.programmer Subject: converting tail patches to head patches... Message-ID: <63359@tiger.oxy.edu> Date: 26 Nov 89 20:44:05 GMT Distribution: usa Organization: Occidental College, Los Angeles, CA 90041 Lines: 53 Ok, with the recent barage of bonfires (ie, big flaming going on) against tail patches, I have been trying to convert some of my tail patches to head patches. However, I have as yet been unseccessful and would appreciate it if all you major hackers would look at my code snipets and comment on them... (ie, tell me what is wrong!) How things were in the Tail Patch: myPatch() { ... doMyStuff(); asm{ Lea @1,A0 <- @1 contains the address of _SysTask via NGet... Move.L (A0),A0 Jsr (A0) } /* this is a tail patch since I jsr to _SysTask instead of Jmp */ ... } Now, how I changed things for to make it a head patchy-watchy... myPatch() { long rtsAddr; asm{ Move.L (SP)+,rtsAddr /* save return address in rtsAddr */ } doMyStuff(); asm{ Move.L rtsAddr,-(SP) Lea @1,A0 Move.L (A0),A0 Jmp (A0) } } Ok, so, what's the ups with this? (I have tried all sorts of things similar to this--most just make my mac hang, some crash, none works.) Needless to say, if anyone has insights into this, I--perhaps others on the net would too--would appreciate the help. Thanks, much. Ando Sonenblick: sonenbli@oxy.edu ________________________________________________________________________________ Have you ever tried to interpret the sound of your floppy drives: mine sound like "whumpa, whumpa, grind, grind," which I interpret to mean "Disregard every third work by Neitzche..."