Date: Fri, 02 Feb 1996 10:25:17 -0800 From: David Greenman <davidg@Root.COM> To: KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp> Cc: current@FreeBSD.org Subject: Re: TSS broken Message-ID: <199602021825.KAA07931@Root.COM> In-Reply-To: Your message of "Sat, 03 Feb 1996 02:15:50 %2B0900." <199602021715.CAA00247@marble.eps.nagoya-u.ac.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
>> you've misunderstood the operation of the 'leal' instruction. The >> code as I've written it appears to be correct. > >Your code depends on compiler options. > >I know the kernel should be compiled only with '-O', but I usually do >with -fomit-frame-pointer option. After I applied the change of >swtch, the kernel compiled with -fomit-frame-pointer causes panic. > >When cpu_switch restores context, saved eip is restored as > movl PCB_EIP(%edx),%eax > movl %eax,(%esp) >After this operation caller address of savectx overwrites argument to >savectx. So esp of child process just after 'call _savectx' points >the argument to bcopy. You are right. I didn't realize that cpu_switch() clobbers the top of stack with the EIP and then does a return, making the assumption that the return address wasn't previously popped off. The change I made is wrong - I didn't realize the interaction between cpu_fork and cpu_switch. I'll back out that change. -DG David Greenman Core Team/Principal Architect, The FreeBSD Project
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602021825.KAA07931>