From owner-freebsd-current Fri Feb 2 09:16:33 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA03229 for current-outgoing; Fri, 2 Feb 1996 09:16:33 -0800 (PST) Received: from marble.eps.nagoya-u.ac.jp (marble.eps.nagoya-u.ac.jp [133.6.57.68]) by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id JAA03200 for ; Fri, 2 Feb 1996 09:16:18 -0800 (PST) Received: from marble.eps.nagoya-u.ac.jp (localhost [127.0.0.1]) by marble.eps.nagoya-u.ac.jp (8.7.3+2.6Wbeta5/3.3W9) with ESMTP id CAA00247; Sat, 3 Feb 1996 02:15:52 +0900 (JST) Message-Id: <199602021715.CAA00247@marble.eps.nagoya-u.ac.jp> To: davidg@Root.COM Cc: current@FreeBSD.org Subject: Re: TSS broken In-Reply-To: Your message of "Thu, 01 Feb 1996 03:28:58 -0800" References: <199602011128.DAA01552@Root.COM> X-Mailer: Mew beta version 0.96 on Emacs 19.28.1, Mule 2.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Date: Sat, 03 Feb 1996 02:15:50 +0900 From: KATO Takenori 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. If vm_machdep.c is compiled without -fomit-frame-pointer, esp is restored by: leal -16(%ebp),%esp and the popl and ret operations works correctly. On the other hand, if vm_machdep.c is compiled with -fomit-frame-pointer, esp is restored by: addl $24,%esp Because this code assumes esp points argument to savectx, popl operations restore the registers from wrong addresses, and also ret operation clobbers eip. The conclusion is simple. I should compile without -fomit-frame-pointer. ---- KATO Takenori Dept. Earth Planet. Sci., Nagoya Univ., Nagoya 464-01 Voice: +81-52-789-2529 Fax: +81-52-789-3033