Subject: Re: kcopy(9) & co.
To: Cherry G. Mathew <cherry@sdf.lonestar.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 04/04/2006 09:13:46
On Tue, Apr 04, 2006 at 08:08:53PM +0530, Cherry G. Mathew wrote:
> Hi,
> 
> Its not very clear what kcopy() return values mean. Most (all ? )
> implementations are in assembler, and I can't seem to parse i386
> assembler as well as I thought I could ( messed up with RISC/VLIW :-)
> )
> 
> Would a good guess be:
> 
> 0 == success
> !0 == failure ( page fault). If so, would the right return value be EFAULT ?

ideally, kcopy() (and copyin(), copyout(), etc) should return the return
value of the uvm_fault() call (ie. in the trap handler) that failed.
here's the change in i386/trap.c:

----------------------------
revision 1.156
date: 2001/03/18 02:53:09;  author: chs;  state: Exp;  lines: +10 -4
in trap(), when invoking the pcb_onfault mechanism, pass the return value
of uvm_fault() to the onfault routine via %eax.  users of pcb_onfault now
return this value to their callers rather than always returning EFAULT.
this allows i/o errors in VOP_GETPAGES() to be returned back to read(), etc.
----------------------------

and there was a corresponding change in i386/locore.s.

-Chuck