Subject: Re: kcopy() audit
To: Michael L. Hitch <osymh@terra.oscs.montana.edu>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 11/26/1998 12:47:03
On Thu, 26 Nov 1998 13:28:28 -0700 
 "Michael L. Hitch" <osymh@terra.oscs.montana.edu> wrote:

 >   The old fault handler is saved in S0, but then S0 is restored with the
 > saved S0 value before the fault handler is restored from S0.  That looks
 > to me like the fault handler will end up with whatever was in S0 when
 > kcopy() is called.

Yah, y'know, I thought I had that OK, but now that I look at it, I
did f*** up the delay slot there, didn't I.

Looks like kcopyerr could be rewritten as:

	lw	v1, _C_LABEL(curpcb)		# restore the old handler
	lw	ra, 44(sp)			# restore ra
	sw	s0, U_PCB_ONFAULT(v1)
	lw	s0, 32(sp)			# restore s0
	addu	sp, sp, 48			# kill stack frame
	j	ra
	li	v0, EFAULT			# return EFAULT

...and looks like I wrote it write the first time, and then committed
another rev which broke it :-/

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 940 5942