From owner-cvs-sys Fri Apr 19 00:40:59 1996 Return-Path: owner-cvs-sys Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id AAA06856 for cvs-sys-outgoing; Fri, 19 Apr 1996 00:40:59 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id AAA06851 Fri, 19 Apr 1996 00:40:52 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id RAA06655; Fri, 19 Apr 1996 17:34:09 +1000 Date: Fri, 19 Apr 1996 17:34:09 +1000 From: Bruce Evans Message-Id: <199604190734.RAA06655@godzilla.zeta.org.au> To: davidg@Root.COM, phk@freefall.freebsd.org Subject: Re: cvs commit: src/sys/i386/i386 swtch.s vm_machdep.c src/sys/i386/include pcb.h src/sys/i386/isa wd.c Cc: CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-sys@freefall.freebsd.org Sender: owner-cvs-sys@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >>phk 96/04/18 14:37:49 >> >> Modified: sys/i386/i386 swtch.s vm_machdep.c >> sys/i386/include pcb.h >> Log: >> Fix a bogon. cpu_fork & savectx ecpected cpu_switch to restore %eax, >> they shouldn't. > Oh? Why shouldn't they? The code as it was written looks correct to me (I >wrote it, so this shouldn't be too surprising :-)). savectx() returned via cpu_switch() for the child case of cpu_fork(), so cpu_switch was expected to return both void and int :-). It actually returned void, and the PCB_EAX initialization for the child case was never used. I think the correct fix is to always return 1 or PCB_EAX(%edx) in cpu_switch(). This confusion goes back to early versions of 386BSD. In FreeBSD-1.1.5, I wrote at the end of swtch(): /* * XXX 0.0 gets here via swtch_to_inactive(). I think 0.1 gets here in * the same way. Better return a value. */ popl %eax /* return(p); */ IIRC, 386BSD-0.0 returned this value and 386BSD-0.1 returned a semi-random value. Bruce