Implement kcopy(), like bcopy(), but aborts if a fault is encountered.
Required for UVM.
This commit is contained in:
parent
91de585d5f
commit
8559f25d47
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: copy.s,v 1.28 1997/05/21 03:51:04 jeremy Exp $ */
|
||||
/* $NetBSD: copy.s,v 1.29 1998/02/15 21:18:45 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 Jason R. Thorpe. All rights reserved.
|
||||
* Copyright (c) 1994, 1995 Charles Hannum.
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -43,6 +44,8 @@
|
|||
* copyin/copyout, fuword/suword, etc.
|
||||
*/
|
||||
|
||||
#include "opt_uvm.h"
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <machine/asm.h>
|
||||
|
||||
|
@ -311,6 +314,33 @@ Lcosfault:
|
|||
moveq #EFAULT,d0
|
||||
bra Lcosdone
|
||||
|
||||
#if defined(UVM)
|
||||
/*
|
||||
* kcopy(const void *src, void *dst, size_t len);
|
||||
*
|
||||
* Copy len bytes from src to dst, aborting if we encounter a page fault.
|
||||
*/
|
||||
ENTRY(kcopy)
|
||||
link a6,#0
|
||||
movl _C_LABEL(curpcb),a0 | set fault handler
|
||||
movl #Lkcfault,a0@(PCB_ONFAULT)
|
||||
movl a6@(16),sp@- | push len
|
||||
movl a6@(12),sp@- | push dst
|
||||
movl a6@(8),sp@- | push src
|
||||
jbsr _C_LABEL(bcopy) | copy it
|
||||
addl #12,sp | pop args
|
||||
clrl d0 | success!
|
||||
Lkcdone:
|
||||
movl _C_LABEL(curpcb),a0 | clear fault handler
|
||||
clrl a0@(PCB_ONFAULT)
|
||||
unlk a6
|
||||
rts
|
||||
Lkcfault:
|
||||
addl #16,sp | pop args and return address
|
||||
moveq #EFAULT,d0 | indicate a fault
|
||||
bra Lkcdone
|
||||
#endif /* UVM */
|
||||
|
||||
/*
|
||||
* fuword(caddr_t uaddr);
|
||||
* Fetch an int from the user's address space.
|
||||
|
|
Loading…
Reference in New Issue