Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 1996 17:34:09 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        davidg@Root.COM, phk@freefall.freebsd.org
Cc:        CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-sys@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
Message-ID:  <199604190734.RAA06655@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604190734.RAA06655>