From owner-freebsd-current Fri Feb 2 10:28:24 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id KAA10193 for current-outgoing; Fri, 2 Feb 1996 10:28:24 -0800 (PST) Received: from Root.COM (implode.Root.COM [198.145.90.17]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id KAA10024 for ; Fri, 2 Feb 1996 10:25:18 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by Root.COM (8.6.12/8.6.5) with SMTP id KAA07931; Fri, 2 Feb 1996 10:25:17 -0800 Message-Id: <199602021825.KAA07931@Root.COM> X-Authentication-Warning: implode.Root.COM: Host localhost didn't use HELO protocol To: KATO Takenori cc: current@FreeBSD.org Subject: Re: TSS broken In-reply-to: Your message of "Sat, 03 Feb 1996 02:15:50 +0900." <199602021715.CAA00247@marble.eps.nagoya-u.ac.jp> From: David Greenman Reply-To: davidg@Root.COM Date: Fri, 02 Feb 1996 10:25:17 -0800 Sender: owner-current@FreeBSD.org Precedence: bulk >> 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