gorlick (04/22/83)
}
Now will someone please explain why this fix works. Many thanks in
advance.
-Michael Gorlick-
{decvax, ucbvax}!trw-unix!gorlick
charliep@tekgds.UUCP (08/01/83)
I looked all over the code for exec in /sys/sys/sys1.c to try to see where control is actually transferred to the new image in memory. I found everything else but what I was looking for. Then I convinced somebody else with more experience to take a look and he couldn't find it either. Q. Where IS control transferred to the new image? A. (will be posted if there are others who are also interested). Please send your suggestions to me via mail. Charles Perkins Graphic Design Systems Tektronix PS. Why do people write code as if they thought others enjoyed the challenge of figuring out what it does? I like treasure hunts and clues too, but I have work to accomplish! Responses to net.flame!
ron%brl-bmd@sri-unix.UUCP (08/02/83)
From: Ron Natalie <ron@brl-bmd> Depending on your version of UNIX, down near the end of exec will code to set it after it zeros all the registers it will set u.u_ar0[R7] to zero, so that when the system returns to user mode it will start at zero. In newer versions, the loop that clears the registers is replaced with a call to setregs. In the middle of set regs it sets u.u_ar0[PC] to the starting address specified in the a.out header. -Ron
akmal@nosc@syte.UUCP (08/05/83)
The answer to your question is fairly obvious if you have studied the code ! If you look at the bottom of setregs, the PC is set to the entry point for the code. Thus when you return from the call with an RTI, user execution commences at the new PC. Why does that particular section strike you as a treasure hunt ??!! Perhaps you need to 'C' things better !!