Date: Sat, 03 Feb 1996 02:15:50 +0900 From: KATO Takenori <kato@eclogite.eps.nagoya-u.ac.jp> To: davidg@Root.COM Cc: current@FreeBSD.org Subject: Re: TSS broken Message-ID: <199602021715.CAA00247@marble.eps.nagoya-u.ac.jp> In-Reply-To: Your message of "Thu, 01 Feb 1996 03:28:58 -0800" References: <199602011128.DAA01552@Root.COM>
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. 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 <kato@eclogite.eps.nagoya-u.ac.jp> Dept. Earth Planet. Sci., Nagoya Univ., Nagoya 464-01 Voice: +81-52-789-2529 Fax: +81-52-789-3033
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199602021715.CAA00247>