Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!ames!oliveb!tymix!antares!jms From: jms@antares.UUCP (joe smith) Newsgroups: comp.arch Subject: Re: Self Modifying Code Summary: Writing in routine preserves registers Keywords: writing return address to routine front Message-ID: <113@antares.UUCP> Date: 21 Jul 88 06:36:39 GMT References: <5254@june.cs.washington.edu> <76700032@p.cs.uiuc.edu> <361@scolex> <2317@pt.cs.cmu.edu> <60742@sun.uucp> Reply-To: jms@antares.UUCP (joe smith) Organization: Tymnet QSATS, San Jose CA Lines: 22 The PDP-10 still uses JSR to write the return address at the front of the routine, but only when absolutely necessary. Normal calls us the recursive/reentrant mechanism of pushing the return PC on the stack, but the debugger (DDT) can't do that. Since programs can use anywhere from 0 to 16 different stack pointers, there is no such thing as "the" stack. The usual use for JSR is to save all accumulators in memory before setting up a private stack for processing the breakpoint. This even works in exec mode on an SMP (symmetric multi processor) system as long as each CPU maps the same virtual address of the return PC word to different physical addresses. The main point I'm trying to make is that the PDP-10 gives us the option of storing the return PC in memory, in an accumulator, or on the stack, allowing the programmer to choose whichever option is best suited to the task at hand. Having a small impure section of the program is reasonable under certain circumstances. -- +-----------------------------------------------------------------------------+ | TYMNET: JMS@F29 UUCP: {ames|pyramid}oliveb!tymix!antares!jms | | INTERNET: JMS%F29.Tymnet@Office-1.ARPA PHONE: Joe Smith @ (408)922-6220 | +-----------------------------------------------------------------------------+